-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permit asm_const and asm_sym to reference outer generic params
- Loading branch information
Showing
6 changed files
with
60 additions
and
47 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
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,30 @@ | ||
// needs-asm-support | ||
// build-pass | ||
|
||
#![feature(asm_const, asm_sym)] | ||
|
||
use std::arch::asm; | ||
|
||
fn foofoo<const N: usize>() {} | ||
|
||
unsafe fn foo<const N: usize>() { | ||
asm!("/* {0} */", const N); | ||
asm!("/* {0} */", const N + 1); | ||
asm!("/* {0} */", sym foofoo::<N>); | ||
} | ||
|
||
fn barbar<T>() {} | ||
|
||
unsafe fn bar<T>() { | ||
asm!("/* {0} */", const std::mem::size_of::<T>()); | ||
asm!("/* {0} */", const std::mem::size_of::<(T, T)>()); | ||
asm!("/* {0} */", sym barbar::<T>); | ||
asm!("/* {0} */", sym barbar::<(T, T)>); | ||
} | ||
|
||
fn main() { | ||
unsafe { | ||
foo::<0>(); | ||
bar::<usize>(); | ||
} | ||
} |
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