diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-14 12:26:15 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-15 09:42:14 +1100 |
| commit | 19d28a4f28ad8125775e73e97e8bab2b2229f4e1 (patch) | |
| tree | 34cfe52e12dcd44dc07d7783903c866d8b3a5197 /compiler/rustc_errors/src | |
| parent | e3b7ecc1efc7170fe418e99e071598e7e14aebe1 (diff) | |
| download | rust-19d28a4f28ad8125775e73e97e8bab2b2229f4e1.tar.gz rust-19d28a4f28ad8125775e73e97e8bab2b2229f4e1.zip | |
Change `msg: impl Into<String>` for bug diagnostics.
To `msg: impl Into<DiagnosticMessage>`, like all the other diagnostics. For consistency.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 4093daba4b4..aae2910537a 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1033,7 +1033,7 @@ impl Handler { self.emit_diag_at_span(Diagnostic::new_with_code(Warning(None), Some(code), msg), span); } - pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<String>) -> ! { + pub fn span_bug(&self, span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! { self.inner.borrow_mut().span_bug(span, msg) } @@ -1045,7 +1045,7 @@ impl Handler { pub fn span_delayed_bug( &self, sp: impl Into<MultiSpan>, - msg: impl Into<String>, + msg: impl Into<DiagnosticMessage>, ) -> ErrorGuaranteed { let mut inner = self.inner.borrow_mut(); @@ -1056,10 +1056,10 @@ impl Handler { inner.err_count + inner.lint_err_count + inner.delayed_bug_count() + 1 >= c.get() }) { // FIXME: don't abort here if report_delayed_bugs is off - inner.span_bug(sp, msg.into()); + inner.span_bug(sp, msg); } - let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg.into()); - diagnostic.set_span(sp.into()); + let mut diagnostic = Diagnostic::new(Level::DelayedBug, msg); + diagnostic.set_span(sp); inner.emit_diagnostic(&mut diagnostic).unwrap() } @@ -1589,8 +1589,8 @@ impl HandlerInner { } #[track_caller] - fn span_bug(&mut self, sp: impl Into<MultiSpan>, msg: impl Into<String>) -> ! { - self.emit_diagnostic(Diagnostic::new(Bug, msg.into()).set_span(sp)); + fn span_bug(&mut self, sp: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>) -> ! { + self.emit_diagnostic(Diagnostic::new(Bug, msg).set_span(sp)); panic::panic_any(ExplicitBug); } |
