diff options
| author | jyn <github@jyn.dev> | 2025-03-11 00:24:08 -0400 |
|---|---|---|
| committer | jyn <github@jyn.dev> | 2025-04-13 16:46:02 -0400 |
| commit | d50a8d5fb3727277f82440524e20a67e29dead4c (patch) | |
| tree | 78acdfd39a727bccd0be62d614758cf9d2e4005c /compiler/rustc_builtin_macros/src/errors.rs | |
| parent | 092a284ba0421695f2032c947765429fd7095796 (diff) | |
| download | rust-d50a8d5fb3727277f82440524e20a67e29dead4c.tar.gz rust-d50a8d5fb3727277f82440524e20a67e29dead4c.zip | |
Improve `-Z crate-attr` diagnostics
- Show the `#![ ... ]` in the span (to make it clear that it should not be included in the CLI argument) - Show more detailed errors when the crate has valid token trees but invalid syntax. Previously, `crate-attr=feature(foo),feature(bar)` would just say "invalid crate attribute" and point at the comma. Now, it explicitly says that the comma was unexpected, which is useful when using `--error-format=short`. It also fixes the column to show the correct span. - Recover from parse errors. Previously we would abort immediately on syntax errors; now we go on to try and type-check the rest of the crate. The new diagnostic code also happens to be slightly shorter.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/errors.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/errors.rs | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs index 4bbe212f429..c2b1dff4cf1 100644 --- a/compiler/rustc_builtin_macros/src/errors.rs +++ b/compiler/rustc_builtin_macros/src/errors.rs @@ -110,13 +110,6 @@ pub(crate) struct ProcMacro { } #[derive(Diagnostic)] -#[diag(builtin_macros_invalid_crate_attribute)] -pub(crate) struct InvalidCrateAttr { - #[primary_span] - pub(crate) span: Span, -} - -#[derive(Diagnostic)] #[diag(builtin_macros_non_abi)] pub(crate) struct NonABI { #[primary_span] |
