about summary refs log tree commit diff
path: root/compiler/rustc_errors
AgeCommit message (Collapse)AuthorLines
2023-12-02Rename `HandlerInner::failure` as `HandlerInner::failure_note`.Nicholas Nethercote-4/+4
To match the `FailureNote` variant of `Level`.
2023-12-02Rename `Handler::span_note_diag` as `struct_span_note`.Nicholas Nethercote-1/+1
Because `span_note_diag` doesn't follow the naming structure used for the error reporting functions.
2023-12-02Remove an unnecessary local variable.Nicholas Nethercote-2/+1
2023-12-02Return `ErrorGuaranteed` from `span_err_with_code` methods.Nicholas Nethercote-2/+3
`ErrorGuaranteed` should be used for all error methods involving the `Error` level, e.g. as is done for the corresponding `span_err` methods.
2023-12-02Inline and remove `DiagnosticBuilder::new_diagnostic_fatal`.Nicholas Nethercote-9/+1
It has a single call site.
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-2/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-24Show number in error message even for one errorNilstrieb-1/+1
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-6/+6
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-21Auto merge of #115691 - jsgf:typed-json-diags, r=est31,dtolnaybors-30/+35
Add `$message_type` field to distinguish json diagnostic outputs Currently the json-formatted outputs have no way to unambiguously determine which kind of message is being output. A consumer can look for specific fields in the json object (eg "message"), but there's no guarantee that in future some other kind of output will have a field of the same name. This PR adds a `"type"` field to add json outputs which can be used to unambiguously determine which kind of output it is. The mapping is: `diagnostic`: regular compiler diagnostics `artifact`: artifact notifications `future_incompat`: Future incompatibility report `unused_extern`: Unused crate warnings/errors This matches the "internally tagged" representation for serde enums.
2023-11-20Update some more cases of "type" -> "$message_type"David Tolnay-1/+2
2023-11-19Remove unnecessary .collect()Esteban Küber-7/+7
2023-11-19Don't sort `span_suggestions`, leave that to callerEsteban Küber-6/+1
2023-11-19When encountering struct fn call literal with private fields, suggest all ↵Esteban Küber-4/+7
builders When encountering code like `Box(42)`, suggest `Box::new(42)` and *all* other associated functions that return `-> Box<T>`.
2023-11-15Bump cfg(bootstrap)sMark Rousskov-2/+2
2023-11-14Fix some typoscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-11-13Auto merge of #116866 - slanterns:inspect-stabilize, r=BurntSushibors-1/+0
Stabilize `result_option_inspect` This PR stabilizes `result_option_inspect`: ```rust // core::option impl Option<T> { pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self; } // core::result impl Result<T, E> { pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self; pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self; } ``` <br> Tracking issue: https://github.com/rust-lang/rust/issues/91345. Implementation PR: https://github.com/rust-lang/rust/pull/91346. Closes https://github.com/rust-lang/rust/issues/91345.
2023-11-08rustc: minor changes suggested by clippy perf lints.Nicholas Nethercote-5/+1
2023-11-01Rollup merge of #117397 - compiler-errors:dont-emit-good-path-on-panic, ↵Matthias Krüger-1/+1
r=TaKO8Ki Don't emit delayed good-path bugs on panic This should fix #117381, cc ``@RalfJung`` As opposed to delayed bugs, delayed *good path* bugs really don't make sense to show on panics.
2023-10-30Don't emit delayed good-path bugs on panicMichael Goulet-1/+1
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-12/+14
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-26Stash and cancel cycle errors for auto trait leakage in opaquesMichael Goulet-0/+2
2023-10-20Auto merge of #116962 - estebank:issue-63835, r=oli-obkbors-1/+8
Do not bold main message in `--error-format=short` Fix #63835. Before: <img width="484" alt="Screenshot 2023-10-19 at 3 52 53 PM" src="https://github.com/rust-lang/rust/assets/1606434/9bd6cbd5-a4ce-4cc3-8c5f-60a8d3ad38da"> After: <img width="492" alt="Screenshot 2023-10-19 at 3 52 32 PM" src="https://github.com/rust-lang/rust/assets/1606434/0cf2417a-08f2-4074-860c-a88a838a4209">
2023-10-19Do not bold main message in `--error-format=short`Esteban Küber-1/+8
Fix #63835.
2023-10-19Fix duplicate labels emitted in `render_multispan_macro_backtrace()`Gurinder Singh-4/+4
Using hash set instead of vec to weed out duplicates
2023-10-18Remove `#![feature(result_option_inspect)]` from the compilerSlanterns-1/+0
2023-10-16Rollup merge of #115196 - chenyukang:yukang-fix-86094, r=estebankMatthias Krüger-0/+1
Suggest adding `return` if the for semi which can coerce to the fn return type Fixes #86094 r? `@estebank`
2023-10-15Suggest adding `return` if the type of unused semi return value can coerce ↵yukang-0/+1
to the fn return type
2023-10-15Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstriebbors-15/+23
Format all the let-chains in compiler crates Since rust-lang/rustfmt#5910 has landed, soon we will have support for formatting let-chains (as soon as rustfmt syncs and beta gets bumped). This PR applies the changes [from master rustfmt to rust-lang/rust eagerly](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/out.20formatting.20of.20prs/near/374997516), so that the next beta bump does not have to deal with a 200+ file diff and can remain concerned with other things like `cfg(bootstrap)` -- #113637 was a pain to land, for example, because of let-else. I will also add this commit to the ignore list after it has landed. The commands that were run -- I'm not great at bash-foo, but this applies rustfmt to every compiler crate, and then reverts the two crates that should probably be formatted out-of-tree. ``` ~/rustfmt $ ls -1d ~/rust/compiler/* | xargs -I@ cargo run --bin rustfmt -- `@/src/lib.rs` --config-path ~/rust --edition=2021 # format all of the compiler crates ~/rust $ git checkout HEAD -- compiler/rustc_codegen_{gcc,cranelift} # revert changes to cg-gcc and cg-clif ``` cc `@rust-lang/rustfmt` r? `@WaffleLapkin` or `@Nilstrieb` who said they may be able to review this purely mechanical PR :> cc `@Mark-Simulacrum` and `@petrochenkov,` who had some thoughts on the order of operations with big formatting changes in https://github.com/rust-lang/rust/pull/95262#issue-1178993801. I think the situation has changed since then, given that let-chains support exists on master rustfmt now, and I'm fairly confident that this formatting PR should land even if *bootstrap* rustfmt doesn't yet format let-chains in order to lessen the burden of the next beta bump.
2023-10-13Use `$message_type` as the tagJeremy Fitzhardinge-1/+1
`type` turned out to be controversial.
2023-10-13Format all the let chains in compilerMichael Goulet-15/+23
2023-10-12check-cfg: only print the list of expected names onceUrgau-0/+1
2023-10-08rustdoc: remove rust logo from non-Rust cratesMichael Howell-0/+2
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-3/+8
2023-09-22Auto merge of #115690 - ShE3py:Z-treat-err-as-bug, r=petrochenkovbors-7/+5
Allow `-Z treat-err-as-bug=0` Makes `-Z treat-err-as-bug=0` behave as if the option wasn't present instead of asking the value to be &GreaterSlantEqual; 1. This enables a quick on/off of the option, as you only need to change one character instead of removing the whole `-Z`. Also update some text, e.g. ```bash $ rustc -Z help | grep treat-err-as-bug -Z treat-err-as-bug=val -- treat error number `val` that occurs as bug ``` where the value could be interpreted as an error code instead of an ordinal.
2023-09-22Allow `-Z treat-err-as-bug=0`Lieselotte-7/+5
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2023-09-22give FutureIncompatibilityReason variants more explicit namesRalf Jung-1/+7
2023-09-21Prevent promotion of const fn calls in inline constsOli Scherer-1/+1
2023-09-19Use serde_json::to_writer for JsonEmitter::emitJeremy Fitzhardinge-4/+5
Avoids an unnecessary intermediate string.
2023-09-19Make sure nested Diagnostics in FutureIncompat are also typed for consistency.Jeremy Fitzhardinge-7/+12
2023-09-19Add `type` field to json diagnostic outputsJeremy Fitzhardinge-24/+22
Currently the json-formatted outputs have no way to unambiguously determine which kind of message is being output. A consumer can look for specific fields in the json object (eg "message"), but there's no guarantee that in future some other kind of output will have a field of the same name. This PR adds a `"type"` field to add json outputs which can be used to unambiguously determine which kind of output it is. The mapping is: diagnostic: regular compiler diagnostics artifact: artifact notifications future_incompat: Report of future incompatibility unused_extern: Unused crate warnings/errors This matches the "internally tagged" representation for serde enums.
2023-09-15implement -Z ignore-directory-in-diagnostics-source-blocksPietro Albini-5/+39
2023-09-08Auto merge of #115418 - Zoxc:freeze-source, r=oli-obkbors-5/+5
Use `Freeze` for `SourceFile` This uses the `Freeze` type in `SourceFile` to let accessing `external_src` and `lines` be lock-free. Behavior of `add_external_src` is changed to set `ExternalSourceKind::AbsentErr` on a hash mismatch which matches the documentation. `ExternalSourceKind::Unneeded` was removed as it's unused. Based on https://github.com/rust-lang/rust/pull/115401.
2023-09-07Use `Freeze` for `SourceFile.external_src`John Kåre Alsaker-5/+5
2023-09-07Implement refinement lint for RPITITMichael Goulet-3/+3
2023-09-04Add OnceHelp lint level (same as OnceNote, except for help)Urgau-4/+14
2023-09-04Auto merge of #115513 - Urgau:normalize-msg-after-translate, r=petrochenkovbors-1/+7
Don't forget to normalize the translated message This PR adds a missing call to `normalize_whitespace` after translating an label. Fixes https://github.com/rust-lang/rust/issues/115498
2023-09-03Don't forget to normalize the translated messageUrgau-1/+7
2023-09-01Add comment so pub items are not removedChristian Legnitto-0/+2
As suggested in https://github.com/rust-lang/rust/pull/115393, add a comment so someone doesn't clean these up.
2023-08-30Make `termcolor` types public in `rustc_errors`Christian Legnitto-1/+1
After https://github.com/rust-lang/rust/pull/114104, `rust-gpu` is unable to create a custom `Emitter` as the bounds have changed to include `WriteColor`. I was able to work around this by adding `termcolor` as a direct dependency, but I believe this should be exposed as part of `rustc_errors` proper. See https://github.com/rust-lang/rust/pull/102992 for why `rust-gpu` needs to create a custom emitter.
2023-08-30Use conditional synchronization for LockJohn Kåre Alsaker-12/+14