Skip to content

Commit

Permalink
Auto merge of #51805 - pietroalbini:rollup, r=pietroalbini
Browse files Browse the repository at this point in the history
Rollup of 11 pull requests

Successful merges:

 - #51104 (add `dyn ` to display of dynamic (trait) types)
 - #51153 (Link panic and compile_error docs)
 - #51642 (Fix unknown windows build)
 - #51730 (New safe associated functions for PinMut)
 - #51731 (Fix ICEs when using continue as an array length inside closures (inside loop conditions))
 - #51747 (Add error for using null characters in #[export_name])
 - #51769 (Update broken rustc-guide links)
 - #51786 (Remove unnecessary stat64 pointer casts)
 - #51788 (Fix typo)
 - #51789 (Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`)
 - #51791 (Minify css)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jun 26, 2018
2 parents 309fd8a + a539885 commit 764232c
Show file tree
Hide file tree
Showing 98 changed files with 397 additions and 244 deletions.
6 changes: 3 additions & 3 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "minifier"
version = "0.0.11"
version = "0.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -2426,7 +2426,7 @@ dependencies = [
name = "rustdoc"
version = "0.0.0"
dependencies = [
"minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
Expand Down Expand Up @@ -3263,7 +3263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f"
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
"checksum minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "26f3e36a4db1981b16567e4abfd6ddc3641bc9b950bdc868701f656bf9b74bdd"
"checksum minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "78cb57f9a385530d60f2d67f6e108050b478b7a0ffd0bb9c350803e1356535dd"
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
"checksum miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9224c91f82b3c47cf53dcf78dfaa20d6888fbcc5d272d5f2fcdf8a697f3c987d"
"checksum nibble_vec 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c8d77f3db4bce033f4d04db08079b2ef1c3d02b44e86f25d08886fafa7756ffa"
Expand Down
14 changes: 10 additions & 4 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,12 @@ impl<'a, T: ?Sized + Unpin> PinMut<'a, T> {
pub fn new(reference: &'a mut T) -> PinMut<'a, T> {
PinMut { inner: reference }
}

/// Get a mutable reference to the data inside of this `PinMut`.
#[unstable(feature = "pin", issue = "49150")]
pub fn get_mut(this: PinMut<'a, T>) -> &'a mut T {
this.inner
}
}


Expand Down Expand Up @@ -1150,21 +1156,21 @@ impl<'a, T: ?Sized> PinMut<'a, T> {
/// the data out of the mutable reference you receive when you call this
/// function.
#[unstable(feature = "pin", issue = "49150")]
pub unsafe fn get_mut(this: PinMut<'a, T>) -> &'a mut T {
pub unsafe fn get_mut_unchecked(this: PinMut<'a, T>) -> &'a mut T {
this.inner
}

/// Construct a new pin by mapping the interior value.
///
/// For example, if you wanted to get a `PinMut` of a field of something, you
/// could use this to get access to that field in one line of code.
/// For example, if you wanted to get a `PinMut` of a field of something,
/// you could use this to get access to that field in one line of code.
///
/// This function is unsafe. You must guarantee that the data you return
/// will not move so long as the argument value does not move (for example,
/// because it is one of the fields of that value), and also that you do
/// not move out of the argument you receive to the interior function.
#[unstable(feature = "pin", issue = "49150")]
pub unsafe fn map<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where
pub unsafe fn map_unchecked<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where
F: FnOnce(&mut T) -> &mut U
{
PinMut { inner: f(this.inner) }
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl<T> Option<T> {
#[unstable(feature = "pin", issue = "49150")]
pub fn as_pin_mut<'a>(self: PinMut<'a, Self>) -> Option<PinMut<'a, T>> {
unsafe {
PinMut::get_mut(self).as_mut().map(|x| PinMut::new_unchecked(x))
PinMut::get_mut_unchecked(self).as_mut().map(|x| PinMut::new_unchecked(x))
}
}

Expand Down
40 changes: 25 additions & 15 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3536,12 +3536,22 @@ impl<'a> LoweringContext<'a> {
this.expr_block(block, ThinVec::new())
})
})
},
}
ExprKind::Closure(
capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span) =>
{
self.with_new_scopes(|this| {
if let IsAsync::Async(async_closure_node_id) = asyncness {
capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span
) => {
if let IsAsync::Async(async_closure_node_id) = asyncness {
let outer_decl = FnDecl {
inputs: decl.inputs.clone(),
output: FunctionRetTy::Default(fn_decl_span),
variadic: false,
};
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
// closure argument types.
let fn_decl = self.lower_fn_decl(&outer_decl, None, false, false);

self.with_new_scopes(|this| {
// FIXME(cramertj) allow `async` non-`move` closures with
if capture_clause == CaptureBy::Ref &&
!decl.inputs.is_empty()
Expand All @@ -3561,11 +3571,6 @@ impl<'a> LoweringContext<'a> {

// Transform `async |x: u8| -> X { ... }` into
// `|x: u8| future_from_generator(|| -> X { ... })`
let outer_decl = FnDecl {
inputs: decl.inputs.clone(),
output: FunctionRetTy::Default(fn_decl_span),
variadic: false,
};
let body_id = this.lower_body(Some(&outer_decl), |this| {
let async_ret_ty = if let FunctionRetTy::Ty(ty) = &decl.output {
Some(&**ty)
Expand All @@ -3579,12 +3584,17 @@ impl<'a> LoweringContext<'a> {
});
hir::ExprClosure(
this.lower_capture_clause(capture_clause),
this.lower_fn_decl(&outer_decl, None, false, false),
fn_decl,
body_id,
fn_decl_span,
None,
)
} else {
})
} else {
// Lower outside new scope to preserve `is_in_loop_condition`.
let fn_decl = self.lower_fn_decl(decl, None, false, false);

self.with_new_scopes(|this| {
let mut is_generator = false;
let body_id = this.lower_body(Some(decl), |this| {
let e = this.lower_expr(body);
Expand Down Expand Up @@ -3618,13 +3628,13 @@ impl<'a> LoweringContext<'a> {
};
hir::ExprClosure(
this.lower_capture_clause(capture_clause),
this.lower_fn_decl(decl, None, false, false),
fn_decl,
body_id,
fn_decl_span,
generator_option,
)
}
})
})
}
}
ExprKind::Block(ref blk, opt_label) => {
hir::ExprBlock(self.lower_block(blk,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/infer/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//! For a more detailed look at what is happening here, check
//! out the [chapter in the rustc guide][c].
//!
//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html
//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html
use infer::{InferCtxt, InferOk, InferResult, RegionVariableOrigin, TypeVariableOrigin};
use rustc_data_structures::indexed_vec::Idx;
Expand Down Expand Up @@ -274,7 +274,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// To get a good understanding of what is happening here, check
/// out the [chapter in the rustc guide][c].
///
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#processing-the-canonicalized-query-result
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#processing-the-canonicalized-query-result
pub fn instantiate_query_result<R>(
&self,
cause: &ObligationCause<'tcx>,
Expand Down Expand Up @@ -458,7 +458,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// To get a good understanding of what is happening here, check
/// out the [chapter in the rustc guide][c].
///
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#canonicalizing-the-query
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query
pub fn canonicalize_query<V>(&self, value: &V) -> (V::Canonicalized, CanonicalVarValues<'tcx>)
where
V: Canonicalize<'gcx, 'tcx>,
Expand Down Expand Up @@ -497,7 +497,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// To get a good understanding of what is happening here, check
/// out the [chapter in the rustc guide][c].
///
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#canonicalizing-the-query-result
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
pub fn canonicalize_response<V>(
&self,
value: &V,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/higher_ranked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
/// For more information about how skolemization for HRTBs works, see
/// the [rustc guide].
///
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-hrtb.html
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html
pub fn skolemize_late_bound_regions<T>(&self,
binder: &ty::Binder<T>)
-> (T, SkolemizationMap<'tcx>)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/lexical_region_resolve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> WARNING: This README is obsolete and will be removed soon! For
> more info on how the current borrowck works, see the [rustc guide].
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html

## Terminology

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/region_constraints/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> WARNING: This README is obsolete and will be removed soon! For
> more info on how the current borrowck works, see the [rustc guide].
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html

## Terminology

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! For more information about how MIR-based region-checking works,
//! see the [rustc guide].
//!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
use ich::{StableHashingContext, NodeIdHashingMode};
use util::nodemap::{FxHashMap, FxHashSet};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//! MIR datatypes and passes. See the [rustc guide] for more info.
//!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir.html
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/index.html
use graphviz::IntoCow;
use hir::def::CtorKind;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/traits/coherence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
//! See rustc guide chapters on [trait-resolution] and [trait-specialization] for more info on how
//! this works.
//!
//! [trait-resolution]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html
//! [trait-specialization]: https://rust-lang-nursery.github.io/rustc-guide/trait-specialization.html
//! [trait-resolution]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html
//! [trait-specialization]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html
use hir::def_id::{DefId, LOCAL_CRATE};
use syntax_pos::DUMMY_SP;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//! Trait Resolution. See [rustc guide] for more info on how this works.
//!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html
pub use self::SelectionError::*;
pub use self::FulfillmentErrorCode::*;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//! See [rustc guide] for more info on how this works.
//!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#selection
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#selection
use self::SelectionCandidate::*;
use self::EvaluationResult::*;
Expand Down Expand Up @@ -1047,7 +1047,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// candidates. See [rustc guide] for more details.
//
// [rustc guide]:
// https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#candidate-assembly
// https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#candidate-assembly

fn candidate_from_obligation<'o>(&mut self,
stack: &TraitObligationStack<'o, 'tcx>)
Expand Down Expand Up @@ -2415,7 +2415,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// type error. See [rustc guide] for more details.
//
// [rustc guide]:
// https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#confirmation
// https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#confirmation

fn confirm_candidate(&mut self,
obligation: &TraitObligation<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/specialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! See the [rustc guide] for a bit more detail on how specialization
//! fits together with the rest of the trait machinery.
//!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-specialization.html
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html
use super::{SelectionContext, FulfillmentContext};
use super::util::impl_trait_ref_and_oblig;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ pub type Region<'tcx> = &'tcx RegionKind;
///
/// [1]: http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/
/// [2]: http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-hrtb.html
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html
#[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)]
pub enum RegionKind {
// Region bound in a type or fn declaration which will be
Expand Down
8 changes: 6 additions & 2 deletions src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,10 +1062,14 @@ define_print! {
TyParam(ref param_ty) => write!(f, "{}", param_ty),
TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
TyDynamic(data, r) => {
data.print(f, cx)?;
let r = r.print_to_string(cx);
if !r.is_empty() {
write!(f, " + {}", r)
write!(f, "(")?;
}
write!(f, "dyn ")?;
data.print(f, cx)?;
if !r.is_empty() {
write!(f, " + {})", r)
} else {
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/borrowck/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> WARNING: This README is more or less obsolete, and will be removed
> soon! The new system is described in the [rustc guide].
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html

This pass has the job of enforcing memory safety. This is a subtle
topic. This docs aim to explain both the practice and the theory
Expand Down
5 changes: 0 additions & 5 deletions src/librustc_codegen_llvm/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,3 @@ unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
"##,

}


register_diagnostics! {
E0558
}
6 changes: 3 additions & 3 deletions src/librustc_mir/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// ==============
/// Finds the breakable scope for a given label. This is used for
/// resolving `break` and `continue`.
pub fn find_breakable_scope(&mut self,
pub fn find_breakable_scope(&self,
span: Span,
label: region::Scope)
-> &mut BreakableScope<'tcx> {
-> &BreakableScope<'tcx> {
// find the loop-scope with the correct id
self.breakable_scopes.iter_mut()
self.breakable_scopes.iter()
.rev()
.filter(|breakable_scope| breakable_scope.region_scope == label)
.next()
Expand Down
Loading

0 comments on commit 764232c

Please sign in to comment.