summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/generics.rs
AgeCommit message (Collapse)AuthorLines
2021-11-24Account for incorrect `impl Foo<const N: ty> {}` syntaxEsteban Küber-1/+4
Fix #84946
2021-02-13Require passing an `AttrWrapper` to `collect_tokens_trailing_token`Aaron Hill-59/+80
This is a pure refactoring split out from #80689. It represents the most invasive part of that PR, requiring changes in every caller of `parse_outer_attributes` In order to eagerly expand `#[cfg]` attributes while preserving the original `TokenStream`, we need to know the range of tokens that corresponds to every attribute target. This is accomplished by making `parse_outer_attributes` return an opaque `AttrWrapper` struct. An `AttrWrapper` must be converted to a plain `AttrVec` by passing it to `collect_tokens_trailing_token`. This makes it difficult to accidentally construct an AST node with attributes without calling `collect_tokens_trailing_token`, since AST nodes store an `AttrVec`, not an `AttrWrapper`. As a result, we now call `collect_tokens_trailing_token` for attribute targets which only support inert attributes, such as generic arguments and struct fields. Currently, the constructed `LazyTokenStream` is simply discarded. Future PRs will record the token range corresponding to the attribute target, allowing those tokens to be removed from an enclosing `collect_tokens_trailing_token` call if necessary.
2021-01-01make `const_generics_defaults` use the unstable syntax mechanismRémy Rakic-3/+14
This is important to not accidentally stabilize the parsing of the syntax while it still is experimental and not formally accepted
2021-01-01first pass at default values for const genericsJulian Knodt-1/+4
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate
2020-12-26stabilize min_const_genericsBastian Kauschke-3/+1
2020-12-03Gracefully handle confusing -> with : in function return typemibac138-1/+1
2020-08-30mv compiler to compiler/mark-0/+292