diff options
| author | bors <bors@rust-lang.org> | 2021-02-25 18:14:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-02-25 18:14:50 +0000 |
| commit | 98f8cce6db6c6c6660eeffee2b3903104e547ecf (patch) | |
| tree | 0b7593868337147ef3b8b0fe6ca4125f8b28aa42 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 0ab7c1d56f92ebc3c456a0c7c502ba1593e76f8c (diff) | |
| parent | 00afbe70f2f5cb0b6455036f4b97537ff77f2052 (diff) | |
| download | rust-98f8cce6db6c6c6660eeffee2b3903104e547ecf.tar.gz rust-98f8cce6db6c6c6660eeffee2b3903104e547ecf.zip | |
Auto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obk
Add #[rustc_legacy_const_generics]
This is the first step towards removing `#[rustc_args_required_const]`: a new attribute is added which rewrites function calls of the form `func(a, b, c)` to `func::<{b}>(a, c)`. This allows previously stabilized functions in `stdarch` which use `rustc_args_required_const` to use const generics instead.
This new attribute is not intended to ever be stabilized, it is only intended for use in `stdarch` as a replacement for `#[rustc_args_required_const]`.
```rust
#[rustc_legacy_const_generics(1)]
pub fn foo<const Y: usize>(x: usize, z: usize) -> [usize; 3] {
[x, Y, z]
}
fn main() {
assert_eq!(foo(0 + 0, 1 + 1, 2 + 2), [0, 2, 4]);
assert_eq!(foo::<{1 + 1}>(0 + 0, 2 + 2), [0, 2, 4]);
}
```
r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
