mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Make panic/assert calls in rustc compatible with Rust 2021.
This commit is contained in:
parent
a616f8267e
commit
34d5ac25c5
@ -28,7 +28,7 @@ pub trait ExpectOne<A: Array> {
|
||||
|
||||
impl<A: Array> ExpectOne<A> for SmallVec<A> {
|
||||
fn expect_one(self, err: &'static str) -> A::Item {
|
||||
assert!(self.len() == 1, err);
|
||||
assert!(self.len() == 1, "{}", err);
|
||||
self.into_iter().next().unwrap()
|
||||
}
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ impl HandlerInner {
|
||||
|
||||
fn span_bug(&mut self, sp: impl Into<MultiSpan>, msg: &str) -> ! {
|
||||
self.emit_diag_at_span(Diagnostic::new(Bug, msg), sp);
|
||||
panic!(ExplicitBug);
|
||||
panic::panic_any(ExplicitBug);
|
||||
}
|
||||
|
||||
fn emit_diag_at_span(&mut self, mut diag: Diagnostic, sp: impl Into<MultiSpan>) {
|
||||
@ -955,7 +955,7 @@ impl HandlerInner {
|
||||
|
||||
fn bug(&mut self, msg: &str) -> ! {
|
||||
self.emit_diagnostic(&Diagnostic::new(Bug, msg));
|
||||
panic!(ExplicitBug);
|
||||
panic::panic_any(ExplicitBug);
|
||||
}
|
||||
|
||||
fn delay_as_bug(&mut self, diagnostic: Diagnostic) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
use crate::ty::{tls, TyCtxt};
|
||||
use rustc_span::{MultiSpan, Span};
|
||||
use std::fmt;
|
||||
use std::panic::Location;
|
||||
use std::panic::{panic_any, Location};
|
||||
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
@ -32,7 +32,7 @@ fn opt_span_bug_fmt<S: Into<MultiSpan>>(
|
||||
match (tcx, span) {
|
||||
(Some(tcx), Some(span)) => tcx.sess.diagnostic().span_bug(span, &msg),
|
||||
(Some(tcx), None) => tcx.sess.diagnostic().bug(&msg),
|
||||
(None, _) => panic!(msg),
|
||||
(None, _) => panic_any(msg),
|
||||
}
|
||||
});
|
||||
unreachable!();
|
||||
|
Loading…
Reference in New Issue
Block a user