Skip to content

Commit ae6f434

Browse files
committed
Add a test for a == b where a: !, b: !
(this currently produces malformed mir: we call `eq` with first argument not being a reference)
1 parent 1da9364 commit ae6f434

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// MIR for `_f` after built
2+
3+
fn _f(_1: !, _2: !) -> () {
4+
debug a => _1;
5+
debug b => _2;
6+
let mut _0: ();
7+
let mut _3: !;
8+
let _4: bool;
9+
let mut _5: ();
10+
let mut _6: !;
11+
let mut _7: &();
12+
let _8: ();
13+
let mut _9: !;
14+
15+
bb0: {
16+
StorageLive(_4);
17+
StorageLive(_5);
18+
StorageLive(_6);
19+
_6 = _1;
20+
unreachable;
21+
}
22+
23+
bb1: {
24+
StorageDead(_6);
25+
StorageLive(_7);
26+
StorageLive(_8);
27+
StorageLive(_9);
28+
_9 = _2;
29+
unreachable;
30+
}
31+
32+
bb2: {
33+
_7 = &_8;
34+
StorageDead(_9);
35+
_4 = <() as PartialEq>::eq(move _5, move _7) -> [return: bb3, unwind: bb5];
36+
}
37+
38+
bb3: {
39+
StorageDead(_7);
40+
StorageDead(_5);
41+
StorageDead(_8);
42+
StorageDead(_4);
43+
unreachable;
44+
}
45+
46+
bb4: {
47+
return;
48+
}
49+
50+
bb5 (cleanup): {
51+
resume;
52+
}
53+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// skip-filecheck
2+
#![feature(never_type)]
3+
#![allow(unreachable_code)]
4+
5+
// EMIT_MIR eq_never_type._f.built.after.mir
6+
fn _f(a: !, b: !) {
7+
// Both arguments must be references (i.e. == should auto-borrow/coerce-to-ref both arguments)
8+
// (this previously was buggy due to `NeverToAny` coercion incorrectly throwing out other
9+
// coercions)
10+
a == b;
11+
}
12+
13+
fn main() {}

0 commit comments

Comments
 (0)