Skip to content

Commit 29c0364

Browse files
committed
rebase
1 parent db9a2d2 commit 29c0364

22 files changed

+25
-56
lines changed

compiler/rustc_const_eval/src/interpret/operand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
583583
pub fn uneval_to_op(
584584
&self,
585585
uneval: &ty::Unevaluated<'tcx>,
586-
) -> InterpResult<'tcx, OpTy<'tcx, M::PointerTag>> {
586+
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
587587
let instance = self.resolve(uneval.def, uneval.substs)?;
588588
Ok(self.eval_to_allocation(GlobalId { instance, promoted: uneval.promoted })?.into())
589589
}

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
17171717
// Postpone the evaluation of constants whose substs depend on inference
17181718
// variables
17191719
if substs.has_infer_types_or_consts() {
1720-
let ac = AbstractConst::new(self.tcx, unevaluated.shrink());
1720+
let ac = AbstractConst::new(self.tcx, unevaluated);
17211721
match ac {
17221722
Ok(None) => {
17231723
substs = InternalSubsts::identity_for_item(self.tcx, unevaluated.def.did);

compiler/rustc_ty_utils/src/consts.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,6 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
222222
debug!("AbstractConstBuilder::build: body={:?}", &*self.body);
223223
self.recurse_build(self.body_id)?;
224224

225-
for n in self.nodes.iter() {
226-
if let Node::Leaf(ct) = n {
227-
if let ty::ConstKind::Unevaluated(ct) = ct.kind() {
228-
// `AbstractConst`s should not contain any promoteds as they require references which
229-
// are not allowed.
230-
assert_eq!(ct.promoted, None);
231-
assert_eq!(ct, self.tcx.erase_regions(ct));
232-
}
233-
}
234-
}
235-
236225
Ok(self.tcx.arena.alloc_from_iter(self.nodes.into_iter()))
237226
}
238227

src/librustdoc/clean/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub(crate) fn print_const(cx: &DocContext<'_>, n: ty::Const<'_>) -> String {
236236
match n.kind() {
237237
ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs: _, promoted }) => {
238238
assert_eq!(promoted, ());
239-
let mut s = if let Some(def) = def.as_local() {
239+
let s = if let Some(def) = def.as_local() {
240240
print_const_expr(cx.tcx, cx.tcx.hir().body_owned_by(def.did))
241241
} else {
242242
inline::print_inlined_const(cx.tcx, def.did)

src/test/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:+0:32: +0:34
1818
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:+0:33: +0:34
1919
- _5 = const {alloc1: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:+0:33: +0:34
20-
+ _6 = const BAR::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:+0:31: +0:44
20+
+ _6 = const _; // scope 0 at $DIR/const-promotion-extern-static.rs:+0:31: +0:44
2121
// mir::Constant
2222
- // + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
2323
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }

src/test/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:+0:32: +0:45
2020
- StorageLive(_5); // scope 1 at $DIR/const-promotion-extern-static.rs:+0:42: +0:43
2121
- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:+0:42: +0:43
22-
+ _6 = const FOO::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:+0:31: +0:55
22+
+ _6 = const _; // scope 0 at $DIR/const-promotion-extern-static.rs:+0:31: +0:55
2323
// mir::Constant
2424
- // + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
2525
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }

src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
2626
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
2727
StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
28-
_9 = const main::promoted[0]; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
28+
_9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
2929
// mir::Constant
3030
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
3131
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }

src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
2626
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
2727
StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
28-
_9 = const main::promoted[0]; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
28+
_9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
2929
// mir::Constant
3030
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
3131
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }

src/test/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
1919
_3 = const FOO; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
2020
// mir::Constant
21-
// + span: $DIR/const_prop_fails_gracefully.rs:8:13: 8:16
22-
// + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) }
21+
// + span: $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
22+
// + literal: Const { ty: &i32, val: Unevaluated(FOO, [], ()) }
2323
_2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
2424
_1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39
2525
StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:38: +2:39

src/test/mir-opt/const_prop/ref_deref.main.ConstProp.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
bb0: {
1212
StorageLive(_1); // scope 0 at $DIR/ref_deref.rs:+1:5: +1:10
1313
StorageLive(_2); // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
14-
_4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
14+
_4 = const _; // scope 0 at $DIR/ref_deref.rs:+1:6: +1:10
1515
// mir::Constant
1616
// + span: $DIR/ref_deref.rs:5:6: 5:10
1717
// + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) }

0 commit comments

Comments
 (0)