about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/generics.rs
AgeCommit message (Collapse)AuthorLines
2023-12-01Tweak unclosed generics errorsEsteban Küber-1/+1
Remove unnecessary span label for parse errors that already have a suggestion. Provide structured suggestion to close generics in more cases.
2023-07-23fix couple of clippy findings:Matthias Krüger-1/+1
filter_map_identity iter_kv_map needless_question_mark redundant_at_rest_pattern filter_next derivable_impls
2023-05-28Recover upon encountering mistyped `Const` in const param def许杰友 Jieyou Xu (Joe)-0/+44
2023-05-15Recover `impl<T ?Sized>` correctlyMichael Goulet-0/+5
2023-05-02Implement negative boundsMichael Goulet-2/+2
2023-04-25Fix static string lintsclubby789-28/+9
2023-04-09Fix some clippy::complexityNilstrieb-1/+1
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-3/+3
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-21Use `ThinVec` in `ast::WhereClause`.Nicholas Nethercote-2/+2
2023-02-21Use `ThinVec` in `ast::Generics` and related types.Nicholas Nethercote-3/+4
2023-02-04Recover from default value for a lifetime in generic parameters.Lenko Donchev-1/+16
2023-02-01rustc_parse: migrate more to diagnostic structsXiretza-17/+12
2023-01-11parser: recover from where clauses placed before tuple struct bodiesLeón Orell Valerian Liehr-10/+108
2022-10-08fix #102182, recover from impl Trait in type param boundyukang-2/+34
2022-08-22Use `AttrVec` in more places.Nicholas Nethercote-8/+6
In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently.
2022-08-16Remove `{ast,hir}::WhereEqPredicate::id`.Nicholas Nethercote-1/+0
These fields are unused.
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-1/+1
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+1
2022-04-30Save colon span to suggest bounds.Camille GILLOT-4/+9
2022-03-25diagnostics: correct generic bounds with doubled colonMichael Howell-0/+1
Fixes #95208
2022-03-23replace `this.clone()` with `this.create_snapshot_for_diagnostic()`Takayuki Maeda-2/+2
2022-02-23rustc_errors: take `self` by value in `DiagnosticBuilder::cancel`.Eduard-Mihai Burtescu-1/+1
2022-02-03compiler: clippy::complexity fixesMatthias Krüger-1/+1
useless_format map_flatten useless_conversion needless_bool filter_next clone_on_copy needless_option_as_deref
2022-02-02better suggestion for duplicated `where`Michael Goulet-2/+16
2021-12-10remove feature gate and cleanup codeEllen-14/+3
2021-12-05Rollup merge of #90022 - hkmatsumoto:self-upper-as-generic-parameter, r=jackh726Matthias Krüger-0/+13
Explain why `Self` is invalid in generic parameters Close #89985. r? `@estebank`
2021-11-24Account for incorrect `impl Foo<const N: ty> {}` syntaxEsteban Küber-1/+4
Fix #84946
2021-10-19Explain why `Self` is invalid in generic parametersHirochika Matsumoto-0/+13
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