mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Cleanup error variants in MIR code slightly
This commit is contained in:
parent
8a5829cf28
commit
5860763f18
17 changed files with 598 additions and 434 deletions
|
@ -28,7 +28,7 @@
|
|||
//! env: option
|
||||
//! eq: sized
|
||||
//! error: fmt
|
||||
//! fmt: result, transmute, coerce_unsized
|
||||
//! fmt: option, result, transmute, coerce_unsized
|
||||
//! fn:
|
||||
//! from: sized
|
||||
//! future: pin
|
||||
|
@ -987,6 +987,10 @@ pub mod fmt {
|
|||
Arguments { pieces, fmt: None, args }
|
||||
}
|
||||
|
||||
pub const fn new_const(pieces: &'a [&'static str]) -> Arguments<'a> {
|
||||
Arguments { pieces, fmt: None, args: &[] }
|
||||
}
|
||||
|
||||
pub fn new_v1_formatted(
|
||||
pieces: &'a [&'static str],
|
||||
args: &'a [rt::Argument<'a>],
|
||||
|
@ -1346,6 +1350,9 @@ pub mod iter {
|
|||
// region:panic
|
||||
mod panic {
|
||||
pub macro panic_2021 {
|
||||
() => (
|
||||
$crate::panicking::panic("explicit panic")
|
||||
),
|
||||
($($t:tt)+) => (
|
||||
$crate::panicking::panic_fmt($crate::const_format_args!($($t)+))
|
||||
),
|
||||
|
@ -1357,6 +1364,11 @@ mod panicking {
|
|||
pub const fn panic_fmt(_fmt: crate::fmt::Arguments<'_>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[lang = "panic"]
|
||||
pub const fn panic(expr: &'static str) -> ! {
|
||||
panic_fmt(crate::fmt::Arguments::new_const(&[expr]))
|
||||
}
|
||||
}
|
||||
// endregion:panic
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue