summary refs log tree commit diff
path: root/compiler/rustc_expand/src/errors.rs
AgeCommit message (Collapse)AuthorLines
2024-10-05Make deprecated_cfg_attr_crate_type_name a hard errorest31-0/+14
2024-08-27Add `warn(unreachable_pub)` to `rustc_expand`.Nicholas Nethercote-7/+7
Plus a tiny bit of reformatting.
2024-08-21Use bool in favor of Option<()> for diagnosticsMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-27Make `missing_fragment_specifier` an error in edition 2024Trevor Gross-0/+17
`missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout. Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`. Fixes <https://github.com/rust-lang/rust/issues/40107>
2024-06-22delegation: Do not crash on qpaths without a traitVadim Petrochenkov-0/+7
2024-06-14delegation: Implement glob delegationVadim Petrochenkov-2/+10
2024-05-28Convert `proc_macro_back_compat` lint to an unconditional error.Nicholas Nethercote-0/+10
We still check for the `rental`/`allsorts-rental` crates. But now if they are detected we just emit a fatal error, instead of emitting a warning and providing alternative behaviour. The original "hack" implementing alternative behaviour was added in #73345. The lint was added in #83127. The tracking issue is #83125. The direct motivation for the change is that providing the alternative behaviour is interfering with #125174 and follow-on work.
2024-05-15delegation: Implement list delegationVadim Petrochenkov-0/+7
```rust reuse prefix::{a, b, c} ```
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-1/+1
2024-04-26Move some functions from `rustc_expand` to `rustc_builtin_macros`.Nicholas Nethercote-23/+0
These functions are only used in `rustc_builtin_macros`, so it makes sense for them to live there. This allows them to be changed from `pub` to `pub(crate)`.
2024-03-20make "expected paren or brace" error translatableTshepang Mbambo-0/+8
2024-02-21Rollup merge of #121288 - tshepang:make-expand-translatable, r=michaelwoeristerDylan DPC-0/+30
make rustc_expand translatable these are the last of the easy ones
2024-02-20make "proc-macro derive panicked" translatableTshepang Mbambo-0/+15
2024-02-19make "custom attribute panicked" translatableTshepang Mbambo-0/+15
2024-02-16make "invalid fragment specifier" translatableTshepang Mbambo-0/+10
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-5/+6
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
2024-01-17Improved collapse_debuginfo attribute, added command-line flag (no|external|yes)Andrew Zhogin-0/+7
2023-12-10Remove edition umbrella features.Eric Huss-10/+0
2023-12-03Detect attempts to expand a macro to a match arm againNadrieril-0/+2
Because a macro invocation can expand to a never pattern, we can't rule out a `arm!(),` arm at parse time. Instead we detect that case at expansion time, if the macro tries to output a pattern followed by `=>`.
2023-10-21Mention the syntax for `use` on `mod foo;` if `foo` doesn't existEsteban Küber-0/+1
Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`. Fix #69492.
2023-04-25Fix static string lintsclubby789-0/+10
2023-03-04rustc_expand: make proc-macro derive error translatableTshepang Mbambo-0/+7
2023-02-24make "proc macro panicked" translatableTshepang Mbambo-0/+15
2023-02-22errors: generate typed identifiers in each crateDavid Wood-7/+7
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-0/+7
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-12-10Migrate parts of `rustc_expand` to session diagnosticsnils-2/+324
This migrates everything but the `mbe` and `proc_macro` modules. It also contains a few cleanups and drive-by/accidental diagnostic improvements which can be seen in the diff for the UI tests.
2022-10-23Migrate all diagnosticsNilstrieb-6/+6
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-7/+7
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-7/+7
2022-08-21Replace #[lint/warning/error] with #[diag]Xiretza-6/+6
2022-08-17Hotfix for duplicated slug name on VarStillRepeating structnidnogg-1/+1
2022-08-17Moved structs to rustc_expand::errors, added several more migrations, fixed ↵nidnogg-3/+1
slug name
2022-08-17Moved structs to rustc_expand::errors, added several more migrations, fixed ↵nidnogg-0/+50
slug name