diff options
| author | bors <bors@rust-lang.org> | 2022-05-18 15:07:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-18 15:07:47 +0000 |
| commit | 10d9ecda48f828e174d7a863fc43a155ad086efd (patch) | |
| tree | 5dd1a90b25a0b38adbb010617769206ac7ca374f /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | 936eba3b348e65b658b60218cc9237f02abdbeb4 (diff) | |
| parent | 441d98f1a426109dd4aecd4d214f7c4925c95aa3 (diff) | |
| download | rust-10d9ecda48f828e174d7a863fc43a155ad086efd.tar.gz rust-10d9ecda48f828e174d7a863fc43a155ad086efd.zip | |
Auto merge of #96800 - nbdd0121:const, r=nagisa
Permit `asm_const` and `asm_sym` to reference generic params
Related #96557
These constructs will be allowed:
```rust
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)>);
}
```
`@Amanieu,` I didn't switch inline asms to use `DefKind::InlineAsm`, as I see little value doing that; given that no type inference is needed, it will only make typecking slower and more complex but will have no real gains. I did switch them to follow the same code path as inline asm during symbol resolution, though.
The `error: unconstrained generic constant` you mentioned in #76001 is due to the fact that `to_const` will actually add a wfness obligation to the constant, which we don't need for `asm_const`, so I have that removed.
`@rustbot` label: +A-inline-assembly +F-asm
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
