Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #51805

Merged
merged 30 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d259f43
Fix doc build on unknown windows target
GuillaumeGomez Jun 19, 2018
3bcb85e
`PinMut`: Add safe `get_mut` and rename unsafe fns to `get_mut_unchec…
MajorBreakfast Jun 23, 2018
f68ee0b
Fix an ICE with `continue` as an array length
varkor Jun 23, 2018
4efd5c7
Fix an ICE with continue inside a closure inside a loop condition
varkor Jun 23, 2018
dc7d77f
Add a test for break
varkor Jun 23, 2018
ee7e30f
Fix codegen tests
varkor Jun 23, 2018
74609bc
Add error for using null characters in export_name
varkor Jun 23, 2018
82803fd
Add backticks to E0558
varkor Jun 23, 2018
4b18085
add `dyn` to display of dynamic (trait) type names
zackmdavis May 27, 2018
f94c075
Add item after attribute
varkor Jun 24, 2018
fdc2275
Update broken rustc-guide links
Jun 25, 2018
2d3c369
Link the docs of panic!() and compile_error!()
ogham May 29, 2018
f85ddfb
Add sentence to compile_error!() docs
ogham May 29, 2018
c3d6ee9
Make find_breakable_scope non-mutable
varkor Jun 25, 2018
3c6c18d
Add missing \[allow(missing_docs)\]
GuillaumeGomez Jun 25, 2018
490f49f
Remove unnecessary stat64 pointer casts
cuviper Jun 25, 2018
0747968
Fix typo
Jun 25, 2018
7aab3bf
Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`
estebank Jun 25, 2018
f7485df
Minify css
GuillaumeGomez Jun 25, 2018
d72a67f
Rollup merge of #51104 - zackmdavis:dynamo, r=nikomatsakis
pietroalbini Jun 26, 2018
756b694
Rollup merge of #51153 - ogham:panic-and-compile_error-docs, r=Guilla…
pietroalbini Jun 26, 2018
1215965
Rollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=…
pietroalbini Jun 26, 2018
b71f6df
Rollup merge of #51730 - MajorBreakfast:pin-get-mut-unchecked, r=with…
pietroalbini Jun 26, 2018
7262824
Rollup merge of #51731 - varkor:closure-array-break-length, r=estebank
pietroalbini Jun 26, 2018
b2cf26e
Rollup merge of #51747 - varkor:export_name-null-character, r=estebank
pietroalbini Jun 26, 2018
932db19
Rollup merge of #51769 - alexcameron89:update_rustc_guide_links, r=fr…
pietroalbini Jun 26, 2018
2348dc5
Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-Simulacrum
pietroalbini Jun 26, 2018
8014713
Rollup merge of #51788 - berkus:fix-typo, r=varkor
pietroalbini Jun 26, 2018
f2a099b
Rollup merge of #51789 - estebank:issue-50577, r=oli-obk
pietroalbini Jun 26, 2018
a539885
Rollup merge of #51791 - GuillaumeGomez:minify-css, r=estebank
pietroalbini Jun 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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