about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
AgeCommit message (Collapse)AuthorLines
2022-10-03Add comments to `TokenCursor::desugar`.Nicholas Nethercote-1/+5
It took me some time to work out what this code was doing.
2022-10-01Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillotMatthias Krüger-3/+5
Remove `expr_parentheses_needed` from `ParseSess` Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.
2022-09-30Rollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqdMatthias Krüger-8/+10
Group together more size assertions. Also add a few more assertions for some relevant token-related types. And fix an erroneous comment in `rustc_errors`. r? `@lqd`
2022-10-01Group together more size assertions.Nicholas Nethercote-8/+10
Also add a few more assertions for some relevant token-related types. And fix an erroneous comment in `rustc_errors`.
2022-09-30Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, ↵Matthias Krüger-11/+17
r=fee1-dead Improve errors for incomplete functions in struct definitions Given the following code: ```rust fn main() {} struct Foo { fn } ``` [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345) The current output is: ``` Compiling playground v0.0.1 (/playground) error: functions are not allowed in struct definitions --> src/main.rs:4:5 | 4 | fn | ^^ | = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information error: could not compile `playground` due to previous error ``` In this case, rustc should suggest escaping `fn` to use it as an identifier.
2022-09-30Remove expr_parentheses_needed from ParseSessMichael Goulet-3/+5
2022-09-29improve E0585 helpRageking8-2/+2
2022-09-28Auto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwcobors-1253/+496
Migrate more of rustc_parse to SessionDiagnostic Still far from complete, but I thought I'd add a checkpoint here because rebasing was starting to get annoying.
2022-09-27Rollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=davidtwcoMatthias Krüger-4/+7
Structured suggestion for missing `mut`/`const` in raw pointer Fixes #102261
2022-09-27Implement IntoDiagnosticArg for rustc_ast::token::Token(Kind)Xiretza-32/+22
2022-09-27Don't unnecessarily stringify paths in diagnosticsXiretza-9/+9
2022-09-27Document use of Symbol::to_string()Xiretza-0/+2
2022-09-27Migrate even more diagnostics in rustc_parse to diagnostic structsXiretza-213/+131
2022-09-27Migrate "struct literal body without path" error to diagnostic structXiretza-16/+11
2022-09-27Migrate "expected semicolon" diagnostics to diagnostic structsXiretza-16/+21
2022-09-27Migrate "expected identifier" diagnostics to diagnostic structsXiretza-42/+60
2022-09-27Rework "inner attribute not permitted" errorsXiretza-58/+58
2022-09-27Remove error condition in parse_attributeXiretza-25/+12
This function is only ever called when the `#` has already been consumed, no need to produce an error message here.
2022-09-27Migrate more rustc_parse diagnostics to diagnostic structsXiretza-150/+62
2022-09-27Move rustc_parse diagnostic structs to separate moduleXiretza-811/+34
2022-09-27Migrate "invalid literal suffix" diagnostic to diagnostic structsXiretza-47/+56
2022-09-27Migrate more diagnostics in rustc_parse to diagnostic structsXiretza-218/+402
2022-09-28improve errors for incomplete functions in struct definitionsTakayuki Maeda-11/+17
2022-09-27Structured suggestion for missing mut/const in pointerMichael Goulet-4/+7
2022-09-27add a label to struct/enum/union ident nameTakayuki Maeda-10/+26
2022-09-27create a new local varTakayuki Maeda-5/+3
2022-09-26Rollup merge of #102286 - compiler-errors:recover-semi-in-block-item, ↵Matthias Krüger-7/+30
r=davidtwco Recover some items that expect braces and don't take semicolons Fixes #102262
2022-09-26Auto merge of #102297 - fee1-dead-contrib:rollup-2np0cre, r=fee1-deadbors-0/+17
Rollup of 5 pull requests Successful merges: - #102143 (Recover from struct nested in struct) - #102178 (bootstrap: the backtrace feature is stable, no need to allow it any more) - #102197 (Stabilize const `BTree{Map,Set}::new`) - #102267 (Don't set RUSTC in the bootstrap build script) - #102270 (Remove benches from `rustc_middle`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-25Recover some items that expect braces and don't take semicolonsMichael Goulet-7/+30
2022-09-22recover from struct nested in structRageking8-0/+17
2022-09-22Add missing code="" attributes to suggestion subdiagnosticsXiretza-4/+4
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-2/+2
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-7/+7
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-42/+42
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-43/+43
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-1/+1
2022-09-21Auto merge of #101846 - chenyukang:fix-101793, r=davidtwcobors-5/+41
Fix the wording of help msg for bitwise not Fixes #101793
2022-09-20Rollup merge of #100250 - cjgillot:recover-token-stream, r=Aaron1011Michael Howell-1/+0
Manually cleanup token stream when macro expansion aborts. In case of syntax error in macro expansion, the expansion code can decide to stop processing anything. In that case, the token stream is malformed. This makes downstream users, like derive macros, ICE. In this case, this PR manually cleans up the token stream by closing all currently open delimiters. Fixes https://github.com/rust-lang/rust/issues/96818. Fixes https://github.com/rust-lang/rust/issues/80447. Fixes https://github.com/rust-lang/rust/issues/81920. Fixes https://github.com/rust-lang/rust/issues/91023.
2022-09-16Rollup merge of #101859 - Rageking8:slight-vertical-formatting, ↵Guillaume Gomez-12/+12
r=compiler-errors Slight vertical formatting
2022-09-16use subdiagnostic for logical negation, bitwise notyukang-11/+37
2022-09-16tweak suggestionyukang-1/+1
2022-09-15slight vertical formattingRageking8-12/+12
2022-09-15more tweak on diagnostic messagesyukang-0/+10
2022-09-15fix #101797: Suggest associated const for incorrect use of let in traitsyukang-4/+15
2022-09-14Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillotbors-2/+15
make `mk_attr_id` part of `ParseSess` Updates #48685 The current `mk_attr_id` uses the `AtomicU32` type, which is not very efficient and adds a lot of lock contention in a parallel environment. This PR refers to the task list in #48685, uses `mk_attr_id` as a method of the `AttrIdGenerator` struct, and adds a new field `attr_id_generator` to `ParseSess`. `AttrIdGenerator` uses the `WorkerLocal`, which has two advantages: 1. `Cell` is more efficient than `AtomicU32`, and does not increase any lock contention. 2. We put the index of the work thread in the first few bits of the generated `AttrId`, so that the `AttrId` generated in different threads can be easily guaranteed to be unique. cc `@cjgillot`
2022-09-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-2/+11
Initial implementation of dyn* This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things: * Introduce `dyn_star` feature flag * Adds parsing for `dyn* Trait` types * Defines `dyn* Trait` as a sized type * Adds support for explicit casts, like `42usize as dyn* Debug` * Including const evaluation of such casts * Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope * Adds codegen for method calls, at least for methods that take `&self` Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits. Joint work with `@nikomatsakis` and `@compiler-errors.` r? `@bjorn3`
2022-09-14make `mk_attr_id` part of `ParseSess`SparrowLii-2/+15
2022-09-13Address code review commentsEric Holk-3/+1
2022-09-13Emit an error instead of reconstructing token stream.Camille GILLOT-30/+14
2022-09-13Manually cleanup token stream when macro expansion aborts.Camille GILLOT-15/+30