-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #120895 - lukas-code:error-coercions-ice, r=compiler-…
…errors don't skip coercions for types with errors fixes #120884
- Loading branch information
Showing
7 changed files
with
30 additions
and
70 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
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,15 @@ | ||
// Regression test for an ICE: https://github.com/rust-lang/rust/issues/120884 | ||
// We still need to properly go through coercions between types with errors instead of | ||
// shortcutting and returning success, because we need the adjustments for building the MIR. | ||
|
||
pub fn has_error() -> TypeError {} | ||
//~^ ERROR cannot find type `TypeError` in this scope | ||
|
||
pub fn cast() -> *const u8 { | ||
// Casting a function item to a data pointer in valid in HIR, but invalid in MIR. | ||
// We need an adjustment (ReifyFnPointer) to insert a cast from the function item | ||
// to a function pointer as a separate MIR statement. | ||
has_error as *const u8 | ||
} | ||
|
||
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,9 @@ | ||
error[E0412]: cannot find type `TypeError` in this scope | ||
--> $DIR/type-errors.rs:5:23 | ||
| | ||
LL | pub fn has_error() -> TypeError {} | ||
| ^^^^^^^^^ not found in this scope | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0412`. |
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 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 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 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