about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
AgeCommit message (Collapse)AuthorLines
2022-03-23Rollup merge of #95212 - ↵Dylan DPC-2/+2
TaKO8Ki:replace-this-clone-with-this-create-snapshot-for-diagnostic, r=Dylan-DPC Replace `this.clone()` with `this.create_snapshot_for_diagnostic()` Use [`create_snapshot_for_diagnostic`](https://github.com/rust-lang/rust/blob/cd119057160cedea245aa2679add56723f3dc784/compiler/rustc_parse/src/parser/diagnostics.rs#L214-L223) I implemented in https://github.com/rust-lang/rust/pull/94731 instead of `this.clone()` to avoid duplicate errors about unclosed delims being emitted when the `Parser` is dropped.
2022-03-22Auto merge of #95215 - Dylan-DPC:rollup-l9f9t7l, r=Dylan-DPCbors-4/+8
Rollup of 5 pull requests Successful merges: - #95188 ([`macro-metavar-expr`] Fix generated tokens hygiene) - #95196 (rename LocalState::Uninitialized to Unallocated) - #95197 (Suggest constraining param for unary ops when missing trait impl) - #95200 (Cancel a not emitted error after parsing const generic args) - #95207 (update Termination trait docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-23replace `this.clone()` with `this.create_snapshot_for_diagnostic()`Takayuki Maeda-2/+2
2022-03-22Auto merge of #94693 - nnethercote:parser-inlining, r=petrochenkovbors-12/+33
Inline some parser functions Some crates that do a lot of complex declarative macro expansion spend a lot of time parsing (and reparsing) tokens. These commits inline some functions for some minor speed wins. r? `@ghost`
2022-03-22cancel a not emitted error after parsing const generic argsTakayuki Maeda-4/+8
2022-03-22Split `TokenCursor::{next,next_desugared}` into inlined and non-inlined halves.Nicholas Nethercote-10/+24
2022-03-22Split `Parser::bump_with` into inlined and non-inlined halves.Nicholas Nethercote-2/+9
The call site within `Parser::bump` is hot. Also add an inline annotation to `Parser::next_tok`. It was already being inlined by the compiler; this just makes sure that continues.
2022-03-21Auto merge of #95104 - compiler-errors:remove-ascription, r=davidtwcobors-6/+35
suggest removing type ascription in bad parsing position Not sure how to test this with the non-nightly suggestion. Didn't add a new UI test because it already manifests in an existing UI test. Fixes #95014
2022-03-20Rollup merge of #95135 - ↵Matthias Krüger-1/+1
TaKO8Ki:fix-not-emitted-unmatched-angle-bracket-error, r=Dylan-DPC Fix a not emitted unmatched angle bracket error closes #95128
2022-03-20fix a not emitted unmatched angle bracket errorTakayuki Maeda-1/+1
2022-03-18suggest removing type ascription in bad positionMichael Goulet-6/+35
2022-03-18use `self.create_snapshot_for_diagnostic` instead of `self.clone()`Takayuki Maeda-5/+6
2022-03-17Rollup merge of #94960 - codehorseman:master, r=oli-obkDylan DPC-1/+1
Fix many spelling mistakes Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-17Rollup merge of #94731 - TaKO8Ki:const-generic-expr-recovery, ↵Dylan DPC-36/+88
r=davidtwco,oli-obk Suggest adding `{ .. }` around a const function call with arguments closes #91020
2022-03-17Rollup merge of #93222 - mark-i-m:errorreported, r=oli-obkDylan DPC-3/+3
Make ErrorReported impossible to construct outside `rustc_errors` There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name. cc #69426 `@varkor` `@eddyb` `@estebank` I actually didn't see that I was assigned to this issue until now...
2022-03-17Rollup merge of #91133 - terrarier2111:unsafe-diagnostic, r=jackh726Dylan DPC-3/+25
Improve `unsafe` diagnostic This fixes: https://github.com/rust-lang/rust/issues/90880 I didn't use the exact proposed messages though.
2022-03-16rustc_error: make ErrorReported impossible to constructmark-3/+3
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-15Parse inner attributes on inline const blockDavid Tolnay-2/+2
2022-03-15use `format_args_capture` in some parts of rustc_parseTakayuki Maeda-61/+60
2022-03-15Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuberbors-4/+7
More robust fallback for `use` suggestion Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion. But this was fragile, as illustrated in issue #87613 This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion. Fix #87613
2022-03-12Auto merge of #94865 - ↵bors-0/+13
notriddle:notriddle/single-colon-path-not-const-generics, r=cjgillot diagnostics: single colon within `<>` probably, not type ascription Fixes #94812
2022-03-12Use consistent prose for `::`Michael Howell-1/+1
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2022-03-11diagnostics: single colon within `<>` probably, not type ascriptionMichael Howell-0/+13
Fixes #94812
2022-03-11Rollup merge of #94839 - ↵Dylan DPC-0/+10
TaKO8Ki:suggest-using-double-colon-for-struct-field-type, r=cjgillot Suggest using double colon when a struct field type include single colon #92685
2022-03-11fix a suggestion messageTakayuki Maeda-1/+1
2022-03-11suggest using double colon when using single colon in struct field type pathTakayuki Maeda-0/+10
2022-03-10replace `self.clone()` with `self.create_snapshot_for_diagnostic()`Takayuki Maeda-36/+36
2022-03-10add doc commentsTakayuki Maeda-5/+14
2022-03-09implement `SnapshotParser` structTakayuki Maeda-6/+33
2022-03-09take over unclosed_delimsTakayuki Maeda-0/+1
2022-03-09remove an unnecessary commentTakayuki Maeda-1/+0
2022-03-09implement and use `diagnostic_snapshot`Takayuki Maeda-2/+8
2022-03-09initialize unclosed_delims fieldTakayuki Maeda-0/+1
2022-03-08suggest adding `{ .. }` around a const function with argumentsTakayuki Maeda-0/+9
2022-03-07diagnostics: only talk about `Cargo.toml` if running under CargoMichael Howell-6/+3
Fixes #94646
2022-03-06Auto merge of #90076 - jackh726:wherethewhere, r=nikomatsakisbors-53/+29
Change location of where clause on GATs Closes #89122 ~Blocked on lang FCP~ r? `@nikomatsakis`
2022-03-05Change syntax for TyAlias where clausesJack Huey-53/+29
2022-03-05Rollup merge of #94633 - ↵Ralf Jung-0/+10
TaKO8Ki:suggest-removing-semicolon-after-derive-attribute, r=cjgillot Suggest removing a semicolon after derive attributes closes #93942
2022-03-06suggest removing a semicolon after derive attributesTakayuki Maeda-0/+10
use current token span
2022-03-04Do not recover from `Ty?` in macro parsingEsteban Kuber-15/+27
Follow up to #92746. Address #94510.
2022-03-03Adjusted diagnostic output so that if there is no `use` in a item sequence,Felix S. Klock II-1/+4
then we just suggest the first legal position where you could inject a use. To do this, I added `inject_use_span` field to `ModSpans`, and populate it in parser (it is the span of the first token found after inner attributes, if any). Then I rewrote the use-suggestion code to utilize it, and threw out some stuff that is now unnecessary with this in place. (I think the result is easier to understand.) Then I added a test of issue 87613.
2022-03-03Associate multiple with a crate too.Felix S. Klock II-2/+1
2022-03-03refactor: prepare to associate multiple spans with a module.Felix S. Klock II-3/+4
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-24/+26
2022-02-28Rollup merge of #94445 - c410-f3r:more-let-chains, r=cjgillotMatthias Krüger-67/+63
4 - Make more use of `let_chains` Continuation of #94376. cc #53667
2022-02-28Tweak diagnosticsEsteban Kuber-54/+150
* Recover from invalid `'label: ` before block. * Make suggestion to enclose statements in a block multipart. * Point at `match`, `while`, `loop` and `unsafe` keywords when failing to parse their expression. * Do not suggest `{ ; }`. * Do not suggest `|` when very unlikely to be what was wanted (in `let` statements).
2022-02-284 - Make more use of `let_chains`Caio-67/+63
Continuation of #94376. cc #53667
2022-02-25Suggest {} around more bad const generic exprsMichael Goulet-18/+40
2022-02-25Rollup merge of #94344 - notriddle:notriddle/suggest-parens-more, r=oli-obkMatthias Krüger-2/+16
diagnostic: suggest parens when users want logical ops, but get closures Fixes #93536