forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for
a == b
where a: !, b: !
(this currently produces malformed mir: we call `eq` with first argument not being a reference)
- Loading branch information
1 parent
bbd359f
commit 1737162
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// MIR for `_f` after built | ||
|
||
fn _f(_1: !, _2: !) -> () { | ||
debug a => _1; | ||
debug b => _2; | ||
let mut _0: (); | ||
let mut _3: !; | ||
let _4: bool; | ||
let mut _5: (); | ||
let mut _6: !; | ||
let mut _7: &(); | ||
let _8: (); | ||
let mut _9: !; | ||
|
||
bb0: { | ||
StorageLive(_4); | ||
StorageLive(_5); | ||
StorageLive(_6); | ||
_6 = _1; | ||
unreachable; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_6); | ||
StorageLive(_7); | ||
StorageLive(_8); | ||
StorageLive(_9); | ||
_9 = _2; | ||
unreachable; | ||
} | ||
|
||
bb2: { | ||
_7 = &_8; | ||
StorageDead(_9); | ||
_4 = <() as PartialEq>::eq(move _5, move _7) -> [return: bb3, unwind: bb5]; | ||
} | ||
|
||
bb3: { | ||
StorageDead(_7); | ||
StorageDead(_5); | ||
StorageDead(_8); | ||
StorageDead(_4); | ||
unreachable; | ||
} | ||
|
||
bb4: { | ||
return; | ||
} | ||
|
||
bb5 (cleanup): { | ||
resume; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// skip-filecheck | ||
#![feature(never_type)] | ||
#![allow(unreachable_code)] | ||
|
||
// EMIT_MIR eq_never_type._f.built.after.mir | ||
fn _f(a: !, b: !) { | ||
// Both arguments must be references (i.e. == should auto-borrow/coerce-to-ref both arguments) | ||
// (this previously was buggy due to `NeverToAny` coercion incorrectly throwing out other | ||
// coercions) | ||
a == b; | ||
} | ||
|
||
fn main() {} |