From bbad2b2182120abee70d59a57495c560444e5464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20du=20Garreau?= Date: Mon, 16 Nov 2020 15:40:33 +0100 Subject: [PATCH 1/6] Improve assert_eq! and assert_ne! It should improve compile times and reduce instruction cache use by moving the panic formatting to a monomorphised function --- library/core/src/lib.rs | 7 +++ library/core/src/macros/internals.rs | 85 ++++++++++++++++++++++++++++ library/core/src/macros/mod.rs | 26 ++++----- 3 files changed, 103 insertions(+), 15 deletions(-) create mode 100644 library/core/src/macros/internals.rs diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index fd4a76c1eb5..cc74656a296 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -173,6 +173,13 @@ mod macros; #[macro_use] mod internal_macros; +#[doc(hidden)] +#[unstable( + feature = "macros_internals", + reason = "macros implementation detail", + issue = "none" +)] +pub use macros::internals as macros_internals; #[path = "num/shells/int_macros.rs"] #[macro_use] diff --git a/library/core/src/macros/internals.rs b/library/core/src/macros/internals.rs new file mode 100644 index 00000000000..39ac0b41f16 --- /dev/null +++ b/library/core/src/macros/internals.rs @@ -0,0 +1,85 @@ +use crate::{fmt, panic}; + +#[cold] +#[doc(hidden)] +#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] +#[track_caller] +pub fn assert_eq_failed(left: &T, right: &U) -> ! +where + T: fmt::Debug + ?Sized, + U: fmt::Debug + ?Sized, +{ + #[track_caller] + fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug) -> ! { + panic!( + r#"assertion failed: `(left == right)` +left: `{:?}`, +right: `{:?}`"#, + left, right + ) + } + inner(&left, &right) +} + +#[cold] +#[doc(hidden)] +#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] +#[track_caller] +pub fn assert_eq_failed_args(left: &T, right: &U, args: fmt::Arguments<'_>) -> ! +where + T: fmt::Debug + ?Sized, + U: fmt::Debug + ?Sized, +{ + #[track_caller] + fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug, args: fmt::Arguments<'_>) -> ! { + panic!( + r#"assertion failed: `(left == right)` +left: `{:?}`, +right: `{:?}: {}`"#, + left, right, args + ) + } + inner(&left, &right, args) +} + +#[cold] +#[doc(hidden)] +#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] +#[track_caller] +pub fn assert_ne_failed(left: &T, right: &U) -> ! +where + T: fmt::Debug + ?Sized, + U: fmt::Debug + ?Sized, +{ + #[track_caller] + fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug) -> ! { + panic!( + r#"assertion failed: `(left != right)` +left: `{:?}`, +right: `{:?}`"#, + left, right + ) + } + inner(&left, &right) +} + +#[cold] +#[doc(hidden)] +#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] +#[track_caller] +pub fn assert_ne_failed_args(left: &T, right: &U, args: fmt::Arguments<'_>) -> ! +where + T: fmt::Debug + ?Sized, + U: fmt::Debug + ?Sized, +{ + #[track_caller] + fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug, args: fmt::Arguments<'_>) -> ! { + panic!( + r#"assertion failed: `(left != right)` +left: `{:?}`, +right: `{:?}: {}`"#, + left, right, args + ) + } + inner(&left, &right, args) +} diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 7aaf5a5fd46..5061ca0c50d 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1,3 +1,7 @@ +#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] +#[doc(hidden)] +pub mod internals; + #[cfg(bootstrap)] #[doc(include = "panic.md")] #[macro_export] @@ -53,6 +57,7 @@ macro_rules! panic { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] +#[allow_internal_unstable(macros_internals)] macro_rules! assert_eq { ($left:expr, $right:expr $(,)?) => ({ match (&$left, &$right) { @@ -61,24 +66,19 @@ macro_rules! assert_eq { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::panic!(r#"assertion failed: `(left == right)` - left: `{:?}`, - right: `{:?}`"#, &*left_val, &*right_val) + $crate::macros_internals::assert_eq_failed(&*left_val, &*right_val); } } } }); ($left:expr, $right:expr, $($arg:tt)+) => ({ - match (&($left), &($right)) { + match (&$left, &$right) { (left_val, right_val) => { if !(*left_val == *right_val) { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::panic!(r#"assertion failed: `(left == right)` - left: `{:?}`, - right: `{:?}`: {}"#, &*left_val, &*right_val, - $crate::format_args!($($arg)+)) + $crate::macros_internals::assert_eq_failed_args(&*left_val, &*right_val, $crate::format_args!($($arg)+)); } } } @@ -104,6 +104,7 @@ macro_rules! assert_eq { /// ``` #[macro_export] #[stable(feature = "assert_ne", since = "1.13.0")] +#[allow_internal_unstable(macros_internals)] macro_rules! assert_ne { ($left:expr, $right:expr $(,)?) => ({ match (&$left, &$right) { @@ -112,9 +113,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::panic!(r#"assertion failed: `(left != right)` - left: `{:?}`, - right: `{:?}`"#, &*left_val, &*right_val) + $crate::macros_internals::assert_eq_failed(&*left_val, &*right_val); } } } @@ -126,10 +125,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::panic!(r#"assertion failed: `(left != right)` - left: `{:?}`, - right: `{:?}`: {}"#, &*left_val, &*right_val, - $crate::format_args!($($arg)+)) + $crate::macros_internals::assert_ne_failed_args(&*left_val, &*right_val, $crate::format_args!($($arg)+)); } } } From 52197d356c2703e23aa7acea0128e50174edee33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20du=20Garreau?= Date: Mon, 16 Nov 2020 21:33:01 +0100 Subject: [PATCH 2/6] Fix UI tests and merge `assert_eq` and `assert_ne` internal functions --- library/core/src/macros/internals.rs | 75 ++---- library/core/src/macros/mod.rs | 8 +- .../issue_73223.main.PreCodegen.32bit.diff | 172 +++----------- .../issue_73223.main.PreCodegen.64bit.diff | 172 +++----------- ..._73223.main.SimplifyArmIdentity.32bit.diff | 218 +++--------------- ..._73223.main.SimplifyArmIdentity.64bit.diff | 218 +++--------------- .../defaults-cyclic-fail.stderr | 2 +- .../ui/consts/control-flow/issue-50577.stderr | 5 +- .../ui/hygiene/no_implicit_prelude.stderr | 4 +- src/test/ui/issues/issue-59488.rs | 1 - src/test/ui/issues/issue-59488.stderr | 20 +- ...70724-add_type_neq_err_label-unwrap.stderr | 7 +- 12 files changed, 164 insertions(+), 738 deletions(-) diff --git a/library/core/src/macros/internals.rs b/library/core/src/macros/internals.rs index 39ac0b41f16..35a28a2e0af 100644 --- a/library/core/src/macros/internals.rs +++ b/library/core/src/macros/internals.rs @@ -4,82 +4,45 @@ use crate::{fmt, panic}; #[doc(hidden)] #[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] #[track_caller] -pub fn assert_eq_failed(left: &T, right: &U) -> ! +pub fn assert_failed(op: &str, left: &T, right: &U) -> ! where T: fmt::Debug + ?Sized, U: fmt::Debug + ?Sized, { #[track_caller] - fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug) -> ! { + fn inner(op: &str, left: &dyn fmt::Debug, right: &dyn fmt::Debug) -> ! { panic!( - r#"assertion failed: `(left == right)` -left: `{:?}`, -right: `{:?}`"#, - left, right + r#"assertion failed: `(left {} right)` + left: `{:?}`, + right: `{:?}`"#, + op, left, right ) } - inner(&left, &right) + inner(op, &left, &right) } #[cold] #[doc(hidden)] #[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] #[track_caller] -pub fn assert_eq_failed_args(left: &T, right: &U, args: fmt::Arguments<'_>) -> ! +pub fn assert_failed_args(op: &str, left: &T, right: &U, args: fmt::Arguments<'_>) -> ! where T: fmt::Debug + ?Sized, U: fmt::Debug + ?Sized, { #[track_caller] - fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug, args: fmt::Arguments<'_>) -> ! { + fn inner( + op: &str, + left: &dyn fmt::Debug, + right: &dyn fmt::Debug, + args: fmt::Arguments<'_>, + ) -> ! { panic!( - r#"assertion failed: `(left == right)` -left: `{:?}`, -right: `{:?}: {}`"#, - left, right, args + r#"assertion failed: `(left {} right)` + left: `{:?}`, + right: `{:?}: {}`"#, + op, left, right, args ) } - inner(&left, &right, args) -} - -#[cold] -#[doc(hidden)] -#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] -#[track_caller] -pub fn assert_ne_failed(left: &T, right: &U) -> ! -where - T: fmt::Debug + ?Sized, - U: fmt::Debug + ?Sized, -{ - #[track_caller] - fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug) -> ! { - panic!( - r#"assertion failed: `(left != right)` -left: `{:?}`, -right: `{:?}`"#, - left, right - ) - } - inner(&left, &right) -} - -#[cold] -#[doc(hidden)] -#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] -#[track_caller] -pub fn assert_ne_failed_args(left: &T, right: &U, args: fmt::Arguments<'_>) -> ! -where - T: fmt::Debug + ?Sized, - U: fmt::Debug + ?Sized, -{ - #[track_caller] - fn inner(left: &dyn fmt::Debug, right: &dyn fmt::Debug, args: fmt::Arguments<'_>) -> ! { - panic!( - r#"assertion failed: `(left != right)` -left: `{:?}`, -right: `{:?}: {}`"#, - left, right, args - ) - } - inner(&left, &right, args) + inner(op, &left, &right, args) } diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 5061ca0c50d..30bdae1efa7 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -66,7 +66,7 @@ macro_rules! assert_eq { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_eq_failed(&*left_val, &*right_val); + $crate::macros_internals::assert_failed("==", &*left_val, &*right_val); } } } @@ -78,7 +78,7 @@ macro_rules! assert_eq { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_eq_failed_args(&*left_val, &*right_val, $crate::format_args!($($arg)+)); + $crate::macros_internals::assert_failed_args("==", &*left_val, &*right_val, $crate::format_args!($($arg)+)); } } } @@ -113,7 +113,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_eq_failed(&*left_val, &*right_val); + $crate::macros_internals::assert_failed("!=", &*left_val, &*right_val); } } } @@ -125,7 +125,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_ne_failed_args(&*left_val, &*right_val, $crate::format_args!($($arg)+)); + $crate::macros_internals::assert_failed_args("!=", &*left_val, &*right_val, $crate::format_args!($($arg)+)); } } } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index e4916a56bea..64b559f6432 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -8,57 +8,20 @@ let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _13: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _14: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _15: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _16: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _18: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _19: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _20: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _9: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _10: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 - let _7: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { - debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 5 { - debug arg0 => _24; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _27; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _24; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _23; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _22: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _23: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _24: &&i32; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 7 { - } - } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _27; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _26; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _25: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _26: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _27: &&i32; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 9 { - } - } - } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug pieces => (_12.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - debug args => _29; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _28: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _29: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - } + debug left_val => _11; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _12; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -79,113 +42,46 @@ ((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 (_5.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _6 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _6 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) - // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) } - (_5.1: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _8 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _11 = (*_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = Eq(move _11, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _9 = Not(move _10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _9) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb1: { - _13 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - // ty::Const - // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - (_12.0: &[&str]) = move _13 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_15); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_16.0: &&i32) = &_17; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = &_19; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_16.1: &&i32) = move _18; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_18); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _24 = (_16.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _27 = (_16.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + (_5.1: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _9 = (*_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _8 = Eq(move _9, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = Not(move _8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _7) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb1: { + _10 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_22); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } + core::macros::internals::assert_failed::(move _10, move _11, move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } } bb2: { - StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } - - bb3: { - (_20.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _24) -> bb4; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb4: { - (_20.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _22; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_22); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _26 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 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: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_25); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } - } - - bb5: { - (_21.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _27) -> bb6; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb6: { - (_21.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _25; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_25); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _15 = [move _20, move _21]; // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - _14 = &_15; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _29 = move _14 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_28); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - discriminant(_28) = 0; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_12.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _28; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_12.2: &[std::fmt::ArgumentV1]) = move _29; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_28); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - core::panicking::panic_fmt(move _12); // scope 4 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>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } - } } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index e4916a56bea..64b559f6432 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -8,57 +8,20 @@ let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _13: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _14: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _15: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _16: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _18: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _19: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _20: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _21: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL + let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _9: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _10: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 - let _7: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _8: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { - debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 5 { - debug arg0 => _24; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _27; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _24; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _23; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _22: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _23: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _24: &&i32; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 7 { - } - } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _27; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _26; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _25: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _26: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _27: &&i32; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 9 { - } - } - } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug pieces => (_12.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - debug args => _29; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _28: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _29: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - } + debug left_val => _11; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _12; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -79,113 +42,46 @@ ((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 (_5.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _6 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _6 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) - // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) } - (_5.1: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _8 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _11 = (*_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = Eq(move _11, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _9 = Not(move _10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _9) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb1: { - _13 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - // ty::Const - // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - (_12.0: &[&str]) = move _13 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_15); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_16.0: &&i32) = &_17; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = &_19; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_16.1: &&i32) = move _18; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_18); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _24 = (_16.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _27 = (_16.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + (_5.1: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _9 = (*_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _8 = Eq(move _9, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = Not(move _8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _7) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb1: { + _10 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_22); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } + core::macros::internals::assert_failed::(move _10, move _11, move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } } bb2: { - StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } - - bb3: { - (_20.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _24) -> bb4; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb4: { - (_20.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _22; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_22); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _26 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 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: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_25); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } - } - - bb5: { - (_21.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _27) -> bb6; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb6: { - (_21.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _25; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_25); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _15 = [move _20, move _21]; // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - _14 = &_15; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _29 = move _14 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_28); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - discriminant(_28) = 0; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_12.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _28; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_12.2: &[std::fmt::ArgumentV1]) = move _29; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_28); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - core::panicking::panic_fmt(move _12); // scope 4 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>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } - } } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index b5dd416ddb1..3d19385c343 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -18,27 +18,14 @@ let mut _16: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _17: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _18: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _19: !; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _20: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _21: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _22: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _23: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _24: [&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _25: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _26: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _27: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _28: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _29: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _30: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _31: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _32: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _33: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _36: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _37: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _38: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _39: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _40: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _41: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _19: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _22: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _23: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _24: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _26: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -46,44 +33,10 @@ debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _43: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _27: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _34: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _35: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _42: &[&str; 3]; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 5 { - debug arg0 => _34; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _35; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _37; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _38; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _44: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _45: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _46: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _47: &&i32; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 7 { - } - } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _40; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _41; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _48: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _49: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _50: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _51: &&i32; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 9 { - } - } - } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug pieces => _21; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - debug args => _25; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _52: &[&str]; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _53: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _54: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - } } } } @@ -124,14 +77,14 @@ StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _43 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) + // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) } - _11 = _43; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + _11 = _27; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -155,58 +108,29 @@ } bb3: { - StorageLive(_19); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_20); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _42 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const - // + ty: &[&str; 3] - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _23 = _42; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = _23; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = move _22 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_26); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_27); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_28); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_29); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_31); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _31 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _30 = &_31; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_33); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _33 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _32 = &_33; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_29.0: &&i32) = move _30; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - (_29.1: &&i32) = move _32; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_32); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_30); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_34); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _34 = (_29.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_35); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _35 = (_29.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_36); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_37); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _37 = _34; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_38); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _38 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } + _21 = _22; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = _24; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = _26; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::macros::internals::assert_failed::(move _21, move _23, move _25); // scope 4 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: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_44); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_45); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _45 = _38; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } + // + literal: Const { ty: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } } bb4: { @@ -221,89 +145,5 @@ StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } - - bb5: { - StorageDead(_45); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_46); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_47); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _47 = _37; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _46 = transmute::<&&i32, &core::fmt::Opaque>(move _47) -> bb6; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb6: { - StorageDead(_47); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - (_36.0: &core::fmt::Opaque) = move _46; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - (_36.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _44; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_46); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_44); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_38); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_37); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_39); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _40 = _35; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_41); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _41 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 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: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_48); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_49); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _49 = _41; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } - } - - bb7: { - StorageDead(_49); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_50); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_51); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _51 = _40; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _50 = transmute::<&&i32, &core::fmt::Opaque>(move _51) -> bb8; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb8: { - StorageDead(_51); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - (_39.0: &core::fmt::Opaque) = move _50; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - (_39.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _48; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_50); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_48); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_41); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_40); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - _28 = [move _36, move _39]; // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_39); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_36); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_35); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_34); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _27 = &_28; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _26 = _27; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _25 = move _26 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_26); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_52); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - _52 = _21; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_53); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - discriminant(_53) = 0; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_54); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - _54 = _25; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_20.0: &[&str]) = move _52; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_20.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _53; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_20.2: &[std::fmt::ArgumentV1]) = move _54; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_54); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_53); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_52); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_25); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_21); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - core::panicking::panic_fmt(move _20); // scope 4 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>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } - } } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index b5dd416ddb1..3d19385c343 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -18,27 +18,14 @@ let mut _16: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _17: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _18: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _19: !; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _20: std::fmt::Arguments; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _21: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _22: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _23: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _24: [&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _25: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _26: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _27: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let _28: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _29: (&&i32, &&i32); // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _30: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _31: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _32: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _33: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _36: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _37: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _38: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _39: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _40: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _41: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _19: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _22: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _23: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _24: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _25: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _26: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -46,44 +33,10 @@ debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _43: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _27: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _34: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _35: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _42: &[&str; 3]; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 5 { - debug arg0 => _34; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _35; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _37; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _38; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _44: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _45: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _46: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _47: &&i32; // in scope 6 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 7 { - } - } - scope 8 (inlined ArgumentV1::new::<&i32>) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug x => _40; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - debug f => _41; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _48: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _49: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _50: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _51: &&i32; // in scope 8 at $SRC_DIR/core/src/panic.rs:LL:COL - scope 9 { - } - } - } - scope 10 (inlined Arguments::new_v1) { // at $SRC_DIR/core/src/panic.rs:LL:COL - debug pieces => _21; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - debug args => _25; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _52: &[&str]; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _53: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - let mut _54: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - } } } } @@ -124,14 +77,14 @@ StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _43 = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) + // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[1])) } - _11 = _43; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } + _11 = _27; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -155,58 +108,29 @@ } bb3: { - StorageLive(_19); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_20); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL + StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _42 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const - // + ty: &[&str; 3] - // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) + // + ty: &str + // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _23 = _42; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = _23; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = move _22 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_26); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_27); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_28); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_29); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_30); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_31); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _31 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _30 = &_31; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_33); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _33 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _32 = &_33; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_29.0: &&i32) = move _30; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - (_29.1: &&i32) = move _32; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_32); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_30); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_34); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _34 = (_29.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_35); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _35 = (_29.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_36); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_37); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _37 = _34; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_38); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _38 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } + _21 = _22; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = _24; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = _26; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::macros::internals::assert_failed::(move _21, move _23, move _25); // scope 4 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: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_44); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_45); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _45 = _38; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } + // + literal: Const { ty: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } } bb4: { @@ -221,89 +145,5 @@ StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } - - bb5: { - StorageDead(_45); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_46); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_47); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _47 = _37; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - _46 = transmute::<&&i32, &core::fmt::Opaque>(move _47) -> bb6; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb6: { - StorageDead(_47); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - (_36.0: &core::fmt::Opaque) = move _46; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - (_36.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _44; // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_46); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_44); // scope 7 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_38); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_37); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_39); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_40); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _40 = _35; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_41); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _41 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 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: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_48); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_49); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _49 = _41; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } - } - - bb7: { - StorageDead(_49); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_50); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_51); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _51 = _40; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - _50 = transmute::<&&i32, &core::fmt::Opaque>(move _51) -> bb8; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/panic.rs:LL:COL - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } - } - - bb8: { - StorageDead(_51); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - (_39.0: &core::fmt::Opaque) = move _50; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - (_39.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _48; // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_50); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_48); // scope 9 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_41); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_40); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - _28 = [move _36, move _39]; // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_39); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_36); // scope 5 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_35); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_34); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _27 = &_28; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _26 = _27; // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - _25 = move _26 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_26); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_52); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - _52 = _21; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_53); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - discriminant(_53) = 0; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageLive(_54); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - _54 = _25; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_20.0: &[&str]) = move _52; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_20.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _53; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - (_20.2: &[std::fmt::ArgumentV1]) = move _54; // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_54); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_53); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_52); // scope 10 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_25); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - StorageDead(_21); // scope 4 at $SRC_DIR/core/src/panic.rs:LL:COL - core::panicking::panic_fmt(move _20); // scope 4 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>) -> ! {core::panicking::panic_fmt}, val: Value(Scalar()) } - } } diff --git a/src/test/ui/associated-consts/defaults-cyclic-fail.stderr b/src/test/ui/associated-consts/defaults-cyclic-fail.stderr index 616ac9053fd..3fb4ab72fe6 100644 --- a/src/test/ui/associated-consts/defaults-cyclic-fail.stderr +++ b/src/test/ui/associated-consts/defaults-cyclic-fail.stderr @@ -32,7 +32,7 @@ note: ...which requires const-evaluating + checking `Tr::B`... LL | const B: u8 = Self::A; | ^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires normalizing `<() as Tr>::A`, completing the cycle -note: cycle used when const-evaluating + checking `main::promoted[2]` +note: cycle used when const-evaluating + checking `main::promoted[1]` --> $DIR/defaults-cyclic-fail.rs:14:1 | LL | fn main() { diff --git a/src/test/ui/consts/control-flow/issue-50577.stderr b/src/test/ui/consts/control-flow/issue-50577.stderr index b7b4c3a30d1..39473343bcf 100644 --- a/src/test/ui/consts/control-flow/issue-50577.stderr +++ b/src/test/ui/consts/control-flow/issue-50577.stderr @@ -2,10 +2,7 @@ error[E0317]: `if` may be missing an `else` clause --> $DIR/issue-50577.rs:3:16 | LL | Drop = assert_eq!(1, 1), - | ^^^^^^^^^^^^^^^^ - | | - | expected `()`, found `isize` - | found here + | ^^^^^^^^^^^^^^^^ expected `()`, found `isize` | = note: `if` expressions without `else` evaluate to `()` = help: consider adding an `else` block that evaluates to the expected type diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index 835ecce94b9..6cc69a5955d 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -29,5 +29,5 @@ LL | ().clone() error: aborting due to 2 previous errors -Some errors have detailed explanations: E0433, E0599. -For more information about an error, try `rustc --explain E0433`. +Some errors have detailed explanations: E0282, E0433, E0599. +For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/issues/issue-59488.rs b/src/test/ui/issues/issue-59488.rs index 384501e3e5d..922b593935a 100644 --- a/src/test/ui/issues/issue-59488.rs +++ b/src/test/ui/issues/issue-59488.rs @@ -30,5 +30,4 @@ fn main() { assert_eq!(Foo::Bar, i); //~^ ERROR binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` [E0369] //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] - //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] } diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index 3b10491a8ab..43a6517c8ca 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -84,24 +84,16 @@ error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` | LL | assert_eq!(Foo::Bar, i); | ^^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + ::: $SRC_DIR/core/src/macros/internals.rs:LL:COL + | +LL | T: fmt::Debug + ?Sized, + | ---------- required by this bound in `core::macros::internals::assert_failed` | = help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}` - = note: required because of the requirements on the impl of `Debug` for `&fn(usize) -> Foo {Foo::Bar}` - = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` - --> $DIR/issue-59488.rs:30:5 - | -LL | assert_eq!(Foo::Bar, i); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}` - = note: required because of the requirements on the impl of `Debug` for `&fn(usize) -> Foo {Foo::Bar}` - = note: required by `std::fmt::Debug::fmt` - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 10 previous errors +error: aborting due to 9 previous errors Some errors have detailed explanations: E0277, E0308, E0369. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr index f5a56d7553b..5623b331f71 100644 --- a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr +++ b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr @@ -28,11 +28,14 @@ LL | fn a() -> i32 { ... LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + ::: $SRC_DIR/core/src/macros/internals.rs:LL:COL + | +LL | T: fmt::Debug + ?Sized, + | ---------- required by this bound in `core::macros::internals::assert_failed` | = help: the trait `Debug` is not implemented for `fn() -> i32 {a}` = help: use parentheses to call the function: `a()` - = note: required because of the requirements on the impl of `Debug` for `&fn() -> i32 {a}` - = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors From f138e260a00ac16e8532aa406f6738c92e5d27ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20du=20Garreau?= Date: Wed, 9 Dec 2020 11:29:42 +0100 Subject: [PATCH 3/6] Apply suggestion --- library/core/src/macros/internals.rs | 41 +++++++------------ library/core/src/macros/mod.rs | 8 ++-- .../issue_73223.main.PreCodegen.32bit.diff | 7 +++- ..._73223.main.SimplifyArmIdentity.32bit.diff | 13 +++--- .../ui/hygiene/no_implicit_prelude.stderr | 4 +- 5 files changed, 33 insertions(+), 40 deletions(-) diff --git a/library/core/src/macros/internals.rs b/library/core/src/macros/internals.rs index 35a28a2e0af..c3ad7398aa1 100644 --- a/library/core/src/macros/internals.rs +++ b/library/core/src/macros/internals.rs @@ -4,28 +4,7 @@ use crate::{fmt, panic}; #[doc(hidden)] #[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] #[track_caller] -pub fn assert_failed(op: &str, left: &T, right: &U) -> ! -where - T: fmt::Debug + ?Sized, - U: fmt::Debug + ?Sized, -{ - #[track_caller] - fn inner(op: &str, left: &dyn fmt::Debug, right: &dyn fmt::Debug) -> ! { - panic!( - r#"assertion failed: `(left {} right)` - left: `{:?}`, - right: `{:?}`"#, - op, left, right - ) - } - inner(op, &left, &right) -} - -#[cold] -#[doc(hidden)] -#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] -#[track_caller] -pub fn assert_failed_args(op: &str, left: &T, right: &U, args: fmt::Arguments<'_>) -> ! +pub fn assert_failed(op: &str, left: &T, right: &U, args: Option>) -> ! where T: fmt::Debug + ?Sized, U: fmt::Debug + ?Sized, @@ -35,14 +14,22 @@ where op: &str, left: &dyn fmt::Debug, right: &dyn fmt::Debug, - args: fmt::Arguments<'_>, + args: Option>, ) -> ! { - panic!( - r#"assertion failed: `(left {} right)` + match args { + Some(args) => panic!( + r#"assertion failed: `(left {} right)` left: `{:?}`, right: `{:?}: {}`"#, - op, left, right, args - ) + op, left, right, args + ), + None => panic!( + r#"assertion failed: `(left {} right)` + left: `{:?}`, + right: `{:?}`"#, + op, left, right, + ), + } } inner(op, &left, &right, args) } diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 30bdae1efa7..f505b7021ed 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -66,7 +66,7 @@ macro_rules! assert_eq { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed("==", &*left_val, &*right_val); + $crate::macros_internals::assert_failed("==", &*left_val, &*right_val, $crate::option::Option::None); } } } @@ -78,7 +78,7 @@ macro_rules! assert_eq { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed_args("==", &*left_val, &*right_val, $crate::format_args!($($arg)+)); + $crate::macros_internals::assert_failed("==", &*left_val, &*right_val, $crate::option::Option::Some($crate::format_args!($($arg)+))); } } } @@ -113,7 +113,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed("!=", &*left_val, &*right_val); + $crate::macros_internals::assert_failed("!=", &*left_val, &*right_val, $crate::option::Option::None); } } } @@ -125,7 +125,7 @@ macro_rules! assert_ne { // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed_args("!=", &*left_val, &*right_val, $crate::format_args!($($arg)+)); + $crate::macros_internals::assert_failed("!=", &*left_val, &*right_val, $crate::option::Option::Some($crate::format_args!($($arg)+))); } } } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index 64b559f6432..46404f5e33c 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -14,6 +14,7 @@ let mut _10: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _12: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -71,10 +72,12 @@ // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } - core::macros::internals::assert_failed::(move _10, move _11, move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_13) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::macros::internals::assert_failed::(move _10, move _11, move _12, move _13); // scope 4 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: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } + // + literal: Const { ty: for<'r, 's, 't0, 't1> fn(&'r str, &'s i32, &'t0 i32, std::option::Option>) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } } bb2: { diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index 3d19385c343..cf1db80bcfc 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -26,6 +26,7 @@ let _24: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _25: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _26: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _27: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -33,7 +34,7 @@ debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _27: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _28: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -77,14 +78,14 @@ StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _27 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _28 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _11 = _27; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = _28; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -127,10 +128,12 @@ StorageLive(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _26 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _25 = _26; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - core::macros::internals::assert_failed::(move _21, move _23, move _25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_27) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::macros::internals::assert_failed::(move _21, move _23, move _25, move _27); // scope 4 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: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } + // + literal: Const { ty: for<'r, 's, 't0, 't1> fn(&'r str, &'s i32, &'t0 i32, std::option::Option>) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } } bb4: { diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index 6cc69a5955d..835ecce94b9 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -29,5 +29,5 @@ LL | ().clone() error: aborting due to 2 previous errors -Some errors have detailed explanations: E0282, E0433, E0599. -For more information about an error, try `rustc --explain E0282`. +Some errors have detailed explanations: E0433, E0599. +For more information about an error, try `rustc --explain E0433`. From 546d062820555d5597c63288340feed17cea54f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20du=20Garreau?= Date: Wed, 16 Dec 2020 22:06:06 +0100 Subject: [PATCH 4/6] Apply suggestions - Move `assert_failed` to core::panicking` - Make `assert_failed` use an enum instead of a string --- library/core/src/lib.rs | 7 --- library/core/src/macros/internals.rs | 35 ----------- library/core/src/macros/mod.rs | 20 +++---- library/core/src/panicking.rs | 49 ++++++++++++++++ .../issue_73223.main.PreCodegen.32bit.diff | 26 +++++---- .../issue_73223.main.PreCodegen.64bit.diff | 25 +++++--- ..._73223.main.SimplifyArmIdentity.32bit.diff | 53 ++++++++++------- ..._73223.main.SimplifyArmIdentity.64bit.diff | 58 +++++++++++-------- src/test/ui/binop/issue-77910-1.stderr | 7 ++- src/test/ui/issues/issue-59488.stderr | 4 +- ...70724-add_type_neq_err_label-unwrap.stderr | 4 +- 11 files changed, 165 insertions(+), 123 deletions(-) delete mode 100644 library/core/src/macros/internals.rs diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index cc74656a296..fd4a76c1eb5 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -173,13 +173,6 @@ mod macros; #[macro_use] mod internal_macros; -#[doc(hidden)] -#[unstable( - feature = "macros_internals", - reason = "macros implementation detail", - issue = "none" -)] -pub use macros::internals as macros_internals; #[path = "num/shells/int_macros.rs"] #[macro_use] diff --git a/library/core/src/macros/internals.rs b/library/core/src/macros/internals.rs deleted file mode 100644 index c3ad7398aa1..00000000000 --- a/library/core/src/macros/internals.rs +++ /dev/null @@ -1,35 +0,0 @@ -use crate::{fmt, panic}; - -#[cold] -#[doc(hidden)] -#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] -#[track_caller] -pub fn assert_failed(op: &str, left: &T, right: &U, args: Option>) -> ! -where - T: fmt::Debug + ?Sized, - U: fmt::Debug + ?Sized, -{ - #[track_caller] - fn inner( - op: &str, - left: &dyn fmt::Debug, - right: &dyn fmt::Debug, - args: Option>, - ) -> ! { - match args { - Some(args) => panic!( - r#"assertion failed: `(left {} right)` - left: `{:?}`, - right: `{:?}: {}`"#, - op, left, right, args - ), - None => panic!( - r#"assertion failed: `(left {} right)` - left: `{:?}`, - right: `{:?}`"#, - op, left, right, - ), - } - } - inner(op, &left, &right, args) -} diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index f505b7021ed..6eee9948e7c 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1,7 +1,3 @@ -#[unstable(feature = "macros_internals", reason = "macros implementation detail", issue = "none")] -#[doc(hidden)] -pub mod internals; - #[cfg(bootstrap)] #[doc(include = "panic.md")] #[macro_export] @@ -57,16 +53,17 @@ macro_rules! panic { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[allow_internal_unstable(macros_internals)] +#[allow_internal_unstable(core_panic)] macro_rules! assert_eq { ($left:expr, $right:expr $(,)?) => ({ match (&$left, &$right) { (left_val, right_val) => { if !(*left_val == *right_val) { + let kind = $crate::panicking::AssertKind::Eq; // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed("==", &*left_val, &*right_val, $crate::option::Option::None); + $crate::panicking::assert_failed(kind, &*left_val, &*right_val, $crate::option::Option::None); } } } @@ -75,10 +72,11 @@ macro_rules! assert_eq { match (&$left, &$right) { (left_val, right_val) => { if !(*left_val == *right_val) { + let kind = $crate::panicking::AssertKind::Eq; // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed("==", &*left_val, &*right_val, $crate::option::Option::Some($crate::format_args!($($arg)+))); + $crate::panicking::assert_failed(kind, &*left_val, &*right_val, $crate::option::Option::Some($crate::format_args!($($arg)+))); } } } @@ -104,16 +102,17 @@ macro_rules! assert_eq { /// ``` #[macro_export] #[stable(feature = "assert_ne", since = "1.13.0")] -#[allow_internal_unstable(macros_internals)] +#[allow_internal_unstable(core_panic)] macro_rules! assert_ne { ($left:expr, $right:expr $(,)?) => ({ match (&$left, &$right) { (left_val, right_val) => { if *left_val == *right_val { + let kind = $crate::panicking::AssertKind::Ne; // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed("!=", &*left_val, &*right_val, $crate::option::Option::None); + $crate::panicking::assert_failed(kind, &*left_val, &*right_val, $crate::option::Option::None); } } } @@ -122,10 +121,11 @@ macro_rules! assert_ne { match (&($left), &($right)) { (left_val, right_val) => { if *left_val == *right_val { + let kind = $crate::panicking::AssertKind::Ne; // The reborrows below are intentional. Without them, the stack slot for the // borrow is initialized even before the values are compared, leading to a // noticeable slow down. - $crate::macros_internals::assert_failed("!=", &*left_val, &*right_val, $crate::option::Option::Some($crate::format_args!($($arg)+))); + $crate::panicking::assert_failed(kind, &*left_val, &*right_val, $crate::option::Option::Some($crate::format_args!($($arg)+))); } } } diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 25651502510..36ae2449447 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -91,3 +91,52 @@ pub fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! { // SAFETY: `panic_impl` is defined in safe Rust code and thus is safe to call. unsafe { panic_impl(&pi) } } + +#[derive(Debug)] +pub enum AssertKind { + Eq, + Ne, +} + +/// Internal function for `assert_eq!` and `assert_ne!` macros +#[cold] +#[track_caller] +pub fn assert_failed( + kind: AssertKind, + left: &T, + right: &U, + args: Option>, +) -> ! +where + T: fmt::Debug + ?Sized, + U: fmt::Debug + ?Sized, +{ + #[track_caller] + fn inner( + kind: AssertKind, + left: &dyn fmt::Debug, + right: &dyn fmt::Debug, + args: Option>, + ) -> ! { + let op = match kind { + AssertKind::Eq => "==", + AssertKind::Ne => "!=", + }; + + match args { + Some(args) => panic!( + r#"assertion failed: `(left {} right)` + left: `{:?}`, + right: `{:?}: {}`"#, + op, left, right, args + ), + None => panic!( + r#"assertion failed: `(left {} right)` + left: `{:?}`, + right: `{:?}`"#, + op, left, right, + ), + } + } + inner(kind, &left, &right, args) +} diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index 46404f5e33c..c630ab70de1 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -11,7 +11,6 @@ let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _9: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _10: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _12: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _13: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -23,6 +22,10 @@ scope 4 { debug left_val => _11; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _12; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _10: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 5 { + debug kind => _10; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } } } } @@ -65,19 +68,20 @@ } bb1: { - _10 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_10) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_13) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _11, move _12, move _13); // scope 5 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: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } // ty::Const - // + ty: &str - // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) + // + ty: core::panicking::AssertKind + // + val: Value(Scalar(0x00)) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_13) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - core::macros::internals::assert_failed::(move _10, move _11, move _12, move _13); // scope 4 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: for<'r, 's, 't0, 't1> fn(&'r str, &'s i32, &'t0 i32, std::option::Option>) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } + // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } } bb2: { diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index 64b559f6432..c630ab70de1 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -11,9 +11,9 @@ let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _9: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _10: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _12: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -22,6 +22,10 @@ scope 4 { debug left_val => _11; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _12; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _10: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 5 { + debug kind => _10; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } } } } @@ -64,17 +68,20 @@ } bb1: { - _10 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_10) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_13) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _11, move _12, move _13); // scope 5 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: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } // ty::Const - // + ty: &str - // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) + // + ty: core::panicking::AssertKind + // + val: Value(Scalar(0x00)) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } - core::macros::internals::assert_failed::(move _10, move _11, move _12); // scope 4 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: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } + // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } } bb2: { diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index cf1db80bcfc..bd24522271b 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -19,9 +19,8 @@ let mut _17: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _18: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _19: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _20: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _21: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _22: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _21: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _23: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _24: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _25: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -38,6 +37,10 @@ scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 5 { + debug kind => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } } } } @@ -110,30 +113,36 @@ bb3: { StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_20) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = const core::panicking::AssertKind::Eq; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const - // + ty: &str - // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) + // + ty: core::panicking::AssertKind + // + val: Value(Scalar(0x00)) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } - _21 = _22; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = _24; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _26 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = _26; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_27); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_27) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - core::macros::internals::assert_failed::(move _21, move _23, move _25, move _27); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } + StorageLive(_23); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = _13; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = _24; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _14; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = _26; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_27) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 5 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: for<'r, 's, 't0, 't1> fn(&'r str, &'s i32, &'t0 i32, std::option::Option>) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } + // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } + // ty::Const + // + ty: core::panicking::AssertKind + // + val: Value(Scalar(0x00)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } } bb4: { diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index 3d19385c343..bd24522271b 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -19,13 +19,13 @@ let mut _17: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _18: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _19: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _20: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _21: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _22: &str; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _21: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _22: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _23: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _24: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _25: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _26: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _27: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -33,10 +33,14 @@ debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _27: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _28: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 5 { + debug kind => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } } } } @@ -77,14 +81,14 @@ StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _27 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _28 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - _11 = _27; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = _28; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -109,28 +113,36 @@ bb3: { StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = const "=="; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_20) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = const core::panicking::AssertKind::Eq; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const - // + ty: &str - // + val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) + // + ty: core::panicking::AssertKind + // + val: Value(Scalar(0x00)) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [61, 61], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [3], len: Size { raw: 2 } }, size: Size { raw: 2 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 2 }) } - _21 = _22; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = _13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = _24; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _26 = _14; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = _26; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - core::macros::internals::assert_failed::(move _21, move _23, move _25); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } + StorageLive(_23); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = _13; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = _24; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _14; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = _26; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_27) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 5 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: for<'r, 's, 't0> fn(&'r str, &'s i32, &'t0 i32) -> ! {core::macros::internals::assert_failed::}, val: Value(Scalar()) } + // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } + // ty::Const + // + ty: core::panicking::AssertKind + // + val: Value(Scalar(0x00)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } } bb4: { diff --git a/src/test/ui/binop/issue-77910-1.stderr b/src/test/ui/binop/issue-77910-1.stderr index e48d3e19996..2c6d5727527 100644 --- a/src/test/ui/binop/issue-77910-1.stderr +++ b/src/test/ui/binop/issue-77910-1.stderr @@ -14,10 +14,13 @@ error[E0277]: `for<'r> fn(&'r i32) -> &'r i32 {foo}` doesn't implement `Debug` | LL | assert_eq!(foo, y); | ^^^^^^^^^^^^^^^^^^^ `for<'r> fn(&'r i32) -> &'r i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + ::: $SRC_DIR/core/src/panicking.rs:LL:COL + | +LL | T: fmt::Debug + ?Sized, + | ---------- required by this bound in `core::panicking::assert_failed` | = help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}` - = note: required because of the requirements on the impl of `Debug` for `&for<'r> fn(&'r i32) -> &'r i32 {foo}` - = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index 43a6517c8ca..2627724f877 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -85,10 +85,10 @@ error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` LL | assert_eq!(Foo::Bar, i); | ^^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - ::: $SRC_DIR/core/src/macros/internals.rs:LL:COL + ::: $SRC_DIR/core/src/panicking.rs:LL:COL | LL | T: fmt::Debug + ?Sized, - | ---------- required by this bound in `core::macros::internals::assert_failed` + | ---------- required by this bound in `core::panicking::assert_failed` | = help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr index 5623b331f71..20e4b107681 100644 --- a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr +++ b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr @@ -29,10 +29,10 @@ LL | fn a() -> i32 { LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | - ::: $SRC_DIR/core/src/macros/internals.rs:LL:COL + ::: $SRC_DIR/core/src/panicking.rs:LL:COL | LL | T: fmt::Debug + ?Sized, - | ---------- required by this bound in `core::macros::internals::assert_failed` + | ---------- required by this bound in `core::panicking::assert_failed` | = help: the trait `Debug` is not implemented for `fn() -> i32 {a}` = help: use parentheses to call the function: `a()` From a357d86b7c2c4a5089a8669a9c238af547743c8a Mon Sep 17 00:00:00 2001 From: Alphyr <47725341+a1phyr@users.noreply.github.com> Date: Sat, 16 Jan 2021 18:30:22 +0100 Subject: [PATCH 5/6] Hide internals items in documentation Co-authored-by: Joshua Nelson --- library/core/src/panicking.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 36ae2449447..af8a6101392 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -93,6 +93,7 @@ pub fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! { } #[derive(Debug)] +#[doc(hidden)] pub enum AssertKind { Eq, Ne, @@ -101,6 +102,7 @@ pub enum AssertKind { /// Internal function for `assert_eq!` and `assert_ne!` macros #[cold] #[track_caller] +#[doc(hidden)] pub fn assert_failed( kind: AssertKind, left: &T, From 7333759502f9103dfe9f145e0b01ce547c76f165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20du=20Garreau?= Date: Tue, 16 Feb 2021 09:02:13 +0100 Subject: [PATCH 6/6] Fix run-make-fulldeps test --- ...l_assert.-------.InstrumentCoverage.0.html | 18 +-- ...est.main.-------.InstrumentCoverage.0.html | 68 +++------ ...doctests.-------.InstrumentCoverage.0.html | 134 +++++------------- 3 files changed, 65 insertions(+), 155 deletions(-) diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html index b7f3cf0819f..db72a5306ff 100644 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.assert/assert.might_fail_assert.-------.InstrumentCoverage.0.html @@ -70,8 +70,8 @@ For revisions in Pull Requests (PR):
@0,1,2,3,4⦊fn might_fail_assert(one_plus_one: u32) ⦉@0,1,2,3,4{ - @0,1,2,3,4⦊println!("does 1 + 1 = {}?", one_plus_one);⦉@0,1,2,3,4 - assert_eq!(@0,1,2,3,4⦊1 + 1⦉@0,1,2,3,4, one_plus_one, @5,7,8,9,10,11⦊"the argument was wrong"⦉@5,7,8,9,10,11); + assert_eq!(@0,1,2,3,4⦊1 + 1⦉@0,1,2,3,4, one_plus_one, @5,7⦊"the argument was wrong"⦉@5,7); }@6⦊⦉@6
diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html index 93a4004991f..95813decf9f 100644 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest/doctest.main.-------.InstrumentCoverage.0.html @@ -71,56 +71,26 @@ For revisions in Pull Requests (PR):
@0⦊fn main() ⦉@0{ if @0⦊true⦉@0 { - @4⦊@3,5,6,7⦊assert_eq!(1, 1);⦉@3,5,6,7⦉@4 + @4⦊@3⦊assert_eq!(1, 1);⦉@3⦉@4 } else { - @9⦊@8,10,11,12⦊assert_eq!(1, 2);⦉@8,10,11,12⦉@9 + @6⦊@5⦊assert_eq!(1, 2);⦉@5⦉@6 } -}@13⦊⦉@13
+}@7⦊⦉@7 diff --git a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html index f55bb0f32d9..3a41d3482b0 100644 --- a/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html +++ b/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.doctest_crate/doctest_crate.fn_run_in_doctests.-------.InstrumentCoverage.0.html @@ -71,103 +71,43 @@ For revisions in Pull Requests (PR):
@0⦊pub fn fn_run_in_doctests(conditional: usize) ⦉@0{ match @0⦊conditional⦉@0 { - 1 => @7⦊@6,8,9,10⦊assert_eq!(1, 1)⦉@6,8,9,10⦉@7, // this is run, - 2 => @13⦊@12,14,15,16⦊assert_eq!(1, 1)⦉@12,14,15,16⦉@13, // this, - 3 => @19⦊@18,20,21,22⦊assert_eq!(1, 1)⦉@18,20,21,22⦉@19, // and this too - _ => @24⦊@23,25,26,27⦊assert_eq!(1, 2)⦉@23,25,26,27⦉@24, // however this is not + 1 => @7⦊@6⦊assert_eq!(1, 1)⦉@6⦉@7, // this is run, + 2 => @10⦊@9⦊assert_eq!(1, 1)⦉@9⦉@10, // this, + 3 => @13⦊@12⦊assert_eq!(1, 1)⦉@12⦉@13, // and this too + _ => @15⦊@14⦊assert_eq!(1, 2)⦉@14⦉@15, // however this is not } -}@28⦊⦉@28
+}@16⦊⦉@16