For historic reasons, Miri calls uninitialized memory and the value that you get when reading it "undef(ined)". This is potentially derived from LLVM undef. However, that is actually a misnomer -- Miri's "undef" is much more like LLVM's poison. Also, the docs and user-visible message usually speak about "uninitialized memory/values", and I think that terminology makes much more sense.
We should thus rename all "undef" in Miri to "uninit". In particular, but not limited to:
InvalidUndefBytesScalarMaybeUndefUndefMaskCc @oli-obk
@rustbot claim
This will be quite a large change, especially if tests needs to be updated too. And what about the stuff in llvm-project/?
I don't think any tests need to be updated, as there should be no user-visible change. And we're not renaming LLVM, just our own Miri types and fields!
If you are grepping for this, only grep in src/librustc_middle/mir/interpret and src/librustc_mir/interpret.
This test will fail
Check compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
running 90 tests
................F............................F................F.F.................FF......
failures:
---- [mir-opt] mir-opt/const_prop/control-flow-simplification.rs stdout ----
51 // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Scalar(<ZST>)) }
52 // ty::Const
53 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 })
+ // + val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 })
55 // mir::Constant
56 // + span: $SRC_DIR/libstd/macros.rs:LL:COL
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 }) }
58 }
59 }
60
thread '[mir-opt] mir-opt/const_prop/control-flow-simplification.rs' panicked at 'Actual MIR output differs from expected MIR output /home/hbinadesk/git/rust/src/test/mir-opt/const_prop/control-flow-simplification/rustc.hello.ConstProp.diff', src/tools/compiletest/src/runtest.rs:3165:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- [mir-opt] mir-opt/inline/inline-into-box-place.rs stdout ----
24 - // + ty: fn() -> std::vec::Vec<u32> {std::vec::Vec::<u32>::new}
25 - // + val: Value(Scalar(<ZST>))
26 + // + ty: alloc::raw_vec::RawVec<u32>
- + // + val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } })
+ + // + val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } })
28 // mir::Constant
29 - // + span: $DIR/inline-into-box-place.rs:8:33: 8:41
30 - // + user_ty: UserType(1)
41 - _0 = const (); // bb2[2]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2
42 + // + span: $SRC_DIR/liballoc/vec.rs:LL:COL
43 + // + user_ty: UserType(0)
- + // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
+ + // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
45 + ((*_4).1: usize) = const 0usize; // bb0[5]: scope 2 at $SRC_DIR/liballoc/vec.rs:LL:COL
46 // ty::Const
47 + // + ty: usize
thread '[mir-opt] mir-opt/inline/inline-into-box-place.rs' panicked at 'Actual MIR output differs from expected MIR output /home/hbinadesk/git/rust/src/test/mir-opt/inline/inline-into-box-place/64bit/rustc.main.Inline.diff', src/tools/compiletest/src/runtest.rs:3165:25
---- [mir-opt] mir-opt/no-drop-for-inactive-variant.rs stdout ----
32 // + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Scalar(<ZST>)) }
33 // ty::Const
34 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 })
+ // + val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 })
36 // mir::Constant
37 // + span: $SRC_DIR/libstd/macros.rs:LL:COL
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 }) }
39 }
40
41 bb3: {
thread '[mir-opt] mir-opt/no-drop-for-inactive-variant.rs' panicked at 'Actual MIR output differs from expected MIR output /home/hbinadesk/git/rust/src/test/mir-opt/no-drop-for-inactive-variant/rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir', src/tools/compiletest/src/runtest.rs:3165:25
---- [mir-opt] mir-opt/no-spurious-drop-after-call.rs stdout ----
15 _4 = const ""; // bb0[4]: scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
16 // ty::Const
17 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 0 })
+ // + val: Value(Slice { data: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 0 })
19 // mir::Constant
20 // + span: $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 0 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [], len: Size { raw: 0 } }, size: Size { raw: 0 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 0 }) }
22 _3 = &(*_4); // bb0[5]: scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:22
23 _2 = const <str as std::string::ToString>::to_string(move _3) -> bb2; // bb0[6]: scope 0 at $DIR/no-spurious-drop-after-call.rs:9:20: 9:34
24 // ty::Const
thread '[mir-opt] mir-opt/no-spurious-drop-after-call.rs' panicked at 'Actual MIR output differs from expected MIR output /home/hbinadesk/git/rust/src/test/mir-opt/no-spurious-drop-after-call/rustc.main.ElaborateDrops.before.mir', src/tools/compiletest/src/runtest.rs:3165:25
---- [mir-opt] mir-opt/uninhabited_enum_branching.rs stdout ----
27 _5 = const "C"; // bb1[1]: scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24
28 // ty::Const
29 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
+ // + val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
31 // mir::Constant
32 // + span: $DIR/uninhabited_enum_branching.rs:23:21: 23:24
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [67], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
34 _1 = &(*_5); // bb1[2]: scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24
35 StorageDead(_5); // bb1[3]: scope 0 at $DIR/uninhabited_enum_branching.rs:23:23: 23:24
36 goto -> bb4; // bb1[4]: scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6
40 _1 = const "A(Empty)"; // bb2[0]: scope 0 at $DIR/uninhabited_enum_branching.rs:21:24: 21:34
41 // ty::Const
42 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
+ // + val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
44 // mir::Constant
45 // + span: $DIR/uninhabited_enum_branching.rs:21:24: 21:34
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [65, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
47 goto -> bb4; // bb2[1]: scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6
48 }
49
52 _4 = const "B(Empty)"; // bb3[1]: scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34
53 // ty::Const
54 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
+ // + val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 })
56 // mir::Constant
57 // + span: $DIR/uninhabited_enum_branching.rs:22:24: 22:34
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [66, 40, 69, 109, 112, 116, 121, 41], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 8 }) }
59 _1 = &(*_4); // bb3[2]: scope 0 at $DIR/uninhabited_enum_branching.rs:22:24: 22:34
60 StorageDead(_4); // bb3[3]: scope 0 at $DIR/uninhabited_enum_branching.rs:22:33: 22:34
61 goto -> bb4; // bb3[4]: scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6
76 _9 = const "E"; // bb5[1]: scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24
77 // ty::Const
78 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [69], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
+ // + val: Value(Slice { data: Allocation { bytes: [69], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
80 // mir::Constant
81 // + span: $DIR/uninhabited_enum_branching.rs:28:21: 28:24
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [69], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [69], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
83 _6 = &(*_9); // bb5[2]: scope 0 at $DIR/uninhabited_enum_branching.rs:28:21: 28:24
84 StorageDead(_9); // bb5[3]: scope 0 at $DIR/uninhabited_enum_branching.rs:28:23: 28:24
85 goto -> bb7; // bb5[4]: scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6
89 _6 = const "D"; // bb6[0]: scope 0 at $DIR/uninhabited_enum_branching.rs:27:21: 27:24
90 // ty::Const
91 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
+ // + val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 })
93 // mir::Constant
94 // + span: $DIR/uninhabited_enum_branching.rs:27:21: 27:24
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [68], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [1], len: Size { raw: 1 } }, size: Size { raw: 1 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 1 }) }
96 goto -> bb7; // bb6[1]: scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6
97 }
98
thread '[mir-opt] mir-opt/uninhabited_enum_branching.rs' panicked at 'Actual MIR output differs from expected MIR output /home/hbinadesk/git/rust/src/test/mir-opt/uninhabited_enum_branching/rustc.main.UninhabitedEnumBranching.diff', src/tools/compiletest/src/runtest.rs:3165:25
---- [mir-opt] mir-opt/storage_live_dead_in_statics.rs stdout ----
653 _2 = Foo { tup: const "hi", data: move _3 }; // bb0[94]: scope 0 at $DIR/storage_live_dead_in_statics.rs:5:29: 23:2
654 // ty::Const
655 // + ty: &str
- // + val: Value(Slice { data: Allocation { bytes: [104, 105], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 })
+ // + val: Value(Slice { data: Allocation { bytes: [104, 105], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 })
657 // mir::Constant
658 // + span: $DIR/storage_live_dead_in_statics.rs:6:10: 6:14
- // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [104, 105], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) }
+ // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [104, 105], relocations: Relocations(SortedMap { data: [] }), undef_mask: UninitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) }
660 _1 = &_2; // bb0[95]: scope 0 at $DIR/storage_live_dead_in_statics.rs:5:28: 23:2
661 _0 = &(*_1); // bb0[96]: scope 0 at $DIR/storage_live_dead_in_statics.rs:5:28: 23:2
662 StorageDead(_5); // bb0[97]: scope 0 at $DIR/storage_live_dead_in_statics.rs:23:1: 23:2
thread '[mir-opt] mir-opt/storage_live_dead_in_statics.rs' panicked at 'Actual MIR output differs from expected MIR output /home/hbinadesk/git/rust/src/test/mir-opt/storage_live_dead_in_statics/rustc.XXX.mir_map.0.mir', src/tools/compiletest/src/runtest.rs:3165:25
failures:
[mir-opt] mir-opt/const_prop/control-flow-simplification.rs
[mir-opt] mir-opt/inline/inline-into-box-place.rs
[mir-opt] mir-opt/no-drop-for-inactive-variant.rs
[mir-opt] mir-opt/no-spurious-drop-after-call.rs
[mir-opt] mir-opt/storage_live_dead_in_statics.rs
[mir-opt] mir-opt/uninhabited_enum_branching.rs
test result: FAILED. 84 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
command did not execute successfully: "/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/home/hbinadesk/git/rust/src/test/mir-opt" "--build-base" "/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/test/mir-opt" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "mir-opt" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options -Lnative=/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options -Lnative=/home/hbinadesk/git/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python" "--lldb-python" "/usr/bin/python" "--gdb" "/usr/bin/gdb" "--lldb-version" "lldb version 6.0.0\n" "--lldb-python-dir" "/usr/lib/x86_64-linux-gnu/python2.7/site-packages" "--quiet" "--llvm-version" "9.0.1-rust-dev" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" ""
expected success, got: exit code: 101
failed to run: /home/hbinadesk/git/rust/build/bootstrap/debug/bootstrap test
Build completed unsuccessfully in 0:50:34
@hbina thanks a lot for working on this!
I responded in your PR.
Another type we will want to rename in a second batch is AllocationDefinedness. Also there are probably plenty of comments still left to be updated.
@hbina just a small note: before working on an issue, please check if someone else has claimed it (if it is assigned to rustbot) :)
All right, the first round of renames landed. :) Thanks @hbina!
For the second round, here are some more names in librustc_middle/mir/interpret that should be changed:
ScalarMaybeUninit::not_undef -> ... hm @oli-obk how do we call this, not_uninit is a bit weird. what about init? check_init?Allocation::undef -> uninitcheck_defined_and_ptr -> check_init_and_ptris_defined+check_defined -> is_init/check_initmark_definedness -> mark_initAllocationDefinedness -> ... this is really the same information as InitMask but more compact for copying right? So maybe InitMaskCompact or InitMaskCompressed or so?all_bytes_undef -> all_bytes_uninitmark_compressed_undef_range -> mark_compressed_init_range (or "compact" if that's what we are going for above)* `not_uninit` is a bit weird. what about `init`? `check_init`?
yea, check_init sounds good. not_undef always was a bit odd
* `is_defined`+`check_defined` -> `is_init`/`check_init`
this makes me wonder whether it should be is_initialized and check_initialized
* `all_bytes_undef` -> `all_bytes_uninit`
any_bytes_init?
this makes me wonder whether it should be is_initialized and check_initialized
initialized is very long and unint has a lot of precedence, so I think I'd prefer the short version.
any_bytes_init?
I guess it depends on the caller which naming is more apt. But I feel like an "all" statement is intuitively clearer than an "any" statement.
Hello,
I saw that this issue was still open but the last post was 2 months ago, is there a chance I could try and help out?
@pnadon sure.. 2 months is a short timeframe in rust's perspective :D
@Dylan-DPC Ok sounds good,
From what I understand from the comments above, the two directories I should look in are
src/librustc_middle/mir/interpret
and
src/librustc_mir/interpret
And the goal would be to rename parts of names with "undef" in them to "uninit", along with some changes with "def" to "init". Is this correct?
@pnadon thanks for chiming in! Yes, that sounds right. More specifically, as far as I know, the list at https://github.com/rust-lang/rust/issues/71193#issuecomment-626128359 is still up-to-date. Post in this thread or open a topic on Rust's Zulip if you need any help; my availability is spotty until mid next week but there'll always be someone around. :)
this makes me wonder whether it should be is_initialized and check_initialized
initializedis very long anduninthas a lot of precedence, so I think I'd prefer the short version.any_bytes_init?
I guess it depends on the caller which naming is more apt. But I feel like an "all" statement is intuitively clearer than an "any" statement.
no_bytes_init? I assumed it would be synonymous with "all_bytes_uninit"
All right, the first round of renames landed. :) Thanks @hbina!
For the second round, here are some more names in
librustc_middle/mir/interpretthat should be changed:* `ScalarMaybeUninit::not_undef` -> ... hm @oli-obk how do we call this, `not_uninit` is a bit weird. what about `init`? `check_init`? * `Allocation::undef` -> `uninit` * `check_defined_and_ptr` -> `check_init_and_ptr` * `is_defined`+`check_defined` -> `is_init`/`check_init` * `mark_definedness` -> `mark_init`
I have made commits for the above changes, however I would like to wait until everyone agrees on the new names for below:
* `AllocationDefinedness` -> ... this is really the same information as `InitMask` but more compact for copying right? So maybe `InitMaskCompact` or `InitMaskCompressed` or so?
I think InitMaskCompressed would be more of a mouthful but also more accurate based on the definition here, so I agree with the latter.
* `all_bytes_undef` -> `all_bytes_uninit`
As per my previous comment, no_bytes_init?
* `mark_compressed_undef_range` -> `mark_compressed_init_range` (or "compact" if that's what we are going for above)
I agree.
I like no_bytes_init.
I have also found:
inspect_with_undef_and_ptr_outside_interpreter (line 160)get_bytes_with_undef_and_ptr (247)allow_ptr_and_undef parameter for check_bytes (312)compress_undef_range (597)undef_end variable (781)src/librustc_middle/mir/interpret, all inside of allocation.rs. Should these be changed as well?There are also many comments which should be changed, many of them refer to "definedness", which I am not sure what to replace with.
Yes, those all should become "uninit" I think.
For consistency maybe allow_ptr_and_undef should become allow_uninit_and_ptr.
Yes, those all should become "uninit" I think.
For consistency maybe
allow_ptr_and_undefshould becomeallow_uninit_and_ptr.
Sounds good. Should I go ahead and implement those changes?
I will also look around for any comments etc. that we may have missed and make sure that we've got them all.
@pnadon yes please do. :)
I've done the initial renames, however outside of the two directories (src/librustc_middle/mir/interpret and src/librustc_mir/interpret) we had initially planned to work within, there are changes made in the following files:
src/librustc_codegen_llvm/consts.rs, lines {44, 52, 77, 455, and 483}, which all contain the inspect_with_undef_and_ptr_outside_interpreter function and thus must be renamed.src/tools/clippy/clippy_lints/src/consts.rs, lines {520, 533, 547}, which also contain the inspect_with_undef_and_ptr_outside_interpreter function and thus must be renamed.The former seems to be a fairly straightforward change, I just want to confirm that it's ok. As for the latter, since it is a submodule, I believe I will have to create a pull request for clippy with those changes.
Once these issues are resolved, I will look into making the approapriate changes within the Miri repo.
clippy is not a submodule anymore. You can do these renames either here or in clippy as you prefer
clippy is not a submodule anymore. You can do these renames either here or in clippy as you prefer
Sounds good!
I have also found:
* `inspect_with_undef_and_ptr_outside_interpreter` (line 160) * `get_bytes_with_undef_and_ptr` (247) * `allow_ptr_and_undef` parameter for `check_bytes` (312) * `compress_undef_range` (597) * and the `undef_end` variable (781) for `src/librustc_middle/mir/interpret`, all inside of allocation.rs. Should these be changed as well?There are also many comments which should be changed, many of them refer to "definedness", which I am not sure what to replace with.
Upon further inspection it does not seem as though there are any references to the above functions within the Miri repository.
Upon further inspection it does not seem as though there are any references to the above functions within the Miri repository.
That's great, it makes the rename easier. :)
Does your list contain all uses of "undef" in src/librustc_middle/mir/interpret and src/librustc_mir/interpret?
There are also many comments which should be changed, many of them refer to "definedness", which I am not sure what to replace with.
"initializedness" is awkward, so they should probably be reworded. But from what I can see there is just one occurrence of "definedness" left in the Miri folders:
src/librustc_middle/mir/interpret/allocation.rs
636- size: Size,
637- repeat: u64,
638- ) {
639: // An optimization where we can just overwrite an entire range of definedness bits if
640- // they are going to be uniformly `1` or `0`.
641- if defined.ranges.len() <= 1 {
642- self.init_mask.set_range_inbounds(
I'd make this "an entire range of initialization bits" or so.
Upon further inspection it does not seem as though there are any references to the above functions within the Miri repository.
That's great, it makes the rename easier. :)
Does your list contain all uses of "undef" insrc/librustc_middle/mir/interpretandsrc/librustc_mir/interpret?There are also many comments which should be changed, many of them refer to "definedness", which I am not sure what to replace with.
"initializedness" is awkward, so they should probably be reworded. But from what I can see there is just one occurrence of "definedness" left in the Miri folders:
src/librustc_middle/mir/interpret/allocation.rs 636- size: Size, 637- repeat: u64, 638- ) { 639: // An optimization where we can just overwrite an entire range of definedness bits if 640- // they are going to be uniformly `1` or `0`. 641- if defined.ranges.len() <= 1 { 642- self.init_mask.set_range_inbounds(I'd make this "an entire range of initialization bits" or so.
Thank you for catching that, I'll look into it!
Miri builds successfully, I have double-checked my search through both directories and all references to "undef" refer to "undefined behavior" which (unless I'm wrong) is unrelated.
I have also changed the last remaining "definedness" to the recommended change.
If this all looks good I will open a PR with my changes.
It sounds great, please open a PR. :)
@pnadon fixed the remaining ones in https://github.com/rust-lang/rust/pull/75226, I think we are done. Thanks a lot to everyone involved. :)