about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
AgeCommit message (Collapse)AuthorLines
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-10-30Don't emit delayed good-path bugs on panicMichael Goulet-1/+1
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
2023-08-24Add comment to the push_trailing functionallaboutevemirolive-2/+16
2023-08-23Bump cfg(bootstrap)Mark Rousskov-1/+1
2023-08-18fixKyle Lin-1/+1
2023-08-18lint linksKyle Lin-3/+3
2023-08-04Auto merge of #114104 - oli-obk:syn2, r=compiler-errorsbors-192/+104
Lots of tiny incremental simplifications of `EmitterWriter` internals ignore the first commit, it's https://github.com/rust-lang/rust/pull/114088 squashed and rebased, but it's needed to use to use `derive_setters`, as they need a newer `syn` version. Then this PR starts out with removing many arguments that are almost always defaulted to `None` or `false` and replace them with builder methods that can set these fields in the few cases that want to set them. After that it's one commit after the other that removes or merges things until everything becomes some very simple trait objects
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-07-31Sanity check that we actually flush all buffersOli Scherer-0/+9
2023-07-31Get rid of the thin wrapper type that is `Destination` and just write to the ↵Oli Scherer-32/+19
`Writer` trait object directly
2023-07-31Turn a single-variant enum into a structOli Scherer-14/+6
2023-07-31Merge all `Destination` variantsOli Scherer-4/+1
2023-07-31Remove a now-redundant single-variant enumOli Scherer-43/+5
2023-07-31Move `WritableDst` method onto `Style` directlyOli Scherer-5/+8
2023-07-31Merge buffered destination into raw destinationOli Scherer-17/+37
2023-07-31Remove an enum variant that can be covered by anotherOli Scherer-6/+1
2023-07-31Remove a `bool` for color in favor of the `WriteColor` trait wrapping ↵Oli Scherer-18/+27
colored and uncolored printing
2023-07-31Use builder pattern instead of lots of arguments for `EmitterWriter::new`Oli Scherer-52/+13
2023-07-31Replace the many arguments of `EmitterWriter::stderr` with builder methodsOli Scherer-37/+14