rust/compiler/rustc_hir/src
bors 58bdb08947 Auto merge of #84299 - lcnr:const-generics-defaults-name-res, r=varkor
various const parameter defaults improvements

Actually resolve names in const parameter defaults, fixing `struct Foo<const N: usize = { usize::MAX }>`.

---
Split generic parameter ban rib for types and consts, allowing
```rust
#![feature(const_generics_defaults)]
struct Q;
struct Foo<T = Q, const Q: usize = 3>(T);
```

---
Remove the type/const ordering restriction if `const_generics_defaults` is active, even if `const_generics` is not. allowing us to stabilize and test const param defaults separately.

---
Check well formedness of const parameter defaults, eagerly emitting an error for `struct Foo<const N: usize = { 0 - 1 }>`

---
Do not forbid const parameters in param defaults, allowing `struct Foo<const N: usize, T = [u8; N]>(T)` and `struct Foo<const N: usize, const M: usize = N>`. Note that this should not change anything which is stabilized, as on stable, type parameters must be in front of const parameters, which means that type parameter defaults are only allowed if no const parameters exist.

We still forbid generic parameters inside of const param types.

r? `@varkor` `@petrochenkov`
2021-04-25 14:00:49 +00:00
..
arena.rs ast/hir: Rename field-related structures 2021-03-16 11:41:24 +03:00
def.rs Document Res and its friends 2021-04-07 18:03:38 -07:00
definitions.rs Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
hir_id.rs Address review comments 2021-03-27 22:16:34 -04:00
hir.rs Auto merge of #84299 - lcnr:const-generics-defaults-name-res, r=varkor 2021-04-25 14:00:49 +00:00
intravisit.rs Rollup merge of #83965 - rust-lang:debug-intravisit-fnkind, r=lqd 2021-04-08 01:01:46 +02:00
itemlikevisit.rs Store ForeignItem in a side table. 2020-11-26 21:29:27 +01:00
lang_items.rs Remove unnecessary #[allow(dead_code)] 2021-03-10 10:27:04 -08:00
lib.rs fix feature use in rustc libs 2021-04-18 22:05:45 +02:00
pat_util.rs Auto merge of #83599 - jyn514:unorderable, r=Aaron1011 2021-04-03 04:11:35 +00:00
stable_hash_impls.rs Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
target.rs Visit more targets when checking attrs 2021-02-09 21:54:46 +01:00
tests.rs Add unit test to ensure that both parts of a DefPathHash depend on the defining crate's ID. 2021-02-04 16:33:58 +01:00
weak_lang_items.rs Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00