rust/compiler/rustc_ast_lowering/src
bors 98f8cce6db 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`
2021-02-25 18:14:50 +00:00
..
expr.rs Auto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obk 2021-02-25 18:14:50 +00:00
item.rs ast: Keep expansion status for out-of-line module items 2021-02-18 13:07:49 +03:00
lib.rs Add a cache for rustc_legacy_const_generics 2021-02-25 00:37:56 +00:00
pat.rs Implement destructuring assignment for tuples 2020-11-07 13:17:19 +00:00
path.rs lowering of generic args in AssocTyConstraint 2021-02-04 16:20:58 +01:00