Skip to content

Commit 764232c

Browse files
committed
Auto merge of #51805 - pietroalbini:rollup, r=pietroalbini
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
2 parents 309fd8a + a539885 commit 764232c

File tree

98 files changed

+397
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+397
-244
lines changed

src/Cargo.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
12201220

12211221
[[package]]
12221222
name = "minifier"
1223-
version = "0.0.11"
1223+
version = "0.0.14"
12241224
source = "registry+https://github.com/rust-lang/crates.io-index"
12251225
dependencies = [
12261226
"regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2426,7 +2426,7 @@ dependencies = [
24262426
name = "rustdoc"
24272427
version = "0.0.0"
24282428
dependencies = [
2429-
"minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
2429+
"minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
24302430
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
24312431
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
24322432
]
@@ -3263,7 +3263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32633263
"checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f"
32643264
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
32653265
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
3266-
"checksum minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "26f3e36a4db1981b16567e4abfd6ddc3641bc9b950bdc868701f656bf9b74bdd"
3266+
"checksum minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "78cb57f9a385530d60f2d67f6e108050b478b7a0ffd0bb9c350803e1356535dd"
32673267
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
32683268
"checksum miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9224c91f82b3c47cf53dcf78dfaa20d6888fbcc5d272d5f2fcdf8a697f3c987d"
32693269
"checksum nibble_vec 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c8d77f3db4bce033f4d04db08079b2ef1c3d02b44e86f25d08886fafa7756ffa"

src/libcore/mem.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,12 @@ impl<'a, T: ?Sized + Unpin> PinMut<'a, T> {
11191119
pub fn new(reference: &'a mut T) -> PinMut<'a, T> {
11201120
PinMut { inner: reference }
11211121
}
1122+
1123+
/// Get a mutable reference to the data inside of this `PinMut`.
1124+
#[unstable(feature = "pin", issue = "49150")]
1125+
pub fn get_mut(this: PinMut<'a, T>) -> &'a mut T {
1126+
this.inner
1127+
}
11221128
}
11231129

11241130

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

11571163
/// Construct a new pin by mapping the interior value.
11581164
///
1159-
/// For example, if you wanted to get a `PinMut` of a field of something, you
1160-
/// could use this to get access to that field in one line of code.
1165+
/// For example, if you wanted to get a `PinMut` of a field of something,
1166+
/// you could use this to get access to that field in one line of code.
11611167
///
11621168
/// This function is unsafe. You must guarantee that the data you return
11631169
/// will not move so long as the argument value does not move (for example,
11641170
/// because it is one of the fields of that value), and also that you do
11651171
/// not move out of the argument you receive to the interior function.
11661172
#[unstable(feature = "pin", issue = "49150")]
1167-
pub unsafe fn map<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where
1173+
pub unsafe fn map_unchecked<U, F>(this: PinMut<'a, T>, f: F) -> PinMut<'a, U> where
11681174
F: FnOnce(&mut T) -> &mut U
11691175
{
11701176
PinMut { inner: f(this.inner) }

src/libcore/option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ impl<T> Option<T> {
275275
#[unstable(feature = "pin", issue = "49150")]
276276
pub fn as_pin_mut<'a>(self: PinMut<'a, Self>) -> Option<PinMut<'a, T>> {
277277
unsafe {
278-
PinMut::get_mut(self).as_mut().map(|x| PinMut::new_unchecked(x))
278+
PinMut::get_mut_unchecked(self).as_mut().map(|x| PinMut::new_unchecked(x))
279279
}
280280
}
281281

src/librustc/hir/lowering.rs

+25-15
Original file line numberDiff line numberDiff line change
@@ -3536,12 +3536,22 @@ impl<'a> LoweringContext<'a> {
35363536
this.expr_block(block, ThinVec::new())
35373537
})
35383538
})
3539-
},
3539+
}
35403540
ExprKind::Closure(
3541-
capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span) =>
3542-
{
3543-
self.with_new_scopes(|this| {
3544-
if let IsAsync::Async(async_closure_node_id) = asyncness {
3541+
capture_clause, asyncness, movability, ref decl, ref body, fn_decl_span
3542+
) => {
3543+
if let IsAsync::Async(async_closure_node_id) = asyncness {
3544+
let outer_decl = FnDecl {
3545+
inputs: decl.inputs.clone(),
3546+
output: FunctionRetTy::Default(fn_decl_span),
3547+
variadic: false,
3548+
};
3549+
// We need to lower the declaration outside the new scope, because we
3550+
// have to conserve the state of being inside a loop condition for the
3551+
// closure argument types.
3552+
let fn_decl = self.lower_fn_decl(&outer_decl, None, false, false);
3553+
3554+
self.with_new_scopes(|this| {
35453555
// FIXME(cramertj) allow `async` non-`move` closures with
35463556
if capture_clause == CaptureBy::Ref &&
35473557
!decl.inputs.is_empty()
@@ -3561,11 +3571,6 @@ impl<'a> LoweringContext<'a> {
35613571

35623572
// Transform `async |x: u8| -> X { ... }` into
35633573
// `|x: u8| future_from_generator(|| -> X { ... })`
3564-
let outer_decl = FnDecl {
3565-
inputs: decl.inputs.clone(),
3566-
output: FunctionRetTy::Default(fn_decl_span),
3567-
variadic: false,
3568-
};
35693574
let body_id = this.lower_body(Some(&outer_decl), |this| {
35703575
let async_ret_ty = if let FunctionRetTy::Ty(ty) = &decl.output {
35713576
Some(&**ty)
@@ -3579,12 +3584,17 @@ impl<'a> LoweringContext<'a> {
35793584
});
35803585
hir::ExprClosure(
35813586
this.lower_capture_clause(capture_clause),
3582-
this.lower_fn_decl(&outer_decl, None, false, false),
3587+
fn_decl,
35833588
body_id,
35843589
fn_decl_span,
35853590
None,
35863591
)
3587-
} else {
3592+
})
3593+
} else {
3594+
// Lower outside new scope to preserve `is_in_loop_condition`.
3595+
let fn_decl = self.lower_fn_decl(decl, None, false, false);
3596+
3597+
self.with_new_scopes(|this| {
35883598
let mut is_generator = false;
35893599
let body_id = this.lower_body(Some(decl), |this| {
35903600
let e = this.lower_expr(body);
@@ -3618,13 +3628,13 @@ impl<'a> LoweringContext<'a> {
36183628
};
36193629
hir::ExprClosure(
36203630
this.lower_capture_clause(capture_clause),
3621-
this.lower_fn_decl(decl, None, false, false),
3631+
fn_decl,
36223632
body_id,
36233633
fn_decl_span,
36243634
generator_option,
36253635
)
3626-
}
3627-
})
3636+
})
3637+
}
36283638
}
36293639
ExprKind::Block(ref blk, opt_label) => {
36303640
hir::ExprBlock(self.lower_block(blk,

src/librustc/infer/canonical.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//! For a more detailed look at what is happening here, check
3030
//! out the [chapter in the rustc guide][c].
3131
//!
32-
//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html
32+
//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html
3333
3434
use infer::{InferCtxt, InferOk, InferResult, RegionVariableOrigin, TypeVariableOrigin};
3535
use rustc_data_structures::indexed_vec::Idx;
@@ -274,7 +274,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
274274
/// To get a good understanding of what is happening here, check
275275
/// out the [chapter in the rustc guide][c].
276276
///
277-
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#processing-the-canonicalized-query-result
277+
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#processing-the-canonicalized-query-result
278278
pub fn instantiate_query_result<R>(
279279
&self,
280280
cause: &ObligationCause<'tcx>,
@@ -458,7 +458,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
458458
/// To get a good understanding of what is happening here, check
459459
/// out the [chapter in the rustc guide][c].
460460
///
461-
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#canonicalizing-the-query
461+
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query
462462
pub fn canonicalize_query<V>(&self, value: &V) -> (V::Canonicalized, CanonicalVarValues<'tcx>)
463463
where
464464
V: Canonicalize<'gcx, 'tcx>,
@@ -497,7 +497,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
497497
/// To get a good understanding of what is happening here, check
498498
/// out the [chapter in the rustc guide][c].
499499
///
500-
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits-canonicalization.html#canonicalizing-the-query-result
500+
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result
501501
pub fn canonicalize_response<V>(
502502
&self,
503503
value: &V,

src/librustc/infer/higher_ranked/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
583583
/// For more information about how skolemization for HRTBs works, see
584584
/// the [rustc guide].
585585
///
586-
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-hrtb.html
586+
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html
587587
pub fn skolemize_late_bound_regions<T>(&self,
588588
binder: &ty::Binder<T>)
589589
-> (T, SkolemizationMap<'tcx>)

src/librustc/infer/lexical_region_resolve/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> WARNING: This README is obsolete and will be removed soon! For
44
> more info on how the current borrowck works, see the [rustc guide].
55
6-
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
6+
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
77

88
## Terminology
99

src/librustc/infer/region_constraints/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> WARNING: This README is obsolete and will be removed soon! For
44
> more info on how the current borrowck works, see the [rustc guide].
55
6-
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
6+
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
77

88
## Terminology
99

src/librustc/middle/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! For more information about how MIR-based region-checking works,
1515
//! see the [rustc guide].
1616
//!
17-
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
17+
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
1818
1919
use ich::{StableHashingContext, NodeIdHashingMode};
2020
use util::nodemap::{FxHashMap, FxHashSet};

src/librustc/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! MIR datatypes and passes. See the [rustc guide] for more info.
1212
//!
13-
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir.html
13+
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/index.html
1414
1515
use graphviz::IntoCow;
1616
use hir::def::CtorKind;

src/librustc/traits/coherence.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
//! See rustc guide chapters on [trait-resolution] and [trait-specialization] for more info on how
1212
//! this works.
1313
//!
14-
//! [trait-resolution]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html
15-
//! [trait-specialization]: https://rust-lang-nursery.github.io/rustc-guide/trait-specialization.html
14+
//! [trait-resolution]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html
15+
//! [trait-specialization]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html
1616
1717
use hir::def_id::{DefId, LOCAL_CRATE};
1818
use syntax_pos::DUMMY_SP;

src/librustc/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Trait Resolution. See [rustc guide] for more info on how this works.
1212
//!
13-
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html
13+
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html
1414
1515
pub use self::SelectionError::*;
1616
pub use self::FulfillmentErrorCode::*;

src/librustc/traits/select.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! See [rustc guide] for more info on how this works.
1212
//!
13-
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#selection
13+
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#selection
1414
1515
use self::SelectionCandidate::*;
1616
use self::EvaluationResult::*;
@@ -1047,7 +1047,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
10471047
// candidates. See [rustc guide] for more details.
10481048
//
10491049
// [rustc guide]:
1050-
// https://rust-lang-nursery.github.io/rustc-guide/trait-resolution.html#candidate-assembly
1050+
// https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#candidate-assembly
10511051

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

24202420
fn confirm_candidate(&mut self,
24212421
obligation: &TraitObligation<'tcx>,

src/librustc/traits/specialize/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! See the [rustc guide] for a bit more detail on how specialization
1818
//! fits together with the rest of the trait machinery.
1919
//!
20-
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-specialization.html
20+
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html
2121
2222
use super::{SelectionContext, FulfillmentContext};
2323
use super::util::impl_trait_ref_and_oblig;

src/librustc/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ pub type Region<'tcx> = &'tcx RegionKind;
10871087
///
10881088
/// [1]: http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/
10891089
/// [2]: http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
1090-
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/trait-hrtb.html
1090+
/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html
10911091
#[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)]
10921092
pub enum RegionKind {
10931093
// Region bound in a type or fn declaration which will be

src/librustc/util/ppaux.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,14 @@ define_print! {
10621062
TyParam(ref param_ty) => write!(f, "{}", param_ty),
10631063
TyAdt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
10641064
TyDynamic(data, r) => {
1065-
data.print(f, cx)?;
10661065
let r = r.print_to_string(cx);
10671066
if !r.is_empty() {
1068-
write!(f, " + {}", r)
1067+
write!(f, "(")?;
1068+
}
1069+
write!(f, "dyn ")?;
1070+
data.print(f, cx)?;
1071+
if !r.is_empty() {
1072+
write!(f, " + {})", r)
10691073
} else {
10701074
Ok(())
10711075
}

src/librustc_borrowck/borrowck/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> WARNING: This README is more or less obsolete, and will be removed
44
> soon! The new system is described in the [rustc guide].
55
6-
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir-borrowck.html
6+
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html
77

88
This pass has the job of enforcing memory safety. This is a subtle
99
topic. This docs aim to explain both the practice and the theory

src/librustc_codegen_llvm/diagnostics.rs

-5
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,3 @@ unsafe { simd_add(i32x2(0, 0), i32x2(1, 2)); } // ok!
4848
"##,
4949

5050
}
51-
52-
53-
register_diagnostics! {
54-
E0558
55-
}

src/librustc_mir/build/scope.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
540540
// ==============
541541
/// Finds the breakable scope for a given label. This is used for
542542
/// resolving `break` and `continue`.
543-
pub fn find_breakable_scope(&mut self,
543+
pub fn find_breakable_scope(&self,
544544
span: Span,
545545
label: region::Scope)
546-
-> &mut BreakableScope<'tcx> {
546+
-> &BreakableScope<'tcx> {
547547
// find the loop-scope with the correct id
548-
self.breakable_scopes.iter_mut()
548+
self.breakable_scopes.iter()
549549
.rev()
550550
.filter(|breakable_scope| breakable_scope.region_scope == label)
551551
.next()

0 commit comments

Comments
 (0)