Skip to content

Commit 571e602

Browse files
committed
Auto merge of #119237 - compiler-errors:rollup-umyyu7d, r=compiler-errors
Rollup of 6 pull requests Successful merges: - #119012 (Extract `layout_of_{struct,enum}` fn) - #119077 (Separate MIR lints from validation) - #119171 (Cleanup error handlers: round 4) - #119198 (Split coroutine desugaring kind from source) - #119222 (Add `IntoAsyncIterator`) - #119230 (Exhaustiveness: clean up after librarification) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f6fda20 + 8db883f commit 571e602

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/diagnostics.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::num::NonZeroU64;
33

44
use log::trace;
55

6-
use rustc_errors::DiagnosticMessage;
6+
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, Level};
77
use rustc_span::{SpanData, Symbol, DUMMY_SP};
88
use rustc_target::abi::{Align, Size};
99

@@ -453,11 +453,13 @@ pub fn report_msg<'tcx>(
453453
) {
454454
let span = stacktrace.first().map_or(DUMMY_SP, |fi| fi.span);
455455
let sess = machine.tcx.sess;
456-
let mut err = match diag_level {
457-
DiagLevel::Error => sess.struct_span_err(span, title).forget_guarantee(),
458-
DiagLevel::Warning => sess.struct_span_warn(span, title),
459-
DiagLevel::Note => sess.dcx().struct_span_note(span, title),
456+
let level = match diag_level {
457+
DiagLevel::Error => Level::Error { lint: false },
458+
DiagLevel::Warning => Level::Warning(None),
459+
DiagLevel::Note => Level::Note,
460460
};
461+
let mut err = DiagnosticBuilder::<()>::new(sess.dcx(), level, title);
462+
err.set_span(span);
461463

462464
// Show main message.
463465
if span != DUMMY_SP {

0 commit comments

Comments
 (0)