summary refs log tree commit diff
path: root/compiler/rustc_parse/src
AgeCommit message (Collapse)AuthorLines
2022-03-17Do not recover from `Ty?` in macro parsingEsteban Kuber-15/+27
Follow up to #92746. Address #94510. (cherry picked from commit 004f2ed219378235c24a5d6bdb34337200e6eeed)
2022-02-18Rollup merge of #93634 - matthiaskrgr:clippy_complexity_jan_2022, r=oli-obkMatthias Krüger-5/+5
compiler: clippy::complexity fixes useless_format map_flatten useless_conversion needless_bool filter_next clone_on_copy needless_option_as_deref
2022-02-17Rollup merge of #94011 - est31:let_else, r=lcnrMatthias Krüger-6/+3
Even more let_else adoptions Continuation of #89933, #91018, #91481, #93046, #93590.
2022-02-16Adopt let_else in even more placesest31-6/+3
2022-02-14suggest using raw string literals when invalid escapes appearErin Petra Sofiya Moon-0/+9
i'd guess about 70% of "bad escape" cases occur when someone meant to use a raw string literal because they're passing it directly to Regex::new(). this emits an advisory (Applicability::MaybeIncorrect) help: suggestion to the user that they use an r"" string, on top of the normal notes about looking at the string literal documentation/spec.
2022-02-12Rollup merge of #93595 - compiler-errors:ice-on-lifetime-arg, r=jackh726Matthias Krüger-3/+3
fix ICE when parsing lifetime as function argument I don't really like this, but we basically need to emit an error instead of just delaying an bug, because there are too many places in the AST that aren't covered by my previous PRs... cc: https://github.com/rust-lang/rust/issues/93282#issuecomment-1028052945
2022-02-03compiler: clippy::complexity fixesMatthias Krüger-5/+5
useless_format map_flatten useless_conversion needless_bool filter_next clone_on_copy needless_option_as_deref
2022-02-03clippy::perf fixesMatthias Krüger-3/+3
single_char_pattern and to_string_in_format_args
2022-02-02fix ICE when parsing lifetime as function argumentMichael Goulet-3/+3
2022-02-02better suggestion for duplicated `where`Michael Goulet-9/+38
2022-01-31Rollup merge of #93019 - 5225225:uppercase-suffix, r=wesleywiserEric Huss-0/+25
If an integer is entered with an upper-case base prefix (0Xbeef, 0O755, 0B1010), suggest to make it lowercase The current error for this case isn't really great, it just complains about the whole thing past the `0` being an invalid suffix.
2022-01-31Write UI tests, tweak message5225225-3/+2
2022-01-31Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwcoMatthias Krüger-4/+4
Improve suggestion for escaping reserved keywords r? `@davidtwco`
2022-01-27Improve suggestion for escaping reserved keywordsNoah Lev-4/+4
2022-01-27Suggest making base prefix lowercase if parsing fails5225225-0/+26
2022-01-26Introduce a limit to Levenshtein distance computationTomasz Miąsko-1/+1
Incorporate distance limit from `find_best_match_for_name` directly into Levenshtein distance computation. Use the string size difference as a lower bound on the distance and exit early when it exceeds the specified limit. After finding a candidate within a limit, lower the limit further to restrict the search space.
2022-01-25delay the bug once again, generalize turbofish suggestionMichael Goulet-22/+15
2022-01-25Remove delayed bug when encountering label in bad turbofishMichael Goulet-3/+4
2022-01-22Fix let_chains and if_let_guard feature flagsCaio-3/+17
2022-01-18Rollup merge of #91150 - dtolnay:qpath, r=davidtwcoMatthias Krüger-10/+34
Let qpath contain NtTy: `<$:ty as $:ty>::…` Example: ```rust macro_rules! m { (<$type:ty as $trait:ty>::$name:ident) => { <$type as $trait>::$name }; } fn main() { let _: m!(<str as ToOwned>::Owned); } ``` Previous behavior: ```console error: expected identifier, found `ToOwned` --> src/main.rs:3:19 | 3 | <$type as $trait>::$name | ^^^^^^ expected identifier ... 8 | let _: m!(<str as ToOwned>::Owned); | --------------------------- | | | this macro call doesn't expand to a type | in this macro invocation ``` The <code>expected identifier, found \`ToOwned\`</code> error is particularly silly. I think it should be fine to accept this code as long as $trait is of the form `TyKind::Path(None, path)`; if it is any other kind of `NtTy`, we'll keep the same behavior as before.
2022-01-17Add term to ExistentialProjectionkadmin-1/+4
Also prevent ICE when adding a const in associated const equality.
2022-01-17Use Term in ProjectionPredicatekadmin-7/+5
ProjectionPredicate should be able to handle both associated types and consts so this adds the first step of that. It mainly just pipes types all the way down, not entirely sure how to handle consts, but hopefully that'll come with time.
2022-01-17Add termkadmin-2/+4
Instead of having a separate enum variant for types and consts have one but have either a const or type.
2022-01-17add eq constraints on associated constantskadmin-20/+17
2022-01-17Rollup merge of #92876 - compiler-errors:fix-turbofish-lifetime-suggestion, ↵Matthias Krüger-17/+30
r=nagisa Fix suggesting turbofish with lifetime arguments Now we suggest turbofish correctly given exprs like `foo<'_>`. Also fix suggestion when we have `let x = foo<bar, baz>;` which was broken.
2022-01-16Rollup merge of #92746 - estebank:question-mark-in-type, r=davidtwcoMatthias Krüger-3/+57
Parse `Ty?` as `Option<Ty>` and provide structured suggestion Swift has specific syntax that desugars to `Option<T>` similar to our `?` operator, which means that people might try to use it in Rust. Parse it and gracefully recover.
2022-01-13Fix suggesting turbofish with lifetime argumentsMichael Goulet-17/+30
2022-01-14Parse `Ty?` as `Option<Ty>` and provide structured suggestionEsteban Kuber-3/+57
Swift has specific syntax that desugars to `Option<T>` similar to our `?` operator, which means that people might try to use it in Rust. Parse it and gracefully recover.
2022-01-09eplace usages of vec![].into_iter with [].into_iterLucas Kent-2/+2
2022-01-05ast: Always keep a `NodeId` in `ast::Crate`Vadim Petrochenkov-1/+1
This makes it more uniform with other expanded nodes
2021-12-28Parse and suggest moving where clauses after equals for type aliasesJack Huey-0/+53
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-4/+6
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-18Rollup merge of #87901 - poliorcetics:pub-pub-pub, r=jackh726Matthias Krüger-30/+90
Fix suggestion of additional `pub` when using `pub pub fn ...` Fix #87694. Marked as draft to start with because I want to explore doing the same fix for `const const fn` and other repeated-but-valid keywords. `@rustbot` label A-diagnostics D-invalid-suggestion T-compiler
2021-12-15Auto merge of #91962 - matthiaskrgr:rollup-2g082jw, r=matthiaskrgrbors-1/+1
Rollup of 7 pull requests Successful merges: - #91880 (fix clippy::single_char_pattern perf findings) - #91885 (Remove `in_band_lifetimes` from `rustc_codegen_ssa`) - #91898 (Make `TyS::is_suggestable` check for non-suggestable types structually) - #91915 (Add another regression test for unnormalized fn args with Self) - #91916 (Fix a bunch of typos) - #91918 (Constify `bool::then{,_some}`) - #91920 (Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-15Rollup merge of #91880 - matthiaskrgr:clippy_perf_dec, r=jyn514Matthias Krüger-1/+1
fix clippy::single_char_pattern perf findings
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-14Stabilize `destructuring_assignment`Jacob Pratt-2/+0
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-2/+4
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-14Rollup merge of #91597 - r00ster91:lessthangreaterthan, r=oli-obkMatthias Krüger-1/+33
Recover on invalid operators `<>` and `<=>` Thanks to #89871 for showing me how to do this. Next, I think it'd be nice to recover on `<=>` too, like #89871 intended, if this even works.
2021-12-14Recover on invalid operators <> and <=>r00ster91-1/+33
2021-12-14fix clippy::single_char_pattern perf findingsMatthias Krüger-1/+1
2021-12-13Use Inherited Visibility instead of None when no vis is presentAlexis Bourget-14/+20
2021-12-13Update test to new error messageAlexis Bourget-1/+1
2021-12-13Suggest remove on const async const instead of const const asyncAlexis Bourget-16/+45
2021-12-13Fix broken span and related testsAlexis Bourget-1/+1
2021-12-13Change error for pub in fn decl if already presentAlexis Bourget-14/+39
2021-12-12Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnrbors-14/+3
Stabilise `feature(const_generics_defaults)` `feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation. needs stabilisation report and maybe an RFC :sweat_smile: r? `@lcnr` cc `@rust-lang/project-const-generics`
2021-12-10Rollup merge of #91625 - est31:remove_indexes, r=oli-obkMatthias Krüger-3/+3
Remove redundant [..]s
2021-12-10remove feature gate and cleanup codeEllen-14/+3
2021-12-09Rollup merge of #91634 - terrarier2111:fix-recover-from-variant-ice, r=nagisaMatthias Krüger-20/+27
Do not attempt to suggest help for overly malformed struct/function call This fixes: https://github.com/rust-lang/rust/issues/91461