about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/session_diagnostics.rs
AgeCommit message (Collapse)AuthorLines
2025-04-03move `check_opaque_type_parameter_valid`lcnr-11/+0
2025-02-25Teach structured errors to display short `Ty`Esteban Küber-3/+3
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-01-31Rework "long type names" printing logicEsteban Küber-7/+0
Make it so more type-system types can be printed in a shortened version (like `Predicate`s). Centralize printing the information about the "full type name path". Make the "long type path" for the file where long types are written part of `Diag`, so that it becomes easier to keep track of it, and ensure it will always will be printed out last in the diagnostic by making its addition to the output implicit. Tweak the shortening of types in "expected/found" labels. Remove dead file `note.rs`.
2025-01-24Use short ty string for move errorsEsteban Küber-3/+10
``` error[E0382]: use of moved value: `x` --> bay.rs:14:14 | 12 | fn foo(x: D) { | - move occurs because `x` has type `(((..., ..., ..., ...), ..., ..., ...), ..., ..., ...)`, which does not implement the `Copy` trait 13 | let _a = x; | - value moved here 14 | let _b = x; //~ ERROR use of moved value | ^ value used here after move | = note: the full type name has been written to 'bay.long-type-14349227078439097973.txt' = note: consider using `--verbose` to print the full type name to the console help: consider cloning the value if the performance cost is acceptable | 13 | let _a = x.clone(); | ++++++++ ```
2025-01-08run borrowck tests on BIDs and emit tail-expr-drop-order lints forDing Xiang Fei-0/+7
potential violations
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-09-18Begin experimental support for pin reborrowingEric Holk-1/+1
This commit adds basic support for reborrowing `Pin` types in argument position. At the moment it only supports reborrowing `Pin<&mut T>` as `Pin<&mut T>` by inserting a call to `Pin::as_mut()`, and only in argument position (not as the receiver in a method call).
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-03-18Prevent opaque types being instantiated twice with different regions within ↵Oli Scherer-0/+13
the same function
2024-03-13Account for UnOps in borrowck messageEsteban Küber-0/+5
2024-02-20require simd_insert, simd_extract indices to be constantsRalf Jung-2/+4
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-4/+4
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-10-20s/generator/coroutine/Oli Scherer-10/+10
2023-10-20s/Generator/Coroutine/Oli Scherer-10/+10
2023-09-06Don't report any errors in `lower_intrinsics`. They should have been ↵Oli Scherer-0/+7
typecked before.
2023-07-10Fix another strange suggestion spanMichael Goulet-1/+1
2023-04-27Don't call await a methodMichael Goulet-0/+8
2023-04-13rm var_span_label to var_subdiag & eager subdiagAndyJado-1/+206
2023-02-22errors: generate typed identifiers in each crateDavid Wood-2/+2
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-30errors: implement `IntoDiagnosticArg` for `&T`David Wood-13/+1
Implement `IntoDiagnosticArg` for `&'a T` when `T` implements `IntoDiagnosticArg` and `Clone`. Makes it easier to write diagnostic structs that borrow something which implements `IntoDiagnosticArg`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-16Improve a TAIT error and add an error code plus documentationOli Scherer-1/+12
2022-11-09struct error E0505AndyJado-0/+13
2022-11-09var_subdiag refinementAndyJado-30/+35
trim old
2022-11-09remove old var_span_path_onlyAndyJado-0/+44
doc comment
2022-11-05first move on a nested span_labelAndyJado-0/+30
Apply suggestions from code review Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2022-10-26Convert all #[suggestion_*] attributes to #[suggestion(style = "...")]Xiretza-1/+1
Using the following command: find compiler/ -type f -name '*.rs' -exec perl -i -gpe \ 's/(#\[\w*suggestion)_(short|verbose|hidden)\(\s*(\S+,)?/\1(\3style = "\2",/g' \ '{}' +
2022-10-23Migrate all diagnosticsNilstrieb-19/+19
2022-10-07Move ReverseMapper logic onto OpaqueHiddenTypeOli Scherer-9/+0
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-6/+6
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-8/+8
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-8/+8
2022-08-26diag-migAndyJado-1/+116
2022-08-21Replace #[lint/warning/error] with #[diag]Xiretza-4/+4
2022-06-28Migrate some rustc_borrowck diagnostics to SessionDiagnosticMichael Goulet-0/+44