Skip to content

Commit d4f3940

Browse files
authored
Merge pull request #37173 from brson/stable-next
[stable] Backports for 1.12.1
2 parents 3191fba + 2d49342 commit d4f3940

File tree

23 files changed

+269
-50
lines changed

23 files changed

+269
-50
lines changed

mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
######################################################################
1414

1515
# The version number
16-
CFG_RELEASE_NUM=1.12.0
16+
CFG_RELEASE_NUM=1.12.1
1717

1818
# An optional number to put after the label, e.g. '.2' -> '-beta.2'
1919
# NB Make sure it starts with a dot to conform to semver pre-release

src/librustc/ty/flags.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ impl FlagComputation {
107107
}
108108

109109
&ty::TyProjection(ref data) => {
110+
// currently we can't normalize projections that
111+
// include bound regions, so track those separately.
112+
if !data.has_escaping_regions() {
113+
self.add_flags(TypeFlags::HAS_NORMALIZABLE_PROJECTION);
114+
}
110115
self.add_flags(TypeFlags::HAS_PROJECTION);
111116
self.add_projection_ty(data);
112117
}

src/librustc/ty/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
105105
TypeFlags::HAS_FREE_REGIONS |
106106
TypeFlags::HAS_TY_INFER |
107107
TypeFlags::HAS_PARAMS |
108-
TypeFlags::HAS_PROJECTION |
108+
TypeFlags::HAS_NORMALIZABLE_PROJECTION |
109109
TypeFlags::HAS_TY_ERR |
110110
TypeFlags::HAS_SELF)
111111
}

src/librustc/ty/item_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
305305
/// Returns the def-id of `def_id`'s parent in the def tree. If
306306
/// this returns `None`, then `def_id` represents a crate root or
307307
/// inlined root.
308-
fn parent_def_id(&self, def_id: DefId) -> Option<DefId> {
308+
pub fn parent_def_id(&self, def_id: DefId) -> Option<DefId> {
309309
let key = self.def_key(def_id);
310310
key.parent.map(|index| DefId { krate: def_id.krate, index: index })
311311
}

src/librustc/ty/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ bitflags! {
527527
// Only set for TyInfer other than Fresh.
528528
const KEEP_IN_LOCAL_TCX = 1 << 11,
529529

530+
// Is there a projection that does not involve a bound region?
531+
// Currently we can't normalize projections w/ bound regions.
532+
const HAS_NORMALIZABLE_PROJECTION = 1 << 12,
533+
530534
const NEEDS_SUBST = TypeFlags::HAS_PARAMS.bits |
531535
TypeFlags::HAS_SELF.bits |
532536
TypeFlags::HAS_RE_EARLY_BOUND.bits,

src/librustc_mir/build/expr/as_lvalue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
9696
ExprKind::LogicalOp { .. } |
9797
ExprKind::Box { .. } |
9898
ExprKind::Cast { .. } |
99+
ExprKind::Use { .. } |
99100
ExprKind::NeverToAny { .. } |
100101
ExprKind::ReifyFnPointer { .. } |
101102
ExprKind::UnsafeFnPointer { .. } |

src/librustc_mir/build/expr/as_rvalue.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
115115
let source = unpack!(block = this.as_operand(block, source));
116116
block.and(Rvalue::Cast(CastKind::Misc, source, expr.ty))
117117
}
118+
ExprKind::Use { source } => {
119+
let source = unpack!(block = this.as_operand(block, source));
120+
block.and(Rvalue::Use(source))
121+
}
118122
ExprKind::ReifyFnPointer { source } => {
119123
let source = unpack!(block = this.as_operand(block, source));
120124
block.and(Rvalue::Cast(CastKind::ReifyFnPointer, source, expr.ty))

src/librustc_mir/build/expr/category.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ impl Category {
6868
ExprKind::Binary { .. } |
6969
ExprKind::Box { .. } |
7070
ExprKind::Cast { .. } |
71+
ExprKind::Use { .. } |
7172
ExprKind::ReifyFnPointer { .. } |
7273
ExprKind::UnsafeFnPointer { .. } |
7374
ExprKind::Unsize { .. } |

src/librustc_mir/build/expr/into.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
249249
ExprKind::Binary { .. } |
250250
ExprKind::Box { .. } |
251251
ExprKind::Cast { .. } |
252+
ExprKind::Use { .. } |
252253
ExprKind::ReifyFnPointer { .. } |
253254
ExprKind::UnsafeFnPointer { .. } |
254255
ExprKind::Unsize { .. } |

src/librustc_mir/hair/cx/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
602602
// Check to see if this cast is a "coercion cast", where the cast is actually done
603603
// using a coercion (or is a no-op).
604604
if let Some(&TyCastKind::CoercionCast) = cx.tcx.cast_kinds.borrow().get(&source.id) {
605-
// Skip the actual cast itexpr, as it's now a no-op.
606-
return source.make_mirror(cx);
605+
// Convert the lexpr to a vexpr.
606+
ExprKind::Use { source: source.to_ref() }
607607
} else {
608608
ExprKind::Cast { source: source.to_ref() }
609609
}

0 commit comments

Comments
 (0)