Skip to content

Commit 11034e4

Browse files
committed
Bless tests
1 parent e8de2e4 commit 11034e4

19 files changed

+126
-101
lines changed

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

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33

44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/invalid_constant.rs:+0:11: +0:11
6-
let _1: char; // in scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
7-
let mut _2: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63
8-
let mut _4: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59
9-
let mut _5: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55
10-
let mut _7: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73
11-
let mut _8: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65
6+
let mut _1: !; // in scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2
7+
let _2: char; // in scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
8+
let mut _3: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63
9+
let mut _5: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59
10+
let mut _6: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55
11+
let mut _8: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73
12+
let mut _9: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65
1213
scope 1 {
13-
debug _invalid_char => _1; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22
14-
let _3: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
14+
debug _invalid_char => _2; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22
15+
let _4: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
1516
scope 3 {
16-
debug _invalid_tag => _3; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21
17-
let _6: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
17+
debug _invalid_tag => _4; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21
18+
let _7: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
1819
scope 5 {
19-
debug _enum_without_variants => _6; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31
20-
let _9: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
20+
debug _enum_without_variants => _7; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31
21+
let _10: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
2122
scope 7 {
22-
debug _non_utf8_str => _9; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22
23+
debug _non_utf8_str => _10; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22
2324
}
2425
}
2526
scope 6 {
@@ -32,46 +33,7 @@
3233
}
3334

3435
bb0: {
35-
StorageLive(_1); // scope 0 at $DIR/invalid_constant.rs:+6:9: +6:22
36-
StorageLive(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
37-
Deinit(_2); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
38-
(_2.0: u32) = const 1114113_u32; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:63
39-
- _1 = (_2.1: char); // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67
40-
+ _1 = const {transmute(0x00110001): char}; // scope 2 at $DIR/invalid_constant.rs:+6:34: +6:67
41-
StorageDead(_2); // scope 0 at $DIR/invalid_constant.rs:+6:69: +6:70
42-
StorageLive(_3); // scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
43-
StorageLive(_4); // scope 1 at $DIR/invalid_constant.rs:+13:25: +13:59
44-
StorageLive(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
45-
Deinit(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
46-
(_5.0: u32) = const 4_u32; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
47-
- _4 = (_5.1: E); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
48-
- _3 = [move _4]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
49-
+ _4 = const Scalar(0x00000004): E; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
50-
+ // mir::Constant
51-
+ // + span: $DIR/invalid_constant.rs:28:34: 28:57
52-
+ // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) }
53-
+ _3 = [const Scalar(0x00000004): E]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
54-
+ // mir::Constant
55-
+ // + span: $DIR/invalid_constant.rs:28:24: 28:60
56-
+ // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) }
57-
StorageDead(_4); // scope 1 at $DIR/invalid_constant.rs:+13:59: +13:60
58-
StorageDead(_5); // scope 1 at $DIR/invalid_constant.rs:+13:60: +13:61
59-
StorageLive(_6); // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
60-
StorageLive(_7); // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73
61-
StorageLive(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
62-
Deinit(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
63-
(_8.0: u32) = const 0_u32; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
64-
nop; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71
65-
nop; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74
66-
StorageDead(_7); // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74
67-
StorageDead(_8); // scope 3 at $DIR/invalid_constant.rs:+20:74: +20:75
68-
StorageLive(_9); // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
69-
nop; // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2
70-
StorageDead(_9); // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2
71-
StorageDead(_6); // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2
72-
StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+27:1: +27:2
73-
StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+27:1: +27:2
74-
return; // scope 0 at $DIR/invalid_constant.rs:+27:2: +27:2
36+
unreachable; // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2
7537
}
7638
}
7739

src/test/mir-opt/uninhabited_enum.process_void.SimplifyLocals.after.mir

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ fn process_void(_1: *const Void) -> () {
1111
}
1212

1313
bb0: {
14-
StorageLive(_2); // scope 0 at $DIR/uninhabited-enum.rs:+1:8: +1:14
15-
StorageDead(_2); // scope 0 at $DIR/uninhabited-enum.rs:+4:1: +4:2
16-
return; // scope 0 at $DIR/uninhabited-enum.rs:+4:2: +4:2
14+
unreachable; // scope 0 at $DIR/uninhabited-enum.rs:+0:41: +4:2
1715
}
1816
}

src/test/ui/break-diverging-value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ fn get_void() -> Void {
2222
panic!()
2323
}
2424

25-
fn loop_break_void() -> i32 { //~ ERROR mismatched types
26-
let loop_value = loop { break get_void() };
25+
fn loop_break_void() -> i32 {
26+
let loop_value = loop { break get_void() }; // ok
2727
}
2828

2929
fn get_never() -> ! {

src/test/ui/break-diverging-value.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ LL | fn loop_break_break() -> i32 {
66
| |
77
| implicitly returns `()` as its body has no tail or `return` expression
88

9-
error[E0308]: mismatched types
10-
--> $DIR/break-diverging-value.rs:25:25
11-
|
12-
LL | fn loop_break_void() -> i32 {
13-
| --------------- ^^^ expected `i32`, found `()`
14-
| |
15-
| implicitly returns `()` as its body has no tail or `return` expression
16-
17-
error: aborting due to 2 previous errors
9+
error: aborting due to previous error
1810

1911
For more information about this error, try `rustc --explain E0308`.

src/test/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ fn bar() -> Option<Empty> {
1919

2020
fn main() {
2121
if let Some(x) = bar() {
22-
Test1::B(x);
22+
Test1::B(x); //~ unreachable call
2323
}
2424

2525
if let Some(x) = bar() {
26-
Test2::B(x);
26+
Test2::B(x); //~ unreachable call
2727
}
2828
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
warning: unreachable call
2+
--> $DIR/write-to-uninhabited-enum-variant.rs:22:9
3+
|
4+
LL | Test1::B(x);
5+
| ^^^^^^^^ - this expression has type `Empty`, which is uninhabited
6+
| |
7+
| unreachable call
8+
|
9+
= note: `#[warn(unreachable_code)]` on by default
10+
11+
warning: unreachable call
12+
--> $DIR/write-to-uninhabited-enum-variant.rs:26:9
13+
|
14+
LL | Test2::B(x);
15+
| ^^^^^^^^ - this expression has type `Empty`, which is uninhabited
16+
| |
17+
| unreachable call
18+
19+
warning: 2 warnings emitted
20+

src/test/ui/generator/issue-93161.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ async fn includes_never(crash: bool, x: u32) -> u32 {
3939
}
4040
#[allow(unused)]
4141
let bad = never();
42-
result *= async { x + x }.await;
43-
drop(bad);
42+
result *= async { x + x }.await; //~ unreachable statement
43+
drop(bad); //~ unreachable call
4444
result
4545
}
4646

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
warning: unreachable statement
2+
--> $DIR/issue-93161.rs:42:5
3+
|
4+
LL | let bad = never();
5+
| ------- this expression has type `Never`, which is uninhabited
6+
LL | result *= async { x + x }.await;
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
8+
|
9+
= note: `#[warn(unreachable_code)]` on by default
10+
11+
warning: unreachable call
12+
--> $DIR/issue-93161.rs:43:5
13+
|
14+
LL | drop(bad);
15+
| ^^^^ --- this expression has type `Never`, which is uninhabited
16+
| |
17+
| unreachable call
18+
19+
warning: 2 warnings emitted
20+

src/test/ui/issues/issue-46519.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#[test]
77
#[should_panic(expected = "creating inhabited type")]
88
fn test() {
9-
FontLanguageOverride::system_font(SystemFont::new());
9+
FontLanguageOverride::system_font(SystemFont::new()); //~ unreachable call
1010
}
1111

1212
pub enum FontLanguageOverride {
@@ -19,7 +19,7 @@ pub enum SystemFont {}
1919

2020
impl FontLanguageOverride {
2121
fn system_font(f: SystemFont) -> Self {
22-
FontLanguageOverride::System(f)
22+
FontLanguageOverride::System(f) //~ unreachable call
2323
}
2424
}
2525

src/test/ui/issues/issue-46519.stderr

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
warning: unreachable call
2+
--> $DIR/issue-46519.rs:9:5
3+
|
4+
LL | FontLanguageOverride::system_font(SystemFont::new());
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ----------------- this expression has type `SystemFont`, which is uninhabited
6+
| |
7+
| unreachable call
8+
|
9+
= note: `#[warn(unreachable_code)]` on by default
10+
11+
warning: unreachable call
12+
--> $DIR/issue-46519.rs:22:9
13+
|
14+
LL | FontLanguageOverride::System(f)
15+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `SystemFont`, which is uninhabited
16+
| |
17+
| unreachable call
18+
19+
warning: 2 warnings emitted
20+

0 commit comments

Comments
 (0)