Skip to content

Commit 026339e

Browse files
committed
Auto merge of #48520 - Manishearth:rollup, r=Manishearth
Rollup of 15 pull requests - Successful merges: #47689, #48110, #48197, #48296, #48386, #48392, #48404, #48415, #48441, #48448, #48452, #48481, #48490, #48499, #48503 - Failed merges:
2 parents 28a1e4f + 52047f0 commit 026339e

File tree

57 files changed

+941
-546
lines changed

Some content is hidden

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

57 files changed

+941
-546
lines changed

src/bootstrap/native.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl Step for TestHelpers {
313313
type Output = ();
314314

315315
fn should_run(run: ShouldRun) -> ShouldRun {
316-
run.path("src/rt/rust_test_helpers.c")
316+
run.path("src/test/auxiliary/rust_test_helpers.c")
317317
}
318318

319319
fn make_run(run: RunConfig) {
@@ -326,7 +326,7 @@ impl Step for TestHelpers {
326326
let build = builder.build;
327327
let target = self.target;
328328
let dst = build.test_helpers_out(target);
329-
let src = build.src.join("src/rt/rust_test_helpers.c");
329+
let src = build.src.join("src/test/auxiliary/rust_test_helpers.c");
330330
if up_to_date(&src, &dst.join("librust_test_helpers.a")) {
331331
return
332332
}
@@ -353,7 +353,7 @@ impl Step for TestHelpers {
353353
.opt_level(0)
354354
.warnings(false)
355355
.debug(false)
356-
.file(build.src.join("src/rt/rust_test_helpers.c"))
356+
.file(build.src.join("src/test/auxiliary/rust_test_helpers.c"))
357357
.compile("rust_test_helpers");
358358
}
359359
}

src/liballoc/boxed.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,6 @@ impl<T: ?Sized> Box<T> {
359359
/// Simple usage:
360360
///
361361
/// ```
362-
/// #![feature(box_leak)]
363-
///
364362
/// fn main() {
365363
/// let x = Box::new(41);
366364
/// let static_ref: &'static mut usize = Box::leak(x);
@@ -372,17 +370,14 @@ impl<T: ?Sized> Box<T> {
372370
/// Unsized data:
373371
///
374372
/// ```
375-
/// #![feature(box_leak)]
376-
///
377373
/// fn main() {
378374
/// let x = vec![1, 2, 3].into_boxed_slice();
379375
/// let static_ref = Box::leak(x);
380376
/// static_ref[0] = 4;
381377
/// assert_eq!(*static_ref, [4, 2, 3]);
382378
/// }
383379
/// ```
384-
#[unstable(feature = "box_leak", reason = "needs an FCP to stabilize",
385-
issue = "46179")]
380+
#[stable(feature = "box_leak", since = "1.26.0")]
386381
#[inline]
387382
pub fn leak<'a>(b: Box<T>) -> &'a mut T
388383
where

src/librustc/hir/lowering.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2956,7 +2956,7 @@ impl<'a> LoweringContext<'a> {
29562956

29572957
// Desugar ExprIfLet
29582958
// From: `if let <pat> = <sub_expr> <body> [<else_opt>]`
2959-
ExprKind::IfLet(ref pat, ref sub_expr, ref body, ref else_opt) => {
2959+
ExprKind::IfLet(ref pats, ref sub_expr, ref body, ref else_opt) => {
29602960
// to:
29612961
//
29622962
// match <sub_expr> {
@@ -2970,8 +2970,8 @@ impl<'a> LoweringContext<'a> {
29702970
{
29712971
let body = self.lower_block(body, false);
29722972
let body_expr = P(self.expr_block(body, ThinVec::new()));
2973-
let pat = self.lower_pat(pat);
2974-
arms.push(self.arm(hir_vec![pat], body_expr));
2973+
let pats = pats.iter().map(|pat| self.lower_pat(pat)).collect();
2974+
arms.push(self.arm(pats, body_expr));
29752975
}
29762976

29772977
// _ => [<else_opt>|()]
@@ -3000,7 +3000,7 @@ impl<'a> LoweringContext<'a> {
30003000

30013001
// Desugar ExprWhileLet
30023002
// From: `[opt_ident]: while let <pat> = <sub_expr> <body>`
3003-
ExprKind::WhileLet(ref pat, ref sub_expr, ref body, opt_label) => {
3003+
ExprKind::WhileLet(ref pats, ref sub_expr, ref body, opt_label) => {
30043004
// to:
30053005
//
30063006
// [opt_ident]: loop {
@@ -3021,8 +3021,8 @@ impl<'a> LoweringContext<'a> {
30213021
// `<pat> => <body>`
30223022
let pat_arm = {
30233023
let body_expr = P(self.expr_block(body, ThinVec::new()));
3024-
let pat = self.lower_pat(pat);
3025-
self.arm(hir_vec![pat], body_expr)
3024+
let pats = pats.iter().map(|pat| self.lower_pat(pat)).collect();
3025+
self.arm(pats, body_expr)
30263026
};
30273027

30283028
// `_ => break`

src/librustc/ich/impls_ty.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,19 @@ for ty::subst::Kind<'gcx> {
5656
fn hash_stable<W: StableHasherResult>(&self,
5757
hcx: &mut StableHashingContext<'gcx>,
5858
hasher: &mut StableHasher<W>) {
59-
self.as_type().hash_stable(hcx, hasher);
60-
self.as_region().hash_stable(hcx, hasher);
59+
self.unpack().hash_stable(hcx, hasher);
60+
}
61+
}
62+
63+
impl<'gcx> HashStable<StableHashingContext<'gcx>>
64+
for ty::subst::UnpackedKind<'gcx> {
65+
fn hash_stable<W: StableHasherResult>(&self,
66+
hcx: &mut StableHashingContext<'gcx>,
67+
hasher: &mut StableHasher<W>) {
68+
match self {
69+
ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher),
70+
ty::subst::UnpackedKind::Type(ty) => ty.hash_stable(hcx, hasher),
71+
}
6172
}
6273
}
6374

src/librustc/infer/anon_types/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use traits::{self, PredicateObligation};
1717
use ty::{self, Ty};
1818
use ty::fold::{BottomUpFolder, TypeFoldable};
1919
use ty::outlives::Component;
20-
use ty::subst::{Kind, Substs};
20+
use ty::subst::{Kind, UnpackedKind, Substs};
2121
use util::nodemap::DefIdMap;
2222

2323
pub type AnonTypeMap<'tcx> = DefIdMap<AnonTypeDecl<'tcx>>;
@@ -321,7 +321,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
321321
let index = region_def.index as usize;
322322

323323
// Get the value supplied for this region from the substs.
324-
let subst_arg = anon_defn.substs[index].as_region().unwrap();
324+
let subst_arg = anon_defn.substs.region_at(index);
325325

326326
// Compute the least upper bound of it with the other regions.
327327
debug!("constrain_anon_types: least_region={:?}", least_region);
@@ -466,7 +466,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
466466
// All other regions, we map them appropriately to their adjusted
467467
// indices, erroring if we find any lifetimes that were not mapped
468468
// into the new set.
469-
_ => if let Some(r1) = map.get(&Kind::from(r)).and_then(|k| k.as_region()) {
469+
_ => if let Some(UnpackedKind::Lifetime(r1)) = map.get(&r.into())
470+
.map(|k| k.unpack()) {
470471
r1
471472
} else {
472473
// No mapping was found. This means that

src/librustc/traits/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub enum IntercrateMode {
7373
/// either identifying an `impl` (e.g., `impl Eq for int`) that
7474
/// provides the required vtable, or else finding a bound that is in
7575
/// scope. The eventual result is usually a `Selection` (defined below).
76-
#[derive(Clone, PartialEq, Eq)]
76+
#[derive(Clone, PartialEq, Eq, Hash)]
7777
pub struct Obligation<'tcx, T> {
7878
pub cause: ObligationCause<'tcx>,
7979
pub param_env: ty::ParamEnv<'tcx>,
@@ -85,7 +85,7 @@ pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
8585
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
8686

8787
/// Why did we incur this obligation? Used for error reporting.
88-
#[derive(Clone, Debug, PartialEq, Eq)]
88+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8989
pub struct ObligationCause<'tcx> {
9090
pub span: Span,
9191

@@ -113,7 +113,7 @@ impl<'tcx> ObligationCause<'tcx> {
113113
}
114114
}
115115

116-
#[derive(Clone, Debug, PartialEq, Eq)]
116+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
117117
pub enum ObligationCauseCode<'tcx> {
118118
/// Not well classified or should be obvious from span.
119119
MiscObligation,
@@ -215,7 +215,7 @@ pub enum ObligationCauseCode<'tcx> {
215215
BlockTailExpression(ast::NodeId),
216216
}
217217

218-
#[derive(Clone, Debug, PartialEq, Eq)]
218+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
219219
pub struct DerivedObligationCause<'tcx> {
220220
/// The trait reference of the parent obligation that led to the
221221
/// current obligation. Note that only trait obligations lead to
@@ -304,7 +304,7 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
304304
/// ### The type parameter `N`
305305
///
306306
/// See explanation on `VtableImplData`.
307-
#[derive(Clone, RustcEncodable, RustcDecodable)]
307+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
308308
pub enum Vtable<'tcx, N> {
309309
/// Vtable identifying a particular impl.
310310
VtableImpl(VtableImplData<'tcx, N>),
@@ -374,13 +374,13 @@ pub struct VtableClosureData<'tcx, N> {
374374
pub nested: Vec<N>
375375
}
376376

377-
#[derive(Clone, RustcEncodable, RustcDecodable)]
377+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
378378
pub struct VtableAutoImplData<N> {
379379
pub trait_def_id: DefId,
380380
pub nested: Vec<N>
381381
}
382382

383-
#[derive(Clone, RustcEncodable, RustcDecodable)]
383+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
384384
pub struct VtableBuiltinData<N> {
385385
pub nested: Vec<N>
386386
}

0 commit comments

Comments
 (0)