Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aca631f
Increase visibility of `join_path` and `split_paths`
tgross35 Jan 8, 2024
0de3677
Fix typo
joshtriplett Feb 11, 2024
75a4fa1
Suggest moving if non-found macro_rules! is defined later
chenyukang Feb 15, 2024
5d59d0c
have `String` use `SliceIndex` impls from `str`
pitaj Jan 24, 2024
11f9489
Changing some attributes to only_local.
surechen Feb 28, 2024
75e15f7
Deeply normalize obligations in refining_impl_trait
compiler-errors Feb 28, 2024
5512945
Implement unwind safety for Condvar
ecton Feb 28, 2024
3fbdec4
Add a comment about how `IntoDiagnostic` should be impl'd.
nnethercote Feb 27, 2024
199be46
Refactor `DiagCtxtInner::flush_delayed`.
nnethercote Feb 27, 2024
9dfe5ef
Fix typo in `rustc_passes/messages.ftl`
sisungo Feb 29, 2024
9c6a076
document potential memory leak in unbounded channel
ibraheemdev Feb 29, 2024
1850ba7
Remove unused diagnostic struct
mu001999 Feb 29, 2024
7c9fa95
fix typos
ibraheemdev Feb 29, 2024
da37c8f
Fix tests that are affected by this change
sisungo Feb 29, 2024
ad4c932
Restore the standard library review rotation to its former glory
Amanieu Feb 28, 2024
2978c98
Rollup merge of #119748 - tgross35:suggest-path-split, r=Amanieu
jhpratt Feb 29, 2024
7b29e65
Rollup merge of #120291 - pitaj:string-sliceindex, r=Amanieu
jhpratt Feb 29, 2024
032f19d
Rollup merge of #121130 - chenyukang:yukang-fix-121061-macro-later, r…
jhpratt Feb 29, 2024
cecc2a4
Rollup merge of #121723 - nnethercote:two-diagnostic-things, r=oli-obk
jhpratt Feb 29, 2024
4010270
Rollup merge of #121740 - surechen:change_attribute_to_local_20240228…
jhpratt Feb 29, 2024
d9becfb
Rollup merge of #121745 - compiler-errors:refining-impl-trait-deeply-…
jhpratt Feb 29, 2024
ccb2cb8
Rollup merge of #121748 - Amanieu:restore-libs-rotation, r=Amanieu
jhpratt Feb 29, 2024
f0e5863
Rollup merge of #121768 - ecton:condvar-unwindsafe, r=m-ou-se
jhpratt Feb 29, 2024
3b15e6b
Rollup merge of #121777 - sisungo:master, r=oli-obk
jhpratt Feb 29, 2024
e392b48
Rollup merge of #121778 - ibraheemdev:patch-19, r=RalfJung
jhpratt Feb 29, 2024
f8b3fbc
Rollup merge of #121779 - mu001999:clean, r=Nilstrieb
jhpratt Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor DiagCtxtInner::flush_delayed.
This commit:
- Moves the ICE file create/open outside the loop. (Redoing it on every
  loop iteration works, but is really weird.)
- Moves the explanatory note emission above the loop, which removes the
  need for the `enumerate` call.
- Introduces a `decorate` local.
  • Loading branch information
nnethercote committed Feb 29, 2024
commit 199be469ec37b30c876069762e20f531f1f12f22
42 changes: 21 additions & 21 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,14 +1498,26 @@ impl DiagCtxtInner {
let bugs: Vec<_> =
std::mem::take(&mut self.delayed_bugs).into_iter().map(|(b, _)| b).collect();

// If backtraces are enabled, also print the query stack
let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0");
for (i, bug) in bugs.into_iter().enumerate() {
if let Some(file) = self.ice_file.as_ref()
&& let Ok(mut out) = std::fs::File::options().create(true).append(true).open(file)
{
let _ = write!(
&mut out,
let decorate = backtrace || self.ice_file.is_none();
let mut out = self
.ice_file
.as_ref()
.and_then(|file| std::fs::File::options().create(true).append(true).open(file).ok());

// Put the overall explanation before the `DelayedBug`s, to frame them
// better (e.g. separate warnings from them). Also, use notes, which
// don't count as errors, to avoid possibly triggering
// `-Ztreat-err-as-bug`, which we don't want.
let note1 = "no errors encountered even though delayed bugs were created";
let note2 = "those delayed bugs will now be shown as internal compiler errors";
self.emit_diagnostic(DiagInner::new(Note, note1));
self.emit_diagnostic(DiagInner::new(Note, note2));

for bug in bugs {
if let Some(out) = &mut out {
_ = write!(
out,
"delayed bug: {}\n{}\n",
bug.inner
.messages
Expand All @@ -1516,21 +1528,9 @@ impl DiagCtxtInner {
);
}

if i == 0 {
// Put the overall explanation before the `DelayedBug`s, to
// frame them better (e.g. separate warnings from them). Also,
// make it a note so it doesn't count as an error, because that
// could trigger `-Ztreat-err-as-bug`, which we don't want.
let note1 = "no errors encountered even though delayed bugs were created";
let note2 = "those delayed bugs will now be shown as internal compiler errors";
self.emit_diagnostic(DiagInner::new(Note, note1));
self.emit_diagnostic(DiagInner::new(Note, note2));
}

let mut bug =
if backtrace || self.ice_file.is_none() { bug.decorate(self) } else { bug.inner };
let mut bug = if decorate { bug.decorate(self) } else { bug.inner };

// "Undelay" the delayed bugs (into plain `Bug`s).
// "Undelay" the delayed bugs into plain bugs.
if bug.level != DelayedBug {
// NOTE(eddyb) not panicking here because we're already producing
// an ICE, and the more information the merrier.
Expand Down