rust/compiler/rustc_resolve/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
..
late Rollup merge of #82087 - estebank:abolish-ice, r=oli-obk 2021-02-25 14:33:56 +01:00
build_reduced_graph.rs Support pub on macro_rules 2021-02-19 13:52:57 -03:00
check_unused.rs Attach TokenStream to ast::Visibility 2020-09-10 17:33:06 -04:00
def_collector.rs resolve/expand: Improve attribute expansion on macro definitions and calls 2021-01-09 18:43:01 +03:00
diagnostics.rs Rollup merge of #81680 - camsteffen:primty, r=oli-obk 2021-02-06 17:01:45 +01:00
imports.rs resolve: Remove visibility hacks for enum variants and trait items 2021-02-10 22:46:44 +03:00
late.rs Address review comments 2021-02-25 00:09:33 +00:00
lib.rs Add a cache for rustc_legacy_const_generics 2021-02-25 00:37:56 +00:00
macros.rs Feature gate macro attributes in #[derive] output 2021-02-07 20:08:45 +03:00