-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly change type when adding adjustments on top of NeverToAny
#123571
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
662d276
Add regression test for issue 120600
WaffleLapkin 4d749ca
Add a test for `a == b` where `a: !, b: !`
WaffleLapkin 0bbe362
Correctly change type when adding adjustments on top of `NeverToAny`
WaffleLapkin e5a6d8d
Remove old ICE tests that no longer ICE (yay!)
WaffleLapkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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() {} |
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 @@ | ||
//@ check-pass | ||
// | ||
// issue: rust-lang/rust#120600 | ||
|
||
#![allow(internal_features)] | ||
#![feature(never_type, rustc_attrs)] | ||
#![rustc_never_type_options(fallback = "never")] | ||
|
||
fn ice(a: !) { | ||
a == a; | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to use
// CHECK
, but could make it work, because they seem to be run on the optimized MIR, at which point everything is dead-code-eliminated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a
-Zmir-opt-level=0
, which will avoid opts.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call is deleted even with
-Zmir-opt-level=0
:(