mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Make unevaluated DefId rendering deterministic
This commit is contained in:
parent
5582b19559
commit
1d56b8a2bc
@ -465,7 +465,21 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
|
||||
if use_verbose(ty) {
|
||||
self.push("ty::Const");
|
||||
self.push(&format!("+ ty: {:?}", ty));
|
||||
self.push(&format!("+ val: {:?}", val));
|
||||
let val = match val {
|
||||
ty::ConstKind::Param(p) => format!("Param({})", p),
|
||||
ty::ConstKind::Infer(infer) => format!("Infer({:?})", infer),
|
||||
ty::ConstKind::Bound(idx, var) => format!("Bound({:?}, {:?})", idx, var),
|
||||
ty::ConstKind::Placeholder(ph) => format!("PlaceHolder({:?})", ph),
|
||||
ty::ConstKind::Unevaluated(uv) => format!(
|
||||
"Unevaluated({}, {:?}, {:?})",
|
||||
self.tcx.def_path_str(uv.def.did),
|
||||
uv.substs,
|
||||
uv.promoted
|
||||
),
|
||||
ty::ConstKind::Value(val) => format!("Value({:?})", val),
|
||||
ty::ConstKind::Error(_) => format!("Error"),
|
||||
};
|
||||
self.push(&format!("+ val: {}", val));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
- // + ty: &i32
|
||||
- // + val: Value(Scalar(alloc0))
|
||||
+ // + ty: &[&i32; 1]
|
||||
+ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ const_promotion_extern_static[317d]::BAR), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
+ // + val: Unevaluated(BAR, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) }
|
||||
|
@ -24,7 +24,7 @@
|
||||
- // + ty: *const i32
|
||||
- // + val: Value(Scalar(alloc2))
|
||||
+ // + ty: &[&i32; 1]
|
||||
+ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ const_promotion_extern_static[317d]::FOO), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
+ // + val: Unevaluated(FOO, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) }
|
||||
|
@ -28,7 +28,7 @@
|
||||
_9 = const main::promoted[0]; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
|
||||
// ty::Const
|
||||
// + ty: &[i32; 3]
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
|
||||
// + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -28,7 +28,7 @@
|
||||
_9 = const main::promoted[0]; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
|
||||
// ty::Const
|
||||
// + ty: &[i32; 3]
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:5:25: 5:35
|
||||
// + literal: Const { ty: &[i32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ bad_op_unsafe_oob_for_slices[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -19,7 +19,7 @@
|
||||
_3 = const FOO; // scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[317d]::main::FOO), const_param_did: None }, substs: [], promoted: None })
|
||||
// + val: Unevaluated(FOO, [], None)
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ const_prop_fails_gracefully[317d]::main::FOO), const_param_did: None }, substs: [], promoted: None }) }
|
||||
|
@ -14,7 +14,7 @@
|
||||
_4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/ref_deref.rs:5:6: 5:10
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -17,7 +17,7 @@
|
||||
+ _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
+ // ty::Const
|
||||
+ // + ty: &i32
|
||||
+ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
+ // + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/ref_deref.rs:5:6: 5:10
|
||||
+ // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -14,7 +14,7 @@
|
||||
_4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
// ty::Const
|
||||
// + ty: &(i32, i32)
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
// + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -17,7 +17,7 @@
|
||||
+ _4 = const main::promoted[0]; // scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
+ // ty::Const
|
||||
+ // + ty: &(i32, i32)
|
||||
+ // + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
+ // + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ ref_deref_project[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -21,7 +21,7 @@
|
||||
_9 = const main::promoted[0]; // scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
// ty::Const
|
||||
// + ty: &[u32; 3]
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:5:6: 5:19
|
||||
// + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -21,7 +21,7 @@
|
||||
_9 = const main::promoted[0]; // scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
// ty::Const
|
||||
// + ty: &[u32; 3]
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:5:6: 5:19
|
||||
// + literal: Const { ty: &[u32; 3], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ slice_len[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -35,7 +35,7 @@ fn bar() -> bool {
|
||||
_10 = const bar::promoted[1]; // scope 1 at $DIR/inline-retag.rs:12:7: 12:9
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[1]) })
|
||||
// + val: Unevaluated(bar, [], Some(promoted[1]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/inline-retag.rs:12:7: 12:9
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[1]) }) }
|
||||
@ -49,7 +49,7 @@ fn bar() -> bool {
|
||||
_9 = const bar::promoted[0]; // scope 1 at $DIR/inline-retag.rs:12:11: 12:14
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(bar, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/inline-retag.rs:12:11: 12:14
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:4 ~ inline_retag[317d]::bar), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -63,7 +63,7 @@
|
||||
_20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -63,7 +63,7 @@
|
||||
_20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -84,7 +84,7 @@
|
||||
_28 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -84,7 +84,7 @@
|
||||
_28 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -47,7 +47,7 @@
|
||||
_19 = const discriminant::<T>::promoted[2]; // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[2]) })
|
||||
// + val: Unevaluated(discriminant, [T], Some(promoted[2]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/lower_intrinsics.rs:70:42: 70:44
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[2]) }) }
|
||||
@ -71,7 +71,7 @@
|
||||
_18 = const discriminant::<T>::promoted[1]; // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
|
||||
// ty::Const
|
||||
// + ty: &()
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[1]) })
|
||||
// + val: Unevaluated(discriminant, [T], Some(promoted[1]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/lower_intrinsics.rs:71:42: 71:45
|
||||
// + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[1]) }) }
|
||||
@ -95,7 +95,7 @@
|
||||
_17 = const discriminant::<T>::promoted[0]; // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
|
||||
// ty::Const
|
||||
// + ty: &E
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(discriminant, [T], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/lower_intrinsics.rs:72:42: 72:47
|
||||
// + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[8787]::discriminant), const_param_did: None }, substs: [T], promoted: Some(promoted[0]) }) }
|
||||
|
@ -54,7 +54,7 @@ fn full_tested_match() -> () {
|
||||
_11 = const full_tested_match::promoted[0]; // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
// ty::Const
|
||||
// + ty: &std::option::Option<i32>
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ match_false_edges[317d]::full_tested_match), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(full_tested_match, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/match_false_edges.rs:16:14: 16:15
|
||||
// + literal: Const { ty: &std::option::Option<i32>, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:5 ~ match_false_edges[317d]::full_tested_match), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
@ -149,7 +149,7 @@ fn main() -> () {
|
||||
_27 = const main::promoted[0]; // scope 7 at $DIR/retag.rs:47:21: 47:23
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:13 ~ retag[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) })
|
||||
// + val: Unevaluated(main, [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/retag.rs:47:21: 47:23
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:13 ~ retag[317d]::main), const_param_did: None }, substs: [], promoted: Some(promoted[0]) }) }
|
||||
|
Loading…
Reference in New Issue
Block a user