From a24d556f6699944175bae065a6ee7aef300750a1 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Fri, 17 Dec 2021 21:52:22 +0800 Subject: [PATCH 1/4] Add const-stability to `panicking::panic_*` fns This allows us to use `panic!` and friends in a const-stable context within libcore. --- library/core/src/lib.rs | 1 + library/core/src/panicking.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 67f77f14a6e6b..32a5fd9c4811a 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -141,6 +141,7 @@ #![feature(const_type_id)] #![feature(const_type_name)] #![feature(const_default_impls)] +#![feature(core_panic)] #![feature(duration_consts_float)] #![feature(maybe_uninit_uninit_array)] #![feature(ptr_metadata)] diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index eedea6562bd4d..ccb82cda54ef7 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -51,6 +51,7 @@ pub const fn panic(expr: &'static str) -> ! { #[inline] #[track_caller] #[lang = "panic_str"] // needed for `non-fmt-panics` lint +#[rustc_const_unstable(feature = "core_panic", issue = "none")] pub const fn panic_str(expr: &str) -> ! { panic_display(&expr); } @@ -59,6 +60,7 @@ pub const fn panic_str(expr: &str) -> ! { #[track_caller] #[lang = "panic_display"] // needed for const-evaluated panics #[rustc_do_not_const_check] // hooked by const-eval +#[rustc_const_unstable(feature = "core_panic", issue = "none")] pub const fn panic_display(x: &T) -> ! { panic_fmt(format_args!("{}", *x)); } @@ -89,6 +91,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { #[track_caller] #[lang = "panic_fmt"] // needed for const-evaluated panics #[rustc_do_not_const_check] // hooked by const-eval +#[rustc_const_unstable(feature = "core_panic", issue = "none")] pub const fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! { if cfg!(feature = "panic_immediate_abort") { super::intrinsics::abort() @@ -109,6 +112,7 @@ pub const fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! { /// This function is used instead of panic_fmt in const eval. #[lang = "const_panic_fmt"] +#[rustc_const_unstable(feature = "core_panic", issue = "none")] pub const fn const_panic_fmt(fmt: fmt::Arguments<'_>) -> ! { if let Some(msg) = fmt.as_str() { panic_str(msg); From 4392c5da5307c85edfe17b437226d1820b10b9b4 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Fri, 17 Dec 2021 21:53:28 +0800 Subject: [PATCH 2/4] Switch all libraries to the 2021 edition --- library/alloc/Cargo.toml | 2 +- library/core/Cargo.toml | 2 +- library/core/src/array/mod.rs | 2 -- library/core/src/convert/mod.rs | 4 --- library/core/src/iter/traits/collect.rs | 6 ---- library/core/src/iter/traits/iterator.rs | 4 --- library/core/src/num/int_macros.rs | 6 ---- library/core/src/num/uint_macros.rs | 6 ---- library/panic_abort/Cargo.toml | 2 +- library/panic_unwind/Cargo.toml | 2 +- library/proc_macro/Cargo.toml | 2 +- library/profiler_builtins/Cargo.toml | 2 +- library/rustc-std-workspace-alloc/Cargo.toml | 2 +- library/rustc-std-workspace-core/Cargo.toml | 2 +- library/rustc-std-workspace-std/Cargo.toml | 2 +- library/test/Cargo.toml | 2 +- library/unwind/Cargo.toml | 2 +- src/tools/tidy/src/edition.rs | 33 +++++--------------- 18 files changed, 18 insertions(+), 65 deletions(-) diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml index b3ff0fd0a313c..265020209eb12 100644 --- a/library/alloc/Cargo.toml +++ b/library/alloc/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/rust-lang/rust.git" description = "The Rust core allocation and collections library" autotests = false autobenches = false -edition = "2018" +edition = "2021" [dependencies] core = { path = "../core" } diff --git a/library/core/Cargo.toml b/library/core/Cargo.toml index 6f10b9e434290..6bc4ba3cc0edf 100644 --- a/library/core/Cargo.toml +++ b/library/core/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/rust-lang/rust.git" description = "The Rust Core Library" autotests = false autobenches = false -edition = "2018" +edition = "2021" [lib] test = false diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 37292bf8e2624..121aa634deb33 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -66,8 +66,6 @@ where /// /// ```rust /// #![feature(array_from_fn)] -/// # // Apparently these doc tests are still on edition2018 -/// # use std::convert::TryInto; /// /// let array: Result<[u8; 5], _> = std::array::try_from_fn(|i| i.try_into()); /// assert_eq!(array, Ok([0, 1, 2, 3, 4])); diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 1c2e673d60493..d40f69f8b3574 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -426,8 +426,6 @@ pub trait TryInto: Sized { /// `TryFrom` can be implemented as follows: /// /// ``` -/// use std::convert::TryFrom; -/// /// struct GreaterThanZero(i32); /// /// impl TryFrom for GreaterThanZero { @@ -448,8 +446,6 @@ pub trait TryInto: Sized { /// As described, [`i32`] implements `TryFrom<`[`i64`]`>`: /// /// ``` -/// use std::convert::TryFrom; -/// /// let big_number = 1_000_000_000_000i64; /// // Silently truncates `big_number`, requires detecting /// // and handling the truncation after the fact. diff --git a/library/core/src/iter/traits/collect.rs b/library/core/src/iter/traits/collect.rs index 56fad602cf9c8..26c97b8ed785d 100644 --- a/library/core/src/iter/traits/collect.rs +++ b/library/core/src/iter/traits/collect.rs @@ -15,8 +15,6 @@ /// Basic usage: /// /// ``` -/// use std::iter::FromIterator; -/// /// let five_fives = std::iter::repeat(5).take(5); /// /// let v = Vec::from_iter(five_fives); @@ -37,8 +35,6 @@ /// Implementing `FromIterator` for your type: /// /// ``` -/// use std::iter::FromIterator; -/// /// // A sample collection, that's just a wrapper over Vec /// #[derive(Debug)] /// struct MyCollection(Vec); @@ -102,8 +98,6 @@ pub trait FromIterator: Sized { /// Basic usage: /// /// ``` - /// use std::iter::FromIterator; - /// /// let five_fives = std::iter::repeat(5).take(5); /// /// let v = Vec::from_iter(five_fives); diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 9a9a844f41bb4..2049adafa2fed 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -1155,8 +1155,6 @@ pub trait Iterator { /// Stopping after an initial [`None`]: /// /// ``` - /// use std::convert::TryFrom; - /// /// let a = [0, 1, 2, -3, 4, 5, -6]; /// /// let iter = a.iter().map_while(|x| u32::try_from(*x).ok()); @@ -1172,8 +1170,6 @@ pub trait Iterator { /// removed: /// /// ``` - /// use std::convert::TryFrom; - /// /// let a = [1, 2, -3, 4]; /// let mut iter = a.iter(); /// diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 9a668d34b6278..47641a9ed5405 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -2602,8 +2602,6 @@ macro_rules! int_impl { /// When starting from a slice rather than an array, fallible conversion APIs can be used: /// /// ``` - /// use std::convert::TryInto; - /// #[doc = concat!("fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {")] #[doc = concat!(" let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());")] /// *input = rest; @@ -2633,8 +2631,6 @@ macro_rules! int_impl { /// When starting from a slice rather than an array, fallible conversion APIs can be used: /// /// ``` - /// use std::convert::TryInto; - /// #[doc = concat!("fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {")] #[doc = concat!(" let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());")] /// *input = rest; @@ -2675,8 +2671,6 @@ macro_rules! int_impl { /// When starting from a slice rather than an array, fallible conversion APIs can be used: /// /// ``` - /// use std::convert::TryInto; - /// #[doc = concat!("fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {")] #[doc = concat!(" let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());")] /// *input = rest; diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 054b814b7e08e..3aa05a0c6042a 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -2323,8 +2323,6 @@ macro_rules! uint_impl { /// When starting from a slice rather than an array, fallible conversion APIs can be used: /// /// ``` - /// use std::convert::TryInto; - /// #[doc = concat!("fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {")] #[doc = concat!(" let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());")] /// *input = rest; @@ -2354,8 +2352,6 @@ macro_rules! uint_impl { /// When starting from a slice rather than an array, fallible conversion APIs can be used: /// /// ``` - /// use std::convert::TryInto; - /// #[doc = concat!("fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {")] #[doc = concat!(" let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());")] /// *input = rest; @@ -2396,8 +2392,6 @@ macro_rules! uint_impl { /// When starting from a slice rather than an array, fallible conversion APIs can be used: /// /// ``` - /// use std::convert::TryInto; - /// #[doc = concat!("fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {")] #[doc = concat!(" let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());")] /// *input = rest; diff --git a/library/panic_abort/Cargo.toml b/library/panic_abort/Cargo.toml index 6dec0e674975c..46183d1ad0066 100644 --- a/library/panic_abort/Cargo.toml +++ b/library/panic_abort/Cargo.toml @@ -4,7 +4,7 @@ version = "0.0.0" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/rust.git" description = "Implementation of Rust panics via process aborts" -edition = "2018" +edition = "2021" [lib] test = false diff --git a/library/panic_unwind/Cargo.toml b/library/panic_unwind/Cargo.toml index 67405463aa66a..d720cc7bcbdf1 100644 --- a/library/panic_unwind/Cargo.toml +++ b/library/panic_unwind/Cargo.toml @@ -4,7 +4,7 @@ version = "0.0.0" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/rust.git" description = "Implementation of Rust panics via stack unwinding" -edition = "2018" +edition = "2021" [lib] test = false diff --git a/library/proc_macro/Cargo.toml b/library/proc_macro/Cargo.toml index faf460e32bd87..db5e2e4e245ea 100644 --- a/library/proc_macro/Cargo.toml +++ b/library/proc_macro/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "proc_macro" version = "0.0.0" -edition = "2018" +edition = "2021" [dependencies] std = { path = "../std" } diff --git a/library/profiler_builtins/Cargo.toml b/library/profiler_builtins/Cargo.toml index 0f7f0067652f6..3371dfa124253 100644 --- a/library/profiler_builtins/Cargo.toml +++ b/library/profiler_builtins/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "profiler_builtins" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] test = false diff --git a/library/rustc-std-workspace-alloc/Cargo.toml b/library/rustc-std-workspace-alloc/Cargo.toml index 1ea421834a7d5..049ca3e46b57d 100644 --- a/library/rustc-std-workspace-alloc/Cargo.toml +++ b/library/rustc-std-workspace-alloc/Cargo.toml @@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0' description = """ Hack for the compiler's own build system """ -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/library/rustc-std-workspace-core/Cargo.toml b/library/rustc-std-workspace-core/Cargo.toml index 01e8b92e14941..ff5cfcbd64144 100644 --- a/library/rustc-std-workspace-core/Cargo.toml +++ b/library/rustc-std-workspace-core/Cargo.toml @@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0' description = """ Hack for the compiler's own build system """ -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/library/rustc-std-workspace-std/Cargo.toml b/library/rustc-std-workspace-std/Cargo.toml index 811bc78d21016..3a1dc2a02b557 100644 --- a/library/rustc-std-workspace-std/Cargo.toml +++ b/library/rustc-std-workspace-std/Cargo.toml @@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0' description = """ Hack for the compiler's own build system """ -edition = "2018" +edition = "2021" [lib] path = "lib.rs" diff --git a/library/test/Cargo.toml b/library/test/Cargo.toml index 04dab6b804acc..2da41484ca564 100644 --- a/library/test/Cargo.toml +++ b/library/test/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "test" version = "0.0.0" -edition = "2018" +edition = "2021" [lib] crate-type = ["dylib", "rlib"] diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml index 1941f2b5a0026..69fce8d7795c1 100644 --- a/library/unwind/Cargo.toml +++ b/library/unwind/Cargo.toml @@ -3,7 +3,7 @@ name = "unwind" version = "0.0.0" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/rust.git" -edition = "2018" +edition = "2021" include = [ '/libunwind/*', ] diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs index f610dbd806aea..b0abee459869c 100644 --- a/src/tools/tidy/src/edition.rs +++ b/src/tools/tidy/src/edition.rs @@ -2,11 +2,6 @@ use std::path::Path; -fn is_edition_2018(mut line: &str) -> bool { - line = line.trim(); - line == "edition = \"2018\"" -} - fn is_edition_2021(mut line: &str) -> bool { line = line.trim(); line == "edition = \"2021\"" @@ -23,27 +18,13 @@ pub fn check(path: &Path, bad: &mut bool) { return; } - // Not all library crates are ready to migrate to 2021. - if file.components().any(|c| c.as_os_str() == "library") - && file.components().all(|c| c.as_os_str() != "std") - { - let has = contents.lines().any(is_edition_2018); - if !has { - tidy_error!( - bad, - "{} doesn't have `edition = \"2018\"` on a separate line", - file.display() - ); - } - } else { - let is_2021 = contents.lines().any(is_edition_2021); - if !is_2021 { - tidy_error!( - bad, - "{} doesn't have `edition = \"2021\"` on a separate line", - file.display() - ); - } + let is_2021 = contents.lines().any(is_edition_2021); + if !is_2021 { + tidy_error!( + bad, + "{} doesn't have `edition = \"2021\"` on a separate line", + file.display() + ); } }, ); From e04848e24199be0fd86c1c218baffb1295a60845 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sun, 19 Dec 2021 01:55:37 +0800 Subject: [PATCH 3/4] Bless a few tests --- library/alloc/src/vec/mod.rs | 3 - ...76432.test.SimplifyComparisonIntegral.diff | 75 ++++++++++++++++--- ...ue_59352.num_to_digit.PreCodegen.after.mir | 63 +++++----------- .../ui/consts/const-eval/const_panic.stderr | 8 +- .../consts/const-eval/const_panic_2021.stderr | 8 +- .../const-eval/const_panic_libcore_bin.stderr | 4 +- .../issue-87258_a.stderr | 2 +- .../issue-87258_b.stderr | 2 +- src/test/ui/proc-macro/quote-debug.stdout | 8 +- 9 files changed, 102 insertions(+), 71 deletions(-) diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index d24b4bdffdefc..237eeb1dbbdec 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -3009,14 +3009,12 @@ impl TryFrom> for [T; N] { /// # Examples /// /// ``` - /// use std::convert::TryInto; /// assert_eq!(vec![1, 2, 3].try_into(), Ok([1, 2, 3])); /// assert_eq!(>::new().try_into(), Ok([])); /// ``` /// /// If the length doesn't match, the input comes back in `Err`: /// ``` - /// use std::convert::TryInto; /// let r: Result<[i32; 4], _> = (0..10).collect::>().try_into(); /// assert_eq!(r, Err(vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9])); /// ``` @@ -3024,7 +3022,6 @@ impl TryFrom> for [T; N] { /// If you're fine with just getting a prefix of the `Vec`, /// you can call [`.truncate(N)`](Vec::truncate) first. /// ``` - /// use std::convert::TryInto; /// let mut v = String::from("hello world").into_bytes(); /// v.sort(); /// v.truncate(2); diff --git a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff index 97c549dc9c8ae..30c547b86ceb7 100644 --- a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff @@ -22,17 +22,33 @@ let mut _20: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 let mut _21: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 let mut _22: !; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _23: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:7:19: 7:29 + let mut _23: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _24: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: &[&str; 1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _26: &[&str; 1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _27: [&str; 1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _28: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _29: &[std::fmt::ArgumentV1; 0]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let _30: &[std::fmt::ArgumentV1; 0]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let _31: [std::fmt::ArgumentV1; 0]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _32: (); // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _36: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:7:19: 7:29 scope 1 { debug v => _2; // in scope 1 at $DIR/issue_76432.rs:7:9: 7:10 let _13: &T; // in scope 1 at $DIR/issue_76432.rs:9:10: 9:16 let _14: &T; // in scope 1 at $DIR/issue_76432.rs:9:18: 9:24 let _15: &T; // in scope 1 at $DIR/issue_76432.rs:9:26: 9:32 + let _33: (); // in scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _34: &[std::fmt::ArgumentV1; 0]; // in scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _35: &[&str; 1]; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 2 { debug v1 => _13; // in scope 2 at $DIR/issue_76432.rs:9:10: 9:16 debug v2 => _14; // in scope 2 at $DIR/issue_76432.rs:9:18: 9:24 debug v3 => _15; // in scope 2 at $DIR/issue_76432.rs:9:26: 9:32 } + scope 3 { + debug _args => _33; // in scope 3 at $SRC_DIR/core/src/panic.rs:LL:COL + } } bb0: { @@ -52,14 +68,14 @@ StorageDead(_6); // scope 0 at $DIR/issue_76432.rs:7:28: 7:29 _4 = &_5; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 _3 = _4; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 - StorageLive(_23); // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 - _23 = _3; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 + StorageLive(_36); // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 + _36 = _3; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 _2 = move _3 as &[T] (Pointer(Unsize)); // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 StorageDead(_3); // scope 0 at $DIR/issue_76432.rs:7:28: 7:29 StorageDead(_4); // scope 0 at $DIR/issue_76432.rs:7:29: 7:30 StorageLive(_9); // scope 1 at $DIR/issue_76432.rs:8:5: 11:6 _10 = const 3_usize; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 - StorageDead(_23); // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 + StorageDead(_36); // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 _11 = const 3_usize; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 _12 = const true; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 goto -> bb2; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 @@ -67,16 +83,44 @@ bb1: { StorageLive(_22); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar()) } + StorageLive(_23); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageLive(_24); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _35 = const test::::promoted[1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const - // + ty: &str - // + val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) + // + ty: &[&str; 1] + // + val: Unevaluated(test, [T], Some(promoted[1])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) } + // + literal: Const { ty: &[&str; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ issue_76432[HASH]::test), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) } + _26 = _35; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = _26; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = move _25 as &[&str] (Pointer(Unsize)); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageLive(_29); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageLive(_30); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageLive(_32); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageLive(_33); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + nop; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageDead(_33); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + _34 = const test::::promoted[0]; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + // ty::Const + // + ty: &[std::fmt::ArgumentV1; 0] + // + val: Unevaluated(test, [T], Some(promoted[0])) + // mir::Constant + // + span: $SRC_DIR/core/src/panic.rs:LL:COL + // + literal: Const { ty: &[std::fmt::ArgumentV1; 0], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ issue_76432[HASH]::test), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) } + _30 = _34; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + _29 = _30; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + _28 = move _29 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageDead(_29); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + _23 = Arguments::new_v1(move _24, move _28) -> bb3; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/panic.rs:LL:COL + // + user_ty: UserType(5) + // + literal: Const { ty: fn(&[&'static str], &[std::fmt::ArgumentV1]) -> std::fmt::Arguments {std::fmt::Arguments::new_v1}, val: Value(Scalar()) } } bb2: { @@ -114,5 +158,14 @@ StorageDead(_2); // scope 0 at $DIR/issue_76432.rs:12:1: 12:2 return; // scope 0 at $DIR/issue_76432.rs:12:2: 12:2 } + + bb3: { + StorageDead(_28); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageDead(_24); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + panic_fmt(move _23); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/panic.rs:LL:COL + // + literal: Const { ty: for<'r> fn(std::fmt::Arguments<'r>) -> ! {std::rt::panic_fmt}, val: Value(Scalar()) } + } } diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index d028f0b989a68..2bbc882103108 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -7,7 +7,7 @@ fn num_to_digit(_1: char) -> u32 { let mut _3: std::option::Option; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:41 let mut _4: char; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29 let mut _5: u32; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - let mut _11: isize; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + let mut _10: isize; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23 debug self => _2; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 debug radix => _5; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 @@ -19,13 +19,6 @@ fn num_to_digit(_1: char) -> u32 { let mut _9: isize; // in scope 2 at $DIR/issue-59352.rs:14:8: 14:23 } } - scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50 - debug self => _3; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - let mut _10: isize; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - scope 4 { - debug val => _0; // in scope 4 at $DIR/issue-59352.rs:14:26: 14:50 - } - } bb0: { StorageLive(_2); // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 @@ -36,14 +29,14 @@ fn num_to_digit(_1: char) -> u32 { StorageLive(_7); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_8); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 _8 = _2; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb6; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 // mir::Constant // + span: $DIR/issue-59352.rs:14:8: 14:23 // + literal: Const { ty: fn(char, u32) -> std::option::Option {std::char::methods::::to_digit}, val: Value(Scalar()) } } bb1: { - StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_3); // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 StorageLive(_4); // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 _4 = _1; // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 @@ -55,57 +48,39 @@ fn num_to_digit(_1: char) -> u32 { bb2: { StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:14:40: 14:41 - StorageLive(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 - _10 = discriminant(_3); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + _0 = Option::::unwrap(move _3) -> bb3; // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 + // mir::Constant + // + span: $DIR/issue-59352.rs:14:42: 14:48 + // + literal: Const { ty: fn(std::option::Option) -> u32 {std::option::Option::::unwrap}, val: Value(Scalar()) } } bb3: { - StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 - goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 + goto -> bb5; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } bb4: { - return; // scope 0 at $DIR/issue-59352.rs:15:2: 15:2 + StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 + goto -> bb5; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } bb5: { + return; // scope 0 at $DIR/issue-59352.rs:15:2: 15:2 + } + + bb6: { _6 = &_7; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_8); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_9); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 _9 = discriminant((*_6)); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 - StorageLive(_11); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 - _11 = move _9; // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_10); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + _10 = move _9; // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_9); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_6); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_7); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_2); // scope 0 at $DIR/issue-59352.rs:14:22: 14:23 - switchInt(move _11) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - } - - bb6: { - core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - // mir::Constant - // + span: $DIR/issue-59352.rs:14:26: 14:50 - // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar()) } - // ty::Const - // + ty: &str - // + val: Value(Slice { data: Allocation { bytes: [99, 97, 108, 108, 101, 100, 32, 96, 79, 112, 116, 105, 111, 110, 58, 58, 117, 110, 119, 114, 97, 112, 40, 41, 96, 32, 111, 110, 32, 97, 32, 96, 78, 111, 110, 101, 96, 32, 118, 97, 108, 117, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [8796093022207], len: Size { raw: 43 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 43 }) - // mir::Constant - // + span: $DIR/issue-59352.rs:14:26: 14:50 - // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [99, 97, 108, 108, 101, 100, 32, 96, 79, 112, 116, 105, 111, 110, 58, 58, 117, 110, 119, 114, 97, 112, 40, 41, 96, 32, 111, 110, 32, 97, 32, 96, 78, 111, 110, 101, 96, 32, 118, 97, 108, 117, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [8796093022207], len: Size { raw: 43 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 43 }) } - } - - bb7: { - unreachable; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - } - - bb8: { - _0 = move ((_3 as Some).0: u32); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 - StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 - goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + switchInt(move _10) -> [1_isize: bb1, otherwise: bb4]; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 } } diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr index 3932c2bc0ac73..59eaa098cfe94 100644 --- a/src/test/ui/consts/const-eval/const_panic.stderr +++ b/src/test/ui/consts/const-eval/const_panic.stderr @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:12:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:15:15 @@ -28,7 +28,7 @@ error[E0080]: evaluation of constant value failed LL | const X: () = std::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:15:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:18:15 @@ -68,7 +68,7 @@ error[E0080]: evaluation of constant value failed LL | const Y_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:30:20 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:33:20 @@ -76,7 +76,7 @@ error[E0080]: evaluation of constant value failed LL | const X_CORE: () = core::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:33:20 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:36:20 diff --git a/src/test/ui/consts/const-eval/const_panic_2021.stderr b/src/test/ui/consts/const-eval/const_panic_2021.stderr index 975a07e2b0efa..f59fae29a467d 100644 --- a/src/test/ui/consts/const-eval/const_panic_2021.stderr +++ b/src/test/ui/consts/const-eval/const_panic_2021.stderr @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const C: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:12:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:15:15 @@ -28,7 +28,7 @@ error[E0080]: evaluation of constant value failed LL | const D: () = std::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:15:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:18:15 @@ -60,7 +60,7 @@ error[E0080]: evaluation of constant value failed LL | const C_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:27:20 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:30:20 @@ -68,7 +68,7 @@ error[E0080]: evaluation of constant value failed LL | const D_CORE: () = core::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:30:20 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:33:20 diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr index b3fa38241a4ef..0a747dc905874 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr @@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:11:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:14:15 @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const X: () = unimplemented!(); | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:14:15 | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/generic-associated-types/issue-87258_a.stderr b/src/test/ui/generic-associated-types/issue-87258_a.stderr index 93513a4563f07..f9f6616ba4565 100644 --- a/src/test/ui/generic-associated-types/issue-87258_a.stderr +++ b/src/test/ui/generic-associated-types/issue-87258_a.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea LL | fn foo<'a>() -> Self::FooFuture<'a> { | ^^^^^^^^^^^^^^^^^^^ | - = note: hidden type `Struct<'_>` captures lifetime '_#7r + = note: hidden type `Struct<'_>` captures lifetime '_#38r error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-87258_b.stderr b/src/test/ui/generic-associated-types/issue-87258_b.stderr index e077a423400df..bfef92ee0410d 100644 --- a/src/test/ui/generic-associated-types/issue-87258_b.stderr +++ b/src/test/ui/generic-associated-types/issue-87258_b.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea LL | fn foo<'a>() -> Self::FooFuture<'a> { | ^^^^^^^^^^^^^^^^^^^ | - = note: hidden type `Struct<'_>` captures lifetime '_#7r + = note: hidden type `Struct<'_>` captures lifetime '_#38r error: aborting due to previous error diff --git a/src/test/ui/proc-macro/quote-debug.stdout b/src/test/ui/proc-macro/quote-debug.stdout index 4bdc04b9ac430..32fa95fdc64b6 100644 --- a/src/test/ui/proc-macro/quote-debug.stdout +++ b/src/test/ui/proc-macro/quote-debug.stdout @@ -36,7 +36,13 @@ fn main() { lit } else { { - ::core::panicking::panic("internal error: entered unreachable code") + ::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(&["internal error: entered unreachable code"], + &match () + { + _args + => + [], + })) } } })), From 3c0d5ee3ff47c75b796a63cef7f741a765dae332 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Mon, 20 Dec 2021 22:09:20 +0100 Subject: [PATCH 4/4] Experiment with panic() vs panic!(). --- library/core/src/macros/mod.rs | 9 ++- library/core/src/option.rs | 6 +- ...76432.test.SimplifyComparisonIntegral.diff | 77 +++---------------- ...ue_59352.num_to_digit.PreCodegen.after.mir | 63 ++++++++++----- .../ui/consts/const-eval/const_panic.stderr | 8 +- .../consts/const-eval/const_panic_2021.stderr | 8 +- .../const-eval/const_panic_libcore_bin.stderr | 4 +- .../issue-87258_a.stderr | 2 +- .../issue-87258_b.stderr | 2 +- src/test/ui/proc-macro/quote-debug.stdout | 8 +- 10 files changed, 79 insertions(+), 108 deletions(-) diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index b18508186a618..af6718df6536f 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -589,9 +589,10 @@ macro_rules! writeln { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] +#[allow_internal_unstable(core_panic)] macro_rules! unreachable { () => ({ - $crate::panic!("internal error: entered unreachable code") + $crate::panicking::panic("internal error: entered unreachable code") }); ($msg:expr $(,)?) => ({ $crate::unreachable!("{}", $msg) @@ -674,8 +675,9 @@ macro_rules! unreachable { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] +#[allow_internal_unstable(core_panic)] macro_rules! unimplemented { - () => ($crate::panic!("not implemented")); + () => ($crate::panicking::panic("not implemented")); ($($arg:tt)+) => ($crate::panic!("not implemented: {}", $crate::format_args!($($arg)+))); } @@ -735,8 +737,9 @@ macro_rules! unimplemented { /// ``` #[macro_export] #[stable(feature = "todo_macro", since = "1.40.0")] +#[allow_internal_unstable(core_panic)] macro_rules! todo { - () => ($crate::panic!("not yet implemented")); + () => ($crate::panicking::panic("not yet implemented")); ($($arg:tt)+) => ($crate::panic!("not yet implemented: {}", $crate::format_args!($($arg)+))); } diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 8969c6f617130..e6312b8b2d947 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -501,6 +501,7 @@ #![stable(feature = "rust1", since = "1.0.0")] use crate::iter::{FromIterator, FusedIterator, TrustedLen}; +use crate::panicking::{panic, panic_str}; use crate::pin::Pin; use crate::{ convert, hint, mem, @@ -755,7 +756,7 @@ impl Option { pub const fn unwrap(self) -> T { match self { Some(val) => val, - None => panic!("called `Option::unwrap()` on a `None` value"), + None => panic("called `Option::unwrap()` on a `None` value"), } } @@ -1815,8 +1816,9 @@ impl Option> { #[cfg_attr(feature = "panic_immediate_abort", inline)] #[cold] #[track_caller] +#[rustc_const_unstable(feature = "const_option", issue = "67441")] const fn expect_failed(msg: &str) -> ! { - panic!("{}", msg) + panic_str(msg) } ///////////////////////////////////////////////////////////////////////////// diff --git a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff index 30c547b86ceb7..57485993dced0 100644 --- a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff @@ -21,34 +21,18 @@ let mut _19: *const T; // in scope 0 at $DIR/issue_76432.rs:9:54: 9:68 let mut _20: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 let mut _21: *const T; // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84 - let mut _22: !; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _23: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _24: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _25: &[&str; 1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _26: &[&str; 1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _27: [&str; 1]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _28: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _29: &[std::fmt::ArgumentV1; 0]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _30: &[std::fmt::ArgumentV1; 0]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _31: [std::fmt::ArgumentV1; 0]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _32: (); // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _36: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:7:19: 7:29 + let mut _22: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _23: &[T; 3]; // in scope 0 at $DIR/issue_76432.rs:7:19: 7:29 scope 1 { debug v => _2; // in scope 1 at $DIR/issue_76432.rs:7:9: 7:10 let _13: &T; // in scope 1 at $DIR/issue_76432.rs:9:10: 9:16 let _14: &T; // in scope 1 at $DIR/issue_76432.rs:9:18: 9:24 let _15: &T; // in scope 1 at $DIR/issue_76432.rs:9:26: 9:32 - let _33: (); // in scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _34: &[std::fmt::ArgumentV1; 0]; // in scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _35: &[&str; 1]; // in scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 2 { debug v1 => _13; // in scope 2 at $DIR/issue_76432.rs:9:10: 9:16 debug v2 => _14; // in scope 2 at $DIR/issue_76432.rs:9:18: 9:24 debug v3 => _15; // in scope 2 at $DIR/issue_76432.rs:9:26: 9:32 } - scope 3 { - debug _args => _33; // in scope 3 at $SRC_DIR/core/src/panic.rs:LL:COL - } } bb0: { @@ -68,59 +52,31 @@ StorageDead(_6); // scope 0 at $DIR/issue_76432.rs:7:28: 7:29 _4 = &_5; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 _3 = _4; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 - StorageLive(_36); // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 - _36 = _3; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 + StorageLive(_23); // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 + _23 = _3; // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 _2 = move _3 as &[T] (Pointer(Unsize)); // scope 0 at $DIR/issue_76432.rs:7:19: 7:29 StorageDead(_3); // scope 0 at $DIR/issue_76432.rs:7:28: 7:29 StorageDead(_4); // scope 0 at $DIR/issue_76432.rs:7:29: 7:30 StorageLive(_9); // scope 1 at $DIR/issue_76432.rs:8:5: 11:6 _10 = const 3_usize; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 - StorageDead(_36); // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 + StorageDead(_23); // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 _11 = const 3_usize; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 _12 = const true; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 goto -> bb2; // scope 1 at $DIR/issue_76432.rs:9:9: 9:33 } bb1: { - StorageLive(_22); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_23); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_24); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _35 = const test::::promoted[1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - // ty::Const - // + ty: &[&str; 1] - // + val: Unevaluated(test, [T], Some(promoted[1])) + StorageLive(_22); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &[&str; 1], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ issue_76432[HASH]::test), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) } - _26 = _35; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = _26; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = move _25 as &[&str] (Pointer(Unsize)); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_25); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_28); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_29); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_30); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_32); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_33); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - nop; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_33); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - _34 = const test::::promoted[0]; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL + // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar()) } // ty::Const - // + ty: &[std::fmt::ArgumentV1; 0] - // + val: Unevaluated(test, [T], Some(promoted[0])) + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: &[std::fmt::ArgumentV1; 0], val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:6 ~ issue_76432[HASH]::test), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) } - _30 = _34; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - _29 = _30; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - _28 = move _29 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_29); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - _23 = Arguments::new_v1(move _24, move _28) -> bb3; // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + user_ty: UserType(5) - // + literal: Const { ty: fn(&[&'static str], &[std::fmt::ArgumentV1]) -> std::fmt::Arguments {std::fmt::Arguments::new_v1}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) } } bb2: { @@ -158,14 +114,5 @@ StorageDead(_2); // scope 0 at $DIR/issue_76432.rs:12:1: 12:2 return; // scope 0 at $DIR/issue_76432.rs:12:2: 12:2 } - - bb3: { - StorageDead(_28); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_24); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - panic_fmt(move _23); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: for<'r> fn(std::fmt::Arguments<'r>) -> ! {std::rt::panic_fmt}, val: Value(Scalar()) } - } } diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 2bbc882103108..d028f0b989a68 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -7,7 +7,7 @@ fn num_to_digit(_1: char) -> u32 { let mut _3: std::option::Option; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:41 let mut _4: char; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29 let mut _5: u32; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - let mut _10: isize; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + let mut _11: isize; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23 debug self => _2; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 debug radix => _5; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 @@ -19,6 +19,13 @@ fn num_to_digit(_1: char) -> u32 { let mut _9: isize; // in scope 2 at $DIR/issue-59352.rs:14:8: 14:23 } } + scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50 + debug self => _3; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + let mut _10: isize; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + scope 4 { + debug val => _0; // in scope 4 at $DIR/issue-59352.rs:14:26: 14:50 + } + } bb0: { StorageLive(_2); // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 @@ -29,14 +36,14 @@ fn num_to_digit(_1: char) -> u32 { StorageLive(_7); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_8); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 _8 = _2; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb6; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 // mir::Constant // + span: $DIR/issue-59352.rs:14:8: 14:23 // + literal: Const { ty: fn(char, u32) -> std::option::Option {std::char::methods::::to_digit}, val: Value(Scalar()) } } bb1: { - StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_3); // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 StorageLive(_4); // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 _4 = _1; // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 @@ -48,39 +55,57 @@ fn num_to_digit(_1: char) -> u32 { bb2: { StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:14:40: 14:41 - _0 = Option::::unwrap(move _3) -> bb3; // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 - // mir::Constant - // + span: $DIR/issue-59352.rs:14:42: 14:48 - // + literal: Const { ty: fn(std::option::Option) -> u32 {std::option::Option::::unwrap}, val: Value(Scalar()) } + StorageLive(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 + _10 = discriminant(_3); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 } bb3: { - StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 - goto -> bb5; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 - } - - bb4: { - StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 - goto -> bb5; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } - bb5: { + bb4: { return; // scope 0 at $DIR/issue-59352.rs:15:2: 15:2 } - bb6: { + bb5: { _6 = &_7; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_8); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_9); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 _9 = discriminant((*_6)); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 - StorageLive(_10); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 - _10 = move _9; // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_11); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + _11 = move _9; // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_9); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_6); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_7); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_2); // scope 0 at $DIR/issue-59352.rs:14:22: 14:23 - switchInt(move _10) -> [1_isize: bb1, otherwise: bb4]; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + switchInt(move _11) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + } + + bb6: { + core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + // mir::Constant + // + span: $DIR/issue-59352.rs:14:26: 14:50 + // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar()) } + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [99, 97, 108, 108, 101, 100, 32, 96, 79, 112, 116, 105, 111, 110, 58, 58, 117, 110, 119, 114, 97, 112, 40, 41, 96, 32, 111, 110, 32, 97, 32, 96, 78, 111, 110, 101, 96, 32, 118, 97, 108, 117, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [8796093022207], len: Size { raw: 43 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 43 }) + // mir::Constant + // + span: $DIR/issue-59352.rs:14:26: 14:50 + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [99, 97, 108, 108, 101, 100, 32, 96, 79, 112, 116, 105, 111, 110, 58, 58, 117, 110, 119, 114, 97, 112, 40, 41, 96, 32, 111, 110, 32, 97, 32, 96, 78, 111, 110, 101, 96, 32, 118, 97, 108, 117, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [8796093022207], len: Size { raw: 43 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 43 }) } + } + + bb7: { + unreachable; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + } + + bb8: { + _0 = move ((_3 as Some).0: u32); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 + StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 + goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } } diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr index 59eaa098cfe94..8da697fe7ef3b 100644 --- a/src/test/ui/consts/const-eval/const_panic.stderr +++ b/src/test/ui/consts/const-eval/const_panic.stderr @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:12:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:15:15 @@ -28,7 +28,7 @@ error[E0080]: evaluation of constant value failed LL | const X: () = std::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:15:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:18:15 @@ -68,7 +68,7 @@ error[E0080]: evaluation of constant value failed LL | const Y_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:30:20 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:33:20 @@ -76,7 +76,7 @@ error[E0080]: evaluation of constant value failed LL | const X_CORE: () = core::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:33:20 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic.rs:36:20 diff --git a/src/test/ui/consts/const-eval/const_panic_2021.stderr b/src/test/ui/consts/const-eval/const_panic_2021.stderr index f59fae29a467d..62fe1715fecb5 100644 --- a/src/test/ui/consts/const-eval/const_panic_2021.stderr +++ b/src/test/ui/consts/const-eval/const_panic_2021.stderr @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const C: () = std::unreachable!(); | ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:12:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:15:15 @@ -28,7 +28,7 @@ error[E0080]: evaluation of constant value failed LL | const D: () = std::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:15:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `std::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:18:15 @@ -60,7 +60,7 @@ error[E0080]: evaluation of constant value failed LL | const C_CORE: () = core::unreachable!(); | ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:27:20 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:30:20 @@ -68,7 +68,7 @@ error[E0080]: evaluation of constant value failed LL | const D_CORE: () = core::unimplemented!(); | ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_2021.rs:30:20 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `core::unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_2021.rs:33:20 diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr index 0a747dc905874..52c0c13636687 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr @@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:11:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $DIR/const_panic_libcore_bin.rs:14:15 @@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed LL | const X: () = unimplemented!(); | ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:14:15 | - = note: this error originates in the macro `$crate::panic::panic_2021` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/generic-associated-types/issue-87258_a.stderr b/src/test/ui/generic-associated-types/issue-87258_a.stderr index f9f6616ba4565..93513a4563f07 100644 --- a/src/test/ui/generic-associated-types/issue-87258_a.stderr +++ b/src/test/ui/generic-associated-types/issue-87258_a.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea LL | fn foo<'a>() -> Self::FooFuture<'a> { | ^^^^^^^^^^^^^^^^^^^ | - = note: hidden type `Struct<'_>` captures lifetime '_#38r + = note: hidden type `Struct<'_>` captures lifetime '_#7r error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-87258_b.stderr b/src/test/ui/generic-associated-types/issue-87258_b.stderr index bfef92ee0410d..e077a423400df 100644 --- a/src/test/ui/generic-associated-types/issue-87258_b.stderr +++ b/src/test/ui/generic-associated-types/issue-87258_b.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea LL | fn foo<'a>() -> Self::FooFuture<'a> { | ^^^^^^^^^^^^^^^^^^^ | - = note: hidden type `Struct<'_>` captures lifetime '_#38r + = note: hidden type `Struct<'_>` captures lifetime '_#7r error: aborting due to previous error diff --git a/src/test/ui/proc-macro/quote-debug.stdout b/src/test/ui/proc-macro/quote-debug.stdout index 32fa95fdc64b6..4bdc04b9ac430 100644 --- a/src/test/ui/proc-macro/quote-debug.stdout +++ b/src/test/ui/proc-macro/quote-debug.stdout @@ -36,13 +36,7 @@ fn main() { lit } else { { - ::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(&["internal error: entered unreachable code"], - &match () - { - _args - => - [], - })) + ::core::panicking::panic("internal error: entered unreachable code") } } })),