-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #123526 - estebank:issue-123442, r=compiler-errors
Do not ICE when calling incorrectly defined `transmute` intrinsic Fix #123442
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 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,8 @@ | ||
fn main() { | ||
transmute(); // does not ICE | ||
} | ||
|
||
extern "rust-intrinsic" fn transmute() {} | ||
//~^ ERROR intrinsic has wrong number of type parameters: found 0, expected 2 | ||
//~| ERROR intrinsics are subject to change | ||
//~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block |
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,25 @@ | ||
error[E0658]: intrinsics are subject to change | ||
--> $DIR/incorrect-transmute.rs:5:8 | ||
| | ||
LL | extern "rust-intrinsic" fn transmute() {} | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add `#![feature(intrinsics)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error[E0094]: intrinsic has wrong number of type parameters: found 0, expected 2 | ||
--> $DIR/incorrect-transmute.rs:5:37 | ||
| | ||
LL | extern "rust-intrinsic" fn transmute() {} | ||
| ^ expected 2 type parameters | ||
|
||
error: intrinsic must be in `extern "rust-intrinsic" { ... }` block | ||
--> $DIR/incorrect-transmute.rs:5:40 | ||
| | ||
LL | extern "rust-intrinsic" fn transmute() {} | ||
| ^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0094, E0658. | ||
For more information about an error, try `rustc --explain E0094`. |