about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/error.rs
AgeCommit message (Collapse)AuthorLines
2025-06-26const-eval: allow constants to refer to mutable/external memory, but reject ↵Ralf Jung-0/+17
such constants as patterns
2025-06-05Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of NoneOli Scherer-1/+1
2025-02-25Teach structured errors to display short `Ty`Esteban Küber-2/+2
Make it so that every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to. ``` error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)`` --> long.rs:7:5 | 6 | fn foo(x: D) { //~ `x` has type `(... | - `x` has type `((..., ..., ..., ...), ..., ..., ...)` 7 | x(); //~ ERROR expected function, found `(... | ^-- | | | call expression requires function | = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt' = note: consider using `--verbose` to print the full type name to the console ```
2025-02-18clean up layout error diagnosticsLukas Markeffsky-5/+5
- group the fluent slugs together - reword (internal-only) "too generic" error to be more in line with the other errors
2025-02-17Move `rustc_middle::limits` to `rustc_interface`.Nicholas Nethercote-10/+0
It's always good to make `rustc_middle` smaller. `rustc_interface` is the best destination, because it's the only crate that calls `get_recursive_limit`.
2025-02-11compiler: Make middle errors `pub(crate)` and bury some dead codeJubilee Young-18/+10
2025-01-29upstream rustc_codegen_ssa/rustc_middle changes for enzyme/autodiffManuel Drehwald-0/+14
2025-01-27Add `TooGeneric` variant to `LayoutError` and emit `Unknown` oneFedericoBruzzone-0/+3
- `check-pass` test for a MRE of #135020 - fail test for #135138 - switch to `TooGeneric` for checking CMSE fn signatures - switch to `TooGeneric` for compute `SizeSkeleton` (for transmute) - fix broken tests
2024-11-09Move some code from Compiler::enter to GlobalCtxt::finishbjorn3-2/+9
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-02Re-implement a type-size based limitMichael Goulet-0/+14
2024-04-29Remove `extern crate rustc_macros` from `rustc_middle`.Nicholas Nethercote-1/+1
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-4/+4
2024-02-28Rename `DiagnosticArg{,Map,Name,Value}` as `DiagArg{,Map,Name,Value}`.Nicholas Nethercote-3/+3
2024-02-03Use `DiagnosticArgName` in a few more places.Nicholas Nethercote-4/+3
2024-01-30Remove the lifetime from `DiagnosticArgValue`.Nicholas Nethercote-5/+2
Because it's almost always static. This makes `impl IntoDiagnosticArg for DiagnosticArgValue` trivial, which is nice. There are a few diagnostics constructed in `compiler/rustc_mir_build/src/check_unsafety.rs` and `compiler/rustc_mir_transform/src/errors.rs` that now need symbols converted to `String` with `to_string` instead of `&str` with `as_str`, but that' no big deal, and worth it for the simplifications elsewhere.
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-2/+2
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.
2023-09-14don't point at const usage site for resolution-time errorsRalf Jung-0/+7
also share the code that emits the actual error
2023-07-27Don't attempt to compute layout of type referencing errorMichael Goulet-0/+3
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-0/+55
2023-05-16Remove `LangItems::require`Nilstrieb-1/+9
It's just a short wrapper used by `tcx.require_lang_item`. Deleting it gives us a negative diff.
2023-04-03fix(middle): emit error rather than delay bug when reaching limitbohan-0/+8
2022-11-21Match crate and slug namesmejrs-0/+8
2022-10-30better error for rustc_strict_coherence misuseMichael Goulet-0/+9
2022-10-23Migrate all diagnosticsNilstrieb-6/+6
2022-10-03Add diagnostic struct for const eval error in `rustc_middle`pierwill-0/+7
Co-authored-by: Michael Goulet <michael@errs.io>
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-1/+1
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-4/+4
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-4/+4
2022-09-05fix comment111-1/+1
2022-09-01Migrate limit error111-0/+10
2022-09-01Migrate OpaqueHiddenType mismatch111-0/+26
2022-09-01Migrate DropCheckOverflow111-0/+14