about summary refs log tree commit diff
path: root/compiler/rustc_error_messages/src
AgeCommit message (Collapse)AuthorLines
2022-08-31Rollup merge of #100753 - LuisCardosoOliveira:translation-migrate-session, ↵Ralf Jung-0/+1
r=davidtwco translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1 ## Description This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883). The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.
2022-08-31Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwcoRalf Jung-0/+1
Migrate rustc_monomorphize to use SessionDiagnostic ### Description - Migrates diagnostics in `rustc_monomorphize` to use `SessionDiagnostic` - Adds an `impl IntoDiagnosticArg for PathBuf` ### TODO / Help! - [x] I'm having trouble figuring out how to apply an optional note. 😕 Help!? - Resolved. It was bad docs. Fixed in https://github.com/rust-lang/rustc-dev-guide/pull/1437/files - [x] `errors:RecursionLimit` should be `#[fatal ...]`, but that doesn't exist so it's `#[error ...]` at the moment. - Maybe I can switch after this is merged in? --> https://github.com/rust-lang/rust/pull/100694 - Or maybe I need to manually implement `SessionDiagnostic` instead of deriving it? - [x] How does one go about converting an error inside of [a call to struct_span_lint_hir](https://github.com/rust-lang/rust/blob/8064a495086c2e63c0ef77e8e82fe3b9b5dc535f/compiler/rustc_monomorphize/src/collector.rs#L917-L927)? - [x] ~What placeholder do you use in the fluent template to refer to the value in a vector? It seems like [this code](https://github.com/rust-lang/rust/blob/0b79f758c9aa6646606662a6d623a0752286cd17/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs#L83-L114) ought to have the answer (or something near it)...but I can't figure it out.~ You can't. Punted.
2022-08-31SessionDiagnostic for QueryOverflow errorLi Yuanheng-1/+1
2022-08-31migrate rustc_query_system to use SessionDiagnosticYuanheng Li-0/+1
with manual impl SessionDiagnostic
2022-08-30ADD - InvalidSymbolName to migrate symbol-name({}) error to new diagnostics ↵Jhonny Bill Mena-0/+1
infraestructure ADD - dependencies needed to port a module to new Diagnostics infra (rustc_macros, rustc_errors, errors file, and fluent file)
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-29Rollup merge of #100843 - IntQuant:issue-100717-infer, r=compiler-errorsMatthias Krüger-0/+1
Migrate part of rustc_infer to session diagnostic
2022-08-26Rollup merge of #100890 - adriantombu:migrate_diagnostic_rustc_driver, ↵Michael Goulet-0/+1
r=davidtwco Migrate rustc_driver to SessionDiagnostic First timer noob here 👋🏽 I'm having a problem understanding how I can retrieve the span, and how to properly construct the error structs to avoid the current compilation errors. Any help pointing me in the right direction would be much appreciated 🙌🏽
2022-08-26Rollup merge of #100836 - hampuslidin:migrate-attr-crate-diagnostics, ↵Michael Goulet-0/+1
r=davidtwco Migrate `rustc_attr` crate diagnostics Hi! This is my first PR to the rustc project, excited to be part of the development! This PR is part of the diagnostics effort, to make diagnostics translatable. `@rustbot` label +A-translation
2022-08-26Rollup merge of #100744 - 5225225:migrate-rustc-mir-dataflow, r=davidtwcoMichael Goulet-0/+1
Migrate rustc_mir_dataflow to diagnostic structs
2022-08-26Rollup merge of #100735 - Facel3ss1:ty-utils-translation, r=davidtwcoMichael Goulet-0/+1
Migrate `rustc_ty_utils` to `SessionDiagnostic` I have migrated the `rustc_ty_utils` crate to use `SessionDiagnostic`, motivated by the [recent blog post about the diagnostic translation effort](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html). This is my first PR to the Rust repository, so if I have missed anything, or anything needs to be changed, please let me know! 😄 `@rustbot` label +A-translation
2022-08-26Rollup merge of #100724 - ↵Michael Goulet-0/+1
JeanCASPAR:migrate-ast_lowering-to-session-diagnostic, r=davidtwco Migrate ast lowering to session diagnostic I migrated the whole rustc_ast_lowering crate to session diagnostic *except* the for the use of `span_fatal` at /compiler/rustc_ast_lowering/src/expr.rs#L1268 because `#[fatal(...)]` is not yet supported (see https://github.com/rust-lang/rust/pull/100694).
2022-08-26translations(rustc_session): migrate the file cgu_reuse_trackerLuis Cardoso-0/+1
This commit migrates the errors that indicates an incorrect CGU type and the fatal error that indicates that a CGU has not been correctly recorded
2022-08-26Migrate rustc_ty_utils to use SessionDiagnosticPeter Medus-0/+1
2022-08-25rebased: convert rustc_monomorphize errors to SessionDiagnosticNathan Stocks-0/+1
2022-08-25Replace spaghetti with a simple errors enumAdrian Tombu-1/+0
2022-08-25Start adding enum errors for deserialize_rlinkAdrian Tombu-0/+1
2022-08-25Start moving rustc_driver to SessionDiagnosticAdrian Tombu-0/+1
2022-08-24save_analysis: Migrate diagnosticsWonchul Lee-0/+1
2022-08-23Rename rustc_mir_dataflow diagnostic to mir_dataflow5225225-1/+1
2022-08-23Migrate OpaqueHiddenType, E0282, E0283, E0284, E0698Nikita Tomashevich-0/+1
2022-08-23Migrate rustc_mir_dataflow to diagnostic structs5225225-0/+1
2022-08-22Refactor diagnostics in `handle_errors` functionHampus Lidin-0/+1
2022-08-22Migrate ast_lowering::path to SessionDiagnosticJean CASPAR-0/+1
2022-08-22Migrate rustc_plugin_impl to SessionDiagnosticPeter Medus-0/+1
2022-08-22Migrate forbidden_letfinalchild-0/+1
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-17Migrate emoji identifier diagnostics to `SessionDiagnostic`finalchild-0/+1
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-07-20clippy::perf fixesMatthias Krüger-1/+1
2022-07-16Stabilize `let_chains`Caio-1/+1
2022-07-15passes: migrate half of `check_attr`David Wood-0/+1
Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable.
2022-07-10use subdiagnostic for messageMichael Goulet-1/+2
2022-07-08Migrate unstable-in-stable diagnosticMichael Goulet-0/+1
2022-06-30lint: port array-into-iter diagnosticsDavid Wood-2/+3
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-28Migrate some rustc_borrowck diagnostics to SessionDiagnosticMichael Goulet-0/+1
2022-06-27privacy: port "field is private" diagDavid Wood-0/+1
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24errors: remove diagnostic message ctorsDavid Wood-17/+0
Now that typed identifiers are used in both derives, constructors for the `DiagnosticMessage` and `SubdiagnosticMessage` types are not required. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24macros: use typed identifiers in subdiag deriveDavid Wood-0/+21
As in the diagnostic derive, using typed identifiers in the subdiagnostic derive improves the diagnostics of using the subdiagnostic derive as Fluent messages will be confirmed to exist at compile-time. Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-21Migrate `builtin-macros-requires-cfg-pattern` to `SessionDiagnostic`beetrees-0/+1
2022-06-20Rollup merge of #97912 - Kixunil:stabilize_path_try_exists, r=dtolnayYuki Okushi-1/+0
Stabilize `Path::try_exists()` and improve doc This stabilizes the `Path::try_exists()` method which returns `Result<bool, io::Error>` instead of `bool` allowing handling of errors unrelated to the file not existing. (e.g permission errors) Along with the stabilization it also: * Warns that the `exists()` method is error-prone and suggests to use the newly stabilized one. * Suggests it instead of `metadata()` to handle errors. * Mentions TOCTOU bugs to avoid false assumption that `try_exists()` is completely safe fixed version of `exists()`. * Renames the feature of still-unstable `std::fs::try_exists()` to `fs_try_exists` to avoid name conflict. The tracking issue #83186 remains open to track `fs_try_exists`.
2022-06-16Move/rename `lazy::Sync{OnceCell,Lazy}` to `sync::{Once,Lazy}Lock`Maybe Waffle-1/+1
2022-06-16Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}`Maybe Waffle-1/+1
2022-06-14Stabilize `Path::try_exists()` and improve docMartin Habovstiak-1/+0
This stabilizes the `Path::try_exists()` method which returns `Result<bool, io::Error>` instead of `bool` allowing handling of errors unrelated to the file not existing. (e.g permission errors) Along with the stabilization it also: * Warns that the `exists()` method is error-prone and suggests to use the newly stabilized one. * Suggests it instead of `metadata()` to handle errors. * Mentions TOCTOU bugs to avoid false assumption that `try_exists()` is completely safe fixed version of `exists()`. * Renames the feature of still-unstable `std::fs::try_exists()` to `fs_try_exists` to avoid name conflict. The tracking issue #83186 remains open to track `fs_try_exists`.
2022-06-10lint: add diagnostic translation migration lintsDavid Wood-0/+3
Introduce allow-by-default lints for checking whether diagnostics are written in `SessionDiagnostic`/`AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-30errors: simplify referring to fluent attributesDavid Wood-6/+66
To render the message of a Fluent attribute, the identifier of the Fluent message must be known. `DiagnosticMessage::FluentIdentifier` contains both the message's identifier and optionally the identifier of an attribute. Generated constants for each attribute would therefore need to be named uniquely (amongst all error messages) or be able to refer to only the attribute identifier which will be combined with a message identifier later. In this commit, the latter strategy is implemented as part of the `Diagnostic` type's functions for adding subdiagnostics of various kinds. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-24macros: introduce `fluent_messages` macroDavid Wood-3/+8
Adds a new `fluent_messages` macro which performs compile-time validation of the compiler's Fluent resources (i.e. that the resources parse and don't multiply define the same messages) and generates constants that make using those messages in diagnostics more ergonomic. For example, given the following invocation of the macro.. ```ignore (rust) fluent_messages! { typeck => "./typeck.ftl", } ``` ..where `typeck.ftl` has the following contents.. ```fluent typeck-field-multiply-specified-in-initializer = field `{$ident}` specified more than once .label = used more than once .label-previous-use = first use of `{$ident}` ``` ...then the macro parse the Fluent resource, emitting a diagnostic if it fails to do so, and will generate the following code: ```ignore (rust) pub static DEFAULT_LOCALE_RESOURCES: &'static [&'static str] = &[ include_str!("./typeck.ftl"), ]; mod fluent_generated { mod typeck { pub const field_multiply_specified_in_initializer: DiagnosticMessage = DiagnosticMessage::fluent("typeck-field-multiply-specified-in-initializer"); pub const field_multiply_specified_in_initializer_label_previous_use: DiagnosticMessage = DiagnosticMessage::fluent_attr( "typeck-field-multiply-specified-in-initializer", "previous-use-label" ); } } ``` When emitting a diagnostic, the generated constants can be used as follows: ```ignore (rust) let mut err = sess.struct_span_err( span, fluent::typeck::field_multiply_specified_in_initializer ); err.span_default_label(span); err.span_label( previous_use_span, fluent::typeck::field_multiply_specified_in_initializer_label_previous_use ); err.emit(); ``` Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-19Rollup merge of #96029 - IsakNyberg:error-messages-fix, r=Dylan-DPCDylan DPC-8/+2
Refactor loop into iterator; simplify negation logic. is_dummy should return when a non-dummy is found, but instead is iterated until completion. With some inspiration from line 323 this was refactored to a single line that returns once a single counterexample is found.
2022-04-16Update compiler/rustc_error_messages/src/lib.rsIsak Nyberg-1/+1
Co-authored-by: Janusz Marcinkiewicz <virrages@gmail.com>
2022-04-14Refactor loop into iterator; simplify negation logic.Isak Nyberg-8/+2