If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
46 lines
2.4 KiB
Diff
46 lines
2.4 KiB
Diff
- // MIR for `id` before SimplifyArmIdentity
|
|
+ // MIR for `id` after SimplifyArmIdentity
|
|
|
|
fn id(_1: Option<u8>) -> Option<u8> {
|
|
debug o => _1; // in scope 0 at $DIR/simplify-arm.rs:9:7: 9:8
|
|
let mut _0: std::option::Option<u8>; // return place in scope 0 at $DIR/simplify-arm.rs:9:25: 9:35
|
|
let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
|
let _3: u8; // in scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
|
|
let mut _4: u8; // in scope 0 at $DIR/simplify-arm.rs:11:25: 11:26
|
|
scope 1 {
|
|
- debug v => _3; // in scope 1 at $DIR/simplify-arm.rs:11:14: 11:15
|
|
+ debug v => ((_0 as Some).0: u8); // in scope 1 at $DIR/simplify-arm.rs:11:14: 11:15
|
|
}
|
|
|
|
bb0: {
|
|
_2 = discriminant(_1); // scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
|
switchInt(move _2) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
|
}
|
|
|
|
bb1: {
|
|
discriminant(_0) = 0; // scope 0 at $DIR/simplify-arm.rs:12:17: 12:21
|
|
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
|
|
}
|
|
|
|
bb2: {
|
|
unreachable; // scope 0 at $DIR/simplify-arm.rs:10:11: 10:12
|
|
}
|
|
|
|
bb3: {
|
|
- StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
|
|
- _3 = ((_1 as Some).0: u8); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
|
|
- StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
|
|
- _4 = _3; // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
|
|
- ((_0 as Some).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
|
|
- discriminant(_0) = 1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
|
|
- StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:11:26: 11:27
|
|
- StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:26: 11:27
|
|
+ _0 = move _1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
|
|
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
|
|
}
|
|
|
|
bb4: {
|
|
return; // scope 0 at $DIR/simplify-arm.rs:14:2: 14:2
|
|
}
|
|
}
|
|
|