about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/diagnostics.rs
AgeCommit message (Collapse)AuthorLines
2022-09-30Remove expr_parentheses_needed from ParseSessMichael Goulet-1/+2
2022-09-27Implement IntoDiagnosticArg for rustc_ast::token::Token(Kind)Xiretza-3/+3
2022-09-27Document use of Symbol::to_string()Xiretza-0/+2
2022-09-27Migrate even more diagnostics in rustc_parse to diagnostic structsXiretza-193/+109
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-29/+25
2022-09-27Migrate more rustc_parse diagnostics to diagnostic structsXiretza-37/+0
2022-09-27Move rustc_parse diagnostic structs to separate moduleXiretza-781/+5
2022-09-27Migrate "invalid literal suffix" diagnostic to diagnostic structsXiretza-1/+25
2022-09-27Migrate more diagnostics in rustc_parse to diagnostic structsXiretza-3/+247
2022-09-26Rollup merge of #102286 - compiler-errors:recover-semi-in-block-item, ↵Matthias Krüger-0/+8
r=davidtwco Recover some items that expect braces and don't take semicolons Fixes #102262
2022-09-25Recover some items that expect braces and don't take semicolonsMichael Goulet-0/+8
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-42/+42
2022-09-16use subdiagnostic for logical negation, bitwise notyukang-3/+26
2022-09-15more tweak on diagnostic messagesyukang-0/+1
2022-09-08fixes #101477: Recover from typo where == is used in place of =yukang-0/+16
2022-09-06Auto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillotbors-0/+8
Suggest removing unnecessary prefix let in patterns Helps with #101291, though I think `@estebank` probably wants this: > Finally, I think it'd be nice if we could detect that we don't know for sure and "just" swallow the rest of the expression (find the next ; accounting for nested braces) or the end of the item (easier). ... to be implemented before we close that issue out completely.
2022-09-03Suggest removing unnecessary prefix let in patternsMichael Goulet-0/+8
2022-09-02Refactor and re-use BindingAnnotationCameron Steffen-5/+5
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-28Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillotbors-1/+1
Avoid cloning a collection only to iterate over it `@rustbot` label: +C-cleanup
2022-08-23parser will not give wrong help message for 'public'yukang-10/+14
2022-08-23Rollup merge of #100565 - ↵Matthias Krüger-2/+4
TaKO8Ki:suggest-adding-missing-semicolon-before-item, r=compiler-errors Suggest adding a missing semicolon before an item fixes #100533
2022-08-22Rollup merge of #100713 - Xiretza:parser-expr-session-diagnostics, r=estebankDylan DPC-0/+343
Convert diagnostics in parser/expr to SessionDiagnostic This migrates all the easy cases in `rustc_parse::parser::expr` to `SessionDiagnostic`s, I've left things such as `multipart_suggestion`s out for now in the hopes of a derive API being developed soon.
2022-08-22Use `AttrVec` in more places.Nicholas Nethercote-1/+1
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-21Migrate diagnostics in parser/expr to SessionDiagnosticXiretza-0/+343
2022-08-21Replace #[lint/warning/error] with #[diag]Xiretza-8/+8
2022-08-20Rollup merge of #100750 - ↵Matthias Krüger-0/+9
akabinds:akabinds/improved-invalid-function-qual-error, r=davidtwco improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn` Closes #99751
2022-08-18added improved diagnostic for a function defined with an invalid qualifierakabinds-0/+9
2022-08-17Migrate "invalid variable declaration" errors to SessionDiagnosticXiretza-0/+29
2022-08-15Rollup merge of #100559 - nnethercote:parser-simplifications, r=compiler-errorsMatthias Krüger-7/+5
Parser simplifications Best reviewed one commit at a time. r? ``@compiler-errors``
2022-08-15suggest adding a missing semicolon before an itemTakayuki Maeda-2/+4
2022-08-15Simplify attribute handling in `parse_bottom_expr`.Nicholas Nethercote-7/+5
`Parser::parse_bottom_expr` currently constructs an empty `attrs` and then passes it to a large number of other functions. This makes the code harder to read than it should be, because it's not clear that many `attrs` arguments are always empty. This commit removes `attrs` and the passing, simplifying a lot of functions. The commit also renames `Parser::mk_expr` (which takes an `attrs` argument) as `mk_expr_with_attrs`, and introduces a new `mk_expr` which creates an expression with no attributes, which is the more common case.
2022-08-14Make code slightly more uniformRageking8-2/+2
2022-08-13avoid cloning and then iteratingKaDiWa-1/+1
2022-08-10Use &mut Diagnostic instead of &mut DiagnosticBuilder unless neededMichael Goulet-4/+4
2022-08-04Rollup merge of #98796 - compiler-errors:no-semi-if-comma, r=estebankMatthias Krüger-1/+2
Do not exclusively suggest `;` when `,` is also a choice Fixes #96791
2022-07-29Add diagnostic when using public instead of pubGimgim-0/+11
2022-07-23Do not suggest adding `;` when `,` is also a choiceMichael Goulet-1/+2
2022-07-01update cfg(bootstrap)sPietro Albini-2/+2
2022-06-27various: add `rustc_lint_diagnostics` to diag fnsDavid Wood-0/+2
The `rustc_lint_diagnostics` attribute is used by the diagnostic translation/struct migration lints to identify calls where non-translatable diagnostics or diagnostics outwith impls are being created. Any function used in creating a diagnostic should be annotated with this attribute so this commit adds the attribute to many more functions. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24macros: use typed identifiers in subdiag deriveDavid Wood-3/+3
As in the diagnostic derive, using typed identifiers in the subdiagnostic derive improves the diagnostics of using the subdiagnostic derive as Fluent messages will be confirmed to exist at compile-time. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24macros: use typed identifiers in diag deriveDavid Wood-9/+9
Using typed identifiers instead of strings with the Fluent identifier enables the diagnostic derive to benefit from the compile-time validation that comes with typed identifiers - use of a non-existent Fluent identifier will not compile. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-20Rollup merge of #98183 - dtolnay:emptybound, r=lcnrYuki Okushi-1/+4
Fix pretty printing of empty bound lists in where-clause Repro: ```rust macro_rules! assert_item_stringify { ($item:item $expected:literal) => { assert_eq!(stringify!($item), $expected); }; } fn main() { assert_item_stringify! { fn f<'a, T>() where 'a:, T: {} "fn f<'a, T>() where 'a:, T: {}" } } ``` Previously this assertion would fail because rustc renders the where-clause as `where 'a, T` which is invalid syntax. This PR makes the above assertion pass. This bug also affects `-Zunpretty=expanded`. The intention is for that to emit syntactically valid code, but the buggy output is not valid Rust syntax. ```console $ rustc <(echo "fn f<'a, T>() where 'a:, T: {}") -Zunpretty=expanded #![feature(prelude_import)] #![no_std] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; fn f<'a, T>() where 'a, T {} ``` ```console $ rustc <(echo "fn f<'a, T>() where 'a:, T: {}") -Zunpretty=expanded | rustc - error: expected `:`, found `,` --> <anon>:7:23 | 7 | fn f<'a, T>() where 'a, T {} | ^ expected `:` ```
2022-06-17remove the rest of unnecessary `to_string`Takayuki Maeda-4/+4