-
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 #129472 - folkertdev:const-refs-to-static-asm-const, …
…r=lcnr fix ICE when `asm_const` and `const_refs_to_static` are combined fixes #129462 fixes #126896 fixes #124164 I think this is a case that was missed in the fix for #125558, which inserts a type error in the case of an invalid (that is, non-integer) type being passed to an asm `const` operand. I'm not 100% sure that `span_mirbug_and_err` is the right macro here, but it is used earlier with `builtin_deref` and seems to do the trick. r? ``@lcnr``
- Loading branch information
Showing
10 changed files
with
90 additions
and
10 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
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,21 @@ | ||
//@ needs-asm-support | ||
//@ ignore-nvptx64 | ||
//@ ignore-spirv | ||
|
||
#![feature(const_refs_to_static)] | ||
|
||
use std::arch::{asm, global_asm}; | ||
use std::ptr::addr_of; | ||
|
||
static FOO: u8 = 42; | ||
|
||
global_asm!("{}", const addr_of!(FOO)); | ||
//~^ ERROR invalid type for `const` operand | ||
|
||
#[no_mangle] | ||
fn inline() { | ||
unsafe { asm!("{}", const addr_of!(FOO)) }; | ||
//~^ ERROR invalid type for `const` operand | ||
} | ||
|
||
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,22 @@ | ||
error: invalid type for `const` operand | ||
--> $DIR/const-refs-to-static.rs:12:19 | ||
| | ||
LL | global_asm!("{}", const addr_of!(FOO)); | ||
| ^^^^^^------------- | ||
| | | ||
| is a `*const u8` | ||
| | ||
= help: `const` operands must be of an integer type | ||
|
||
error: invalid type for `const` operand | ||
--> $DIR/const-refs-to-static.rs:17:25 | ||
| | ||
LL | unsafe { asm!("{}", const addr_of!(FOO)) }; | ||
| ^^^^^^------------- | ||
| | | ||
| is a `*const u8` | ||
| | ||
= help: `const` operands must be of an integer type | ||
|
||
error: aborting due to 2 previous errors | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
//@ known-bug: #124164 | ||
// reported as #124164 | ||
static S_COUNT: = std::sync::atomic::AtomicUsize::new(0); | ||
//~^ ERROR: missing type for `static` item | ||
|
||
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,8 @@ | ||
error: missing type for `static` item | ||
--> $DIR/missing-type.rs:2:16 | ||
| | ||
LL | static S_COUNT: = std::sync::atomic::AtomicUsize::new(0); | ||
| ^ help: provide a type for the static variable: `AtomicUsize` | ||
|
||
error: aborting due to 1 previous error | ||
|
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,12 @@ | ||
error[E0792]: expected generic lifetime parameter, found `'_` | ||
--> $DIR/taint.rs:13:17 | ||
| | ||
LL | type Two<'a, 'b> = impl std::fmt::Debug; | ||
| -- this generic parameter must be used with a generic lifetime parameter | ||
... | ||
LL | let c1 = || set(x); | ||
| ^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0792`. |