diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-08-06 21:29:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-06 21:29:26 +0200 |
| commit | d180873be864bd9297ac555aa4f1b88f48045fb6 (patch) | |
| tree | 205bd7acf4dfc91b2e081f2e2bba71480f10cb33 /compiler/rustc_parse/src/errors.rs | |
| parent | 29cdc6a109ee98a382f974bf89d3971b4385399c (diff) | |
| parent | d09cf616f74e068cfb092e91472fb0ae371529ad (diff) | |
| download | rust-d180873be864bd9297ac555aa4f1b88f48045fb6.tar.gz rust-d180873be864bd9297ac555aa4f1b88f48045fb6.zip | |
Rollup merge of #144195 - Kivooeo:bad-attr, r=fmease,compiler-errors
Parser: Recover from attributes applied to types and generic args r? compiler Add clearer error messages for invalid attribute usage in types or generic types fixes rust-lang/rust#135017 fixes rust-lang/rust#144132
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 4aaaba01fae..48ff0394d46 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1490,6 +1490,34 @@ pub(crate) struct AttributeOnParamType { } #[derive(Diagnostic)] +#[diag(parse_attribute_on_type)] +pub(crate) struct AttributeOnType { + #[primary_span] + #[label] + pub span: Span, + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] + pub fix_span: Span, +} + +#[derive(Diagnostic)] +#[diag(parse_attribute_on_generic_arg)] +pub(crate) struct AttributeOnGenericArg { + #[primary_span] + #[label] + pub span: Span, + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] + pub fix_span: Span, +} + +#[derive(Diagnostic)] +#[diag(parse_attribute_on_empty_type)] +pub(crate) struct AttributeOnEmptyType { + #[primary_span] + #[label] + pub span: Span, +} + +#[derive(Diagnostic)] #[diag(parse_pattern_method_param_without_body, code = E0642)] pub(crate) struct PatternMethodParamWithoutBody { #[primary_span] |
