about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-12 19:01:00 +0000
committerbors <bors@rust-lang.org>2022-02-12 19:01:00 +0000
commit1945ce6579506787e0b18f0a2ea03fdb4dfc81c7 (patch)
tree5eba45b701fae75841fb4395e8b4420a37f302d8
parentf58f0dfd7261dba0cafc25273d8158b6965c7695 (diff)
parent0ac18e7adb8470588e615365370de28a95e0ea70 (diff)
downloadrust-1945ce6579506787e0b18f0a2ea03fdb4dfc81c7.tar.gz
rust-1945ce6579506787e0b18f0a2ea03fdb4dfc81c7.zip
Auto merge of #93922 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports

This backports:

*  Complete removal of #[main] attribute from compiler #93753
*  Resolve lifetimes for const generic defaults #93669
*  backport llvm fix for issue 91671. #93426
*  Fix invalid special casing of the unreachable! macro #93179
*  Fix hashing for windows paths containing a CurDir component #93697

r? `@Mark-Simulacrum`
-rw-r--r--compiler/rustc_builtin_macros/src/assert.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/edition_panic.rs (renamed from compiler/rustc_builtin_macros/src/panic.rs)25
-rw-r--r--compiler/rustc_builtin_macros/src/lib.rs7
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs1
-rw-r--r--compiler/rustc_hir/src/lang_items.rs1
-rw-r--r--compiler/rustc_lint/src/non_fmt_panic.rs25
-rw-r--r--compiler/rustc_resolve/src/late/lifetimes.rs5
-rw-r--r--compiler/rustc_span/src/symbol.rs6
-rw-r--r--library/core/src/macros/mod.rs16
-rw-r--r--library/core/src/panic.rs33
-rw-r--r--library/core/src/panicking.rs11
-rw-r--r--library/std/src/path.rs26
-rw-r--r--library/std/src/path/tests.rs35
m---------src/llvm-project0
-rw-r--r--src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff10
-rw-r--r--src/test/ui/attributes/main-removed-1.rs2
-rw-r--r--src/test/ui/attributes/main-removed-1.stderr10
-rw-r--r--src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs12
-rw-r--r--src/test/ui/attributes/main-removed-2/main.rs11
-rw-r--r--src/test/ui/const-generics/issue-93647.rs6
-rw-r--r--src/test/ui/const-generics/issue-93647.stderr9
-rw-r--r--src/test/ui/const-generics/outer-lifetime-in-const-generic-default.rs10
-rw-r--r--src/test/ui/const-generics/outer-lifetime-in-const-generic-default.stderr11
-rw-r--r--src/test/ui/consts/const-eval/const_panic.stderr4
-rw-r--r--src/test/ui/consts/const-eval/const_panic_2021.stderr4
-rw-r--r--src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr2
-rw-r--r--src/test/ui/issues/issue-23036.rs1
-rw-r--r--src/test/ui/macros/unreachable-arg.edition_2021.stderr13
-rw-r--r--src/test/ui/macros/unreachable-arg.rs16
-rw-r--r--src/test/ui/macros/unreachable-format-arg.rs15
-rw-r--r--src/test/ui/macros/unreachable-format-args.edition_2015.stderr12
-rw-r--r--src/test/ui/macros/unreachable-format-args.rs14
-rw-r--r--src/test/ui/non-fmt-panic.fixed5
-rw-r--r--src/test/ui/non-fmt-panic.rs5
-rw-r--r--src/test/ui/non-fmt-panic.stderr126
-rw-r--r--src/test/ui/proc-macro/quote-debug.stdout4
-rw-r--r--src/tools/clippy/tests/ui/panic_in_result_fn.stderr2
-rw-r--r--src/tools/clippy/tests/ui/panicking_macros.stderr7
38 files changed, 433 insertions, 71 deletions
diff --git a/compiler/rustc_builtin_macros/src/assert.rs b/compiler/rustc_builtin_macros/src/assert.rs
index 1e2646e4d34..9a45dec55f3 100644
--- a/compiler/rustc_builtin_macros/src/assert.rs
+++ b/compiler/rustc_builtin_macros/src/assert.rs
@@ -1,4 +1,4 @@
-use crate::panic::use_panic_2021;
+use crate::edition_panic::use_panic_2021;
 use rustc_ast::ptr::P;
 use rustc_ast::token;
 use rustc_ast::tokenstream::{DelimSpan, TokenStream};
diff --git a/compiler/rustc_builtin_macros/src/panic.rs b/compiler/rustc_builtin_macros/src/edition_panic.rs
index 54ab596bf3e..518b88dec6a 100644
--- a/compiler/rustc_builtin_macros/src/panic.rs
+++ b/compiler/rustc_builtin_macros/src/edition_panic.rs
@@ -20,8 +20,29 @@ pub fn expand_panic<'cx>(
     sp: Span,
     tts: TokenStream,
 ) -> Box<dyn MacResult + 'cx> {
-    let panic = if use_panic_2021(sp) { sym::panic_2021 } else { sym::panic_2015 };
+    let mac = if use_panic_2021(sp) { sym::panic_2021 } else { sym::panic_2015 };
+    expand(mac, cx, sp, tts)
+}
 
+// This expands to either
+// - `$crate::panic::unreachable_2015!(...)` or
+// - `$crate::panic::unreachable_2021!(...)`
+// depending on the edition.
+pub fn expand_unreachable<'cx>(
+    cx: &'cx mut ExtCtxt<'_>,
+    sp: Span,
+    tts: TokenStream,
+) -> Box<dyn MacResult + 'cx> {
+    let mac = if use_panic_2021(sp) { sym::unreachable_2021 } else { sym::unreachable_2015 };
+    expand(mac, cx, sp, tts)
+}
+
+fn expand<'cx>(
+    mac: rustc_span::Symbol,
+    cx: &'cx mut ExtCtxt<'_>,
+    sp: Span,
+    tts: TokenStream,
+) -> Box<dyn MacResult + 'cx> {
     let sp = cx.with_call_site_ctxt(sp);
 
     MacEager::expr(
@@ -31,7 +52,7 @@ pub fn expand_panic<'cx>(
                 path: Path {
                     span: sp,
                     segments: cx
-                        .std_path(&[sym::panic, panic])
+                        .std_path(&[sym::panic, mac])
                         .into_iter()
                         .map(|ident| PathSegment::from_ident(ident))
                         .collect(),
diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs
index 8c3ef2864f4..e43cece4f17 100644
--- a/compiler/rustc_builtin_macros/src/lib.rs
+++ b/compiler/rustc_builtin_macros/src/lib.rs
@@ -29,13 +29,13 @@ mod concat_bytes;
 mod concat_idents;
 mod derive;
 mod deriving;
+mod edition_panic;
 mod env;
 mod format;
 mod format_foreign;
 mod global_allocator;
 mod llvm_asm;
 mod log_syntax;
-mod panic;
 mod source_util;
 mod test;
 mod trace_macros;
@@ -82,8 +82,9 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
         log_syntax: log_syntax::expand_log_syntax,
         module_path: source_util::expand_mod,
         option_env: env::expand_option_env,
-        core_panic: panic::expand_panic,
-        std_panic: panic::expand_panic,
+        core_panic: edition_panic::expand_panic,
+        std_panic: edition_panic::expand_panic,
+        unreachable: edition_panic::expand_unreachable,
         stringify: source_util::expand_stringify,
         trace_macros: trace_macros::expand_trace_macros,
     }
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index f25b2d8f566..0644948704d 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -339,7 +339,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     ),
 
     // Entry point:
-    ungated!(main, Normal, template!(Word), WarnFollowing),
     ungated!(start, Normal, template!(Word), WarnFollowing),
     ungated!(no_start, CrateLevel, template!(Word), WarnFollowing),
     ungated!(no_main, CrateLevel, template!(Word), WarnFollowing),
diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs
index a03c561861e..add8bd13937 100644
--- a/compiler/rustc_hir/src/lang_items.rs
+++ b/compiler/rustc_hir/src/lang_items.rs
@@ -285,7 +285,6 @@ language_item_table! {
     Panic,                   sym::panic,               panic_fn,                   Target::Fn,             GenericRequirement::Exact(0);
     PanicFmt,                sym::panic_fmt,           panic_fmt,                  Target::Fn,             GenericRequirement::None;
     PanicDisplay,            sym::panic_display,       panic_display,              Target::Fn,             GenericRequirement::None;
-    PanicStr,                sym::panic_str,           panic_str,                  Target::Fn,             GenericRequirement::None;
     ConstPanicFmt,           sym::const_panic_fmt,     const_panic_fmt,            Target::Fn,             GenericRequirement::None;
     PanicBoundsCheck,        sym::panic_bounds_check,  panic_bounds_check_fn,      Target::Fn,             GenericRequirement::Exact(0);
     PanicInfo,               sym::panic_info,          panic_info,                 Target::Struct,         GenericRequirement::None;
diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs
index a919b3c82aa..f2fee67115d 100644
--- a/compiler/rustc_lint/src/non_fmt_panic.rs
+++ b/compiler/rustc_lint/src/non_fmt_panic.rs
@@ -49,9 +49,11 @@ impl<'tcx> LateLintPass<'tcx> for NonPanicFmt {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
         if let hir::ExprKind::Call(f, [arg]) = &expr.kind {
             if let &ty::FnDef(def_id, _) = cx.typeck_results().expr_ty(f).kind() {
+                let f_diagnostic_name = cx.tcx.get_diagnostic_name(def_id);
+
                 if Some(def_id) == cx.tcx.lang_items().begin_panic_fn()
                     || Some(def_id) == cx.tcx.lang_items().panic_fn()
-                    || Some(def_id) == cx.tcx.lang_items().panic_str()
+                    || f_diagnostic_name == Some(sym::panic_str)
                 {
                     if let Some(id) = f.span.ctxt().outer_expn_data().macro_def_id {
                         if matches!(
@@ -61,6 +63,22 @@ impl<'tcx> LateLintPass<'tcx> for NonPanicFmt {
                             check_panic(cx, f, arg);
                         }
                     }
+                } else if f_diagnostic_name == Some(sym::unreachable_display) {
+                    if let Some(id) = f.span.ctxt().outer_expn_data().macro_def_id {
+                        if cx.tcx.is_diagnostic_item(sym::unreachable_2015_macro, id) {
+                            check_panic(
+                                cx,
+                                f,
+                                // This is safe because we checked above that the callee is indeed
+                                // unreachable_display
+                                match &arg.kind {
+                                    // Get the borrowed arg not the borrow
+                                    hir::ExprKind::AddrOf(ast::BorrowKind::Ref, _, arg) => arg,
+                                    _ => bug!("call to unreachable_display without borrow"),
+                                },
+                            );
+                        }
+                    }
                 }
             }
         }
@@ -85,8 +103,8 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
         return;
     }
 
-    // Find the span of the argument to `panic!()`, before expansion in the
-    // case of `panic!(some_macro!())`.
+    // Find the span of the argument to `panic!()` or `unreachable!`, before expansion in the
+    // case of `panic!(some_macro!())` or `unreachable!(some_macro!())`.
     // We don't use source_callsite(), because this `panic!(..)` might itself
     // be expanded from another macro, in which case we want to stop at that
     // expansion.
@@ -319,6 +337,7 @@ fn panic_call<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>) -> (Span,
                 | sym::std_panic_macro
                 | sym::assert_macro
                 | sym::debug_assert_macro
+                | sym::unreachable_macro
         ) {
             break;
         }
diff --git a/compiler/rustc_resolve/src/late/lifetimes.rs b/compiler/rustc_resolve/src/late/lifetimes.rs
index 02e57109bbd..3322e365020 100644
--- a/compiler/rustc_resolve/src/late/lifetimes.rs
+++ b/compiler/rustc_resolve/src/late/lifetimes.rs
@@ -1350,11 +1350,14 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
                             this.visit_ty(&ty);
                         }
                     }
-                    GenericParamKind::Const { ref ty, .. } => {
+                    GenericParamKind::Const { ref ty, default } => {
                         let was_in_const_generic = this.is_in_const_generic;
                         this.is_in_const_generic = true;
                         walk_list!(this, visit_param_bound, param.bounds);
                         this.visit_ty(&ty);
+                        if let Some(default) = default {
+                            this.visit_body(this.tcx.hir().body(default.body));
+                        }
                         this.is_in_const_generic = was_in_const_generic;
                     }
                 }
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 84cf8878af8..e008224ec08 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -1388,7 +1388,13 @@ symbols! {
         unmarked_api,
         unpin,
         unreachable,
+        unreachable_2015,
+        unreachable_2015_macro,
+        unreachable_2021,
+        unreachable_2021_macro,
         unreachable_code,
+        unreachable_display,
+        unreachable_macro,
         unrestricted_attribute_tokens,
         unsafe_block_in_unsafe_fn,
         unsafe_cell,
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index d8f6c85e428..cd2b01e7fc0 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -587,6 +587,22 @@ macro_rules! writeln {
 ///     unreachable!("The loop should always return");
 /// }
 /// ```
+#[cfg(not(bootstrap))]
+#[macro_export]
+#[rustc_builtin_macro(unreachable)]
+#[allow_internal_unstable(edition_panic)]
+#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "unreachable_macro")]
+macro_rules! unreachable {
+    // Expands to either `$crate::panic::unreachable_2015` or `$crate::panic::unreachable_2021`
+    // depending on the edition of the caller.
+    ($($arg:tt)*) => {
+        /* compiler built-in */
+    };
+}
+
+/// unreachable!() macro
+#[cfg(bootstrap)]
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow_internal_unstable(core_panic)]
diff --git a/library/core/src/panic.rs b/library/core/src/panic.rs
index 7a8b04d6f3c..0be3f06ff6c 100644
--- a/library/core/src/panic.rs
+++ b/library/core/src/panic.rs
@@ -58,6 +58,39 @@ pub macro panic_2021 {
     ),
 }
 
+#[doc(hidden)]
+#[unstable(feature = "edition_panic", issue = "none", reason = "use unreachable!() instead")]
+#[allow_internal_unstable(core_panic)]
+#[rustc_diagnostic_item = "unreachable_2015_macro"]
+#[rustc_macro_transparency = "semitransparent"]
+pub macro unreachable_2015 {
+    () => (
+        $crate::panicking::panic("internal error: entered unreachable code")
+    ),
+    // Use of `unreachable_display` for non_fmt_panic lint.
+    // NOTE: the message ("internal error ...") is embeded directly in unreachable_display
+    ($msg:expr $(,)?) => (
+        $crate::panicking::unreachable_display(&$msg)
+    ),
+    ($fmt:expr, $($arg:tt)*) => (
+        $crate::panic!($crate::concat!("internal error: entered unreachable code: ", $fmt), $($arg)*)
+    ),
+}
+
+#[doc(hidden)]
+#[unstable(feature = "edition_panic", issue = "none", reason = "use unreachable!() instead")]
+#[allow_internal_unstable(core_panic)]
+#[rustc_diagnostic_item = "unreachable_2021_macro"]
+#[rustc_macro_transparency = "semitransparent"]
+pub macro unreachable_2021 {
+    () => (
+        $crate::panicking::panic("internal error: entered unreachable code")
+    ),
+    ($($t:tt)+) => (
+        $crate::panic!("internal error: entered unreachable code: {}", $crate::format_args!($($t)+))
+    ),
+}
+
 /// An internal trait used by libstd to pass data from libstd to `panic_unwind`
 /// and other panic runtimes. Not intended to be stabilized any time soon, do
 /// not use.
diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs
index eedea6562bd..422f0e187d4 100644
--- a/library/core/src/panicking.rs
+++ b/library/core/src/panicking.rs
@@ -50,11 +50,20 @@ pub const fn panic(expr: &'static str) -> ! {
 
 #[inline]
 #[track_caller]
-#[lang = "panic_str"] // needed for `non-fmt-panics` lint
+#[rustc_diagnostic_item = "panic_str"]
+#[rustc_const_unstable(feature = "core_panic", issue = "none")]
 pub const fn panic_str(expr: &str) -> ! {
     panic_display(&expr);
 }
 
+#[cfg(not(bootstrap))]
+#[inline]
+#[track_caller]
+#[rustc_diagnostic_item = "unreachable_display"] // needed for `non-fmt-panics` lint
+pub fn unreachable_display<T: fmt::Display>(x: &T) -> ! {
+    panic_fmt(format_args!("internal error: entered unreachable code: {}", *x));
+}
+
 #[inline]
 #[track_caller]
 #[lang = "panic_display"] // needed for const-evaluated panics
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 7d401cff591..bfbcb009f87 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -2899,12 +2899,12 @@ impl cmp::PartialEq for Path {
 impl Hash for Path {
     fn hash<H: Hasher>(&self, h: &mut H) {
         let bytes = self.as_u8_slice();
-        let prefix_len = match parse_prefix(&self.inner) {
+        let (prefix_len, verbatim) = match parse_prefix(&self.inner) {
             Some(prefix) => {
                 prefix.hash(h);
-                prefix.len()
+                (prefix.len(), prefix.is_verbatim())
             }
-            None => 0,
+            None => (0, false),
         };
         let bytes = &bytes[prefix_len..];
 
@@ -2912,7 +2912,8 @@ impl Hash for Path {
         let mut bytes_hashed = 0;
 
         for i in 0..bytes.len() {
-            if is_sep_byte(bytes[i]) {
+            let is_sep = if verbatim { is_verbatim_sep(bytes[i]) } else { is_sep_byte(bytes[i]) };
+            if is_sep {
                 if i > component_start {
                     let to_hash = &bytes[component_start..i];
                     h.write(to_hash);
@@ -2920,11 +2921,18 @@ impl Hash for Path {
                 }
 
                 // skip over separator and optionally a following CurDir item
-                // since components() would normalize these away
-                component_start = i + match bytes[i..] {
-                    [_, b'.', b'/', ..] | [_, b'.'] => 2,
-                    _ => 1,
-                };
+                // since components() would normalize these away.
+                component_start = i + 1;
+
+                let tail = &bytes[component_start..];
+
+                if !verbatim {
+                    component_start += match tail {
+                        [b'.'] => 1,
+                        [b'.', sep @ _, ..] if is_sep_byte(*sep) => 1,
+                        _ => 0,
+                    };
+                }
             }
         }
 
diff --git a/library/std/src/path/tests.rs b/library/std/src/path/tests.rs
index 2bf499e1ab8..0ab5956e1bc 100644
--- a/library/std/src/path/tests.rs
+++ b/library/std/src/path/tests.rs
@@ -1498,6 +1498,20 @@ pub fn test_compare() {
     relative_from: Some("")
     );
 
+    tc!("foo/.", "foo",
+    eq: true,
+    starts_with: true,
+    ends_with: true,
+    relative_from: Some("")
+    );
+
+    tc!("foo/./bar", "foo/bar",
+    eq: true,
+    starts_with: true,
+    ends_with: true,
+    relative_from: Some("")
+    );
+
     tc!("foo/bar", "foo",
     eq: false,
     starts_with: true,
@@ -1541,6 +1555,27 @@ pub fn test_compare() {
         ends_with: true,
         relative_from: Some("")
         );
+
+        tc!(r"C:\foo\.\bar.txt", r"C:\foo\bar.txt",
+        eq: true,
+        starts_with: true,
+        ends_with: true,
+        relative_from: Some("")
+        );
+
+        tc!(r"C:\foo\.", r"C:\foo",
+        eq: true,
+        starts_with: true,
+        ends_with: true,
+        relative_from: Some("")
+        );
+
+        tc!(r"\\?\C:\foo\.\bar.txt", r"\\?\C:\foo\bar.txt",
+        eq: false,
+        starts_with: false,
+        ends_with: false,
+        relative_from: None
+        );
     }
 }
 
diff --git a/src/llvm-project b/src/llvm-project
-Subproject 221a195b62f4373a8893f4d022e4ce981b09a85
+Subproject b6b46f596a7d2523ee1acd1c00e699615849da6
diff --git a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
index 57485993dce..1a454bab4d0 100644
--- a/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
+++ b/src/test/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
@@ -21,7 +21,7 @@
       let mut _19: *const T;               // in scope 0 at $DIR/issue_76432.rs:9:54: 9:68
       let mut _20: *const T;               // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84
       let mut _21: *const T;               // in scope 0 at $DIR/issue_76432.rs:9:70: 9:84
-      let mut _22: !;                      // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+      let mut _22: !;                      // in scope 0 at $SRC_DIR/core/src/panic.rs:LL:COL
       let mut _23: &[T; 3];                // in scope 0 at $DIR/issue_76432.rs:7:19: 7:29
       scope 1 {
           debug v => _2;                   // in scope 1 at $DIR/issue_76432.rs:7:9: 7:10
@@ -66,16 +66,16 @@
       }
   
       bb1: {
-          StorageLive(_22);                // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
-          core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+          StorageLive(_22);                // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL
+          core::panicking::panic(const "internal error: entered unreachable code"); // scope 1 at $SRC_DIR/core/src/panic.rs:LL:COL
                                            // mir::Constant
-                                           // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
+                                           // + span: $SRC_DIR/core/src/panic.rs:LL:COL
                                            // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar(<ZST>)) }
                                            // ty::Const
                                            // + ty: &str
                                            // + val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 })
                                            // mir::Constant
-                                           // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL
+                                           // + span: $SRC_DIR/core/src/panic.rs:LL:COL
                                            // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 58, 32, 101, 110, 116, 101, 114, 101, 100, 32, 117, 110, 114, 101, 97, 99, 104, 97, 98, 108, 101, 32, 99, 111, 100, 101], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [1099511627775], len: Size { raw: 40 } }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 40 }) }
       }
   
diff --git a/src/test/ui/attributes/main-removed-1.rs b/src/test/ui/attributes/main-removed-1.rs
new file mode 100644
index 00000000000..0e887469d44
--- /dev/null
+++ b/src/test/ui/attributes/main-removed-1.rs
@@ -0,0 +1,2 @@
+#[main]  //~ ERROR cannot find attribute `main` in this scope
+fn main() {}
diff --git a/src/test/ui/attributes/main-removed-1.stderr b/src/test/ui/attributes/main-removed-1.stderr
new file mode 100644
index 00000000000..2422c5c3b62
--- /dev/null
+++ b/src/test/ui/attributes/main-removed-1.stderr
@@ -0,0 +1,10 @@
+error: cannot find attribute `main` in this scope
+  --> $DIR/main-removed-1.rs:1:3
+   |
+LL | #[main]
+   |   ^^^^
+   |
+   = note: `main` is in scope, but it is a function, not an attribute
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs b/src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs
new file mode 100644
index 00000000000..196b5be2dd0
--- /dev/null
+++ b/src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs
@@ -0,0 +1,12 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn main(_: TokenStream, input: TokenStream) -> TokenStream {
+    "fn main() { println!(\"Hello Tokyo!\"); }".parse().unwrap()
+}
diff --git a/src/test/ui/attributes/main-removed-2/main.rs b/src/test/ui/attributes/main-removed-2/main.rs
new file mode 100644
index 00000000000..e8fecf825fa
--- /dev/null
+++ b/src/test/ui/attributes/main-removed-2/main.rs
@@ -0,0 +1,11 @@
+// run-pass
+// aux-build:tokyo.rs
+// compile-flags:--extern tokyo
+// edition:2021
+
+use tokyo::main;
+
+#[main]
+fn main() {
+    panic!("the #[main] macro should replace this with non-panicking code")
+}
diff --git a/src/test/ui/const-generics/issue-93647.rs b/src/test/ui/const-generics/issue-93647.rs
new file mode 100644
index 00000000000..6a8fe64d187
--- /dev/null
+++ b/src/test/ui/const-generics/issue-93647.rs
@@ -0,0 +1,6 @@
+struct X<const N: usize = {
+    (||1usize)()
+    //~^ ERROR calls in constants are limited to
+}>;
+
+fn main() {}
diff --git a/src/test/ui/const-generics/issue-93647.stderr b/src/test/ui/const-generics/issue-93647.stderr
new file mode 100644
index 00000000000..0fe54e7de41
--- /dev/null
+++ b/src/test/ui/const-generics/issue-93647.stderr
@@ -0,0 +1,9 @@
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+  --> $DIR/issue-93647.rs:2:5
+   |
+LL |     (||1usize)()
+   |     ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/const-generics/outer-lifetime-in-const-generic-default.rs b/src/test/ui/const-generics/outer-lifetime-in-const-generic-default.rs
new file mode 100644
index 00000000000..3018439afa7
--- /dev/null
+++ b/src/test/ui/const-generics/outer-lifetime-in-const-generic-default.rs
@@ -0,0 +1,10 @@
+struct Foo<
+    'a,
+    const N: usize = {
+        let x: &'a ();
+        //~^ ERROR use of non-static lifetime `'a` in const generic
+        3
+    },
+>(&'a ());
+
+fn main() {}
diff --git a/src/test/ui/const-generics/outer-lifetime-in-const-generic-default.stderr b/src/test/ui/const-generics/outer-lifetime-in-const-generic-default.stderr
new file mode 100644
index 00000000000..9d9555d3f64
--- /dev/null
+++ b/src/test/ui/const-generics/outer-lifetime-in-const-generic-default.stderr
@@ -0,0 +1,11 @@
+error[E0771]: use of non-static lifetime `'a` in const generic
+  --> $DIR/outer-lifetime-in-const-generic-default.rs:4:17
+   |
+LL |         let x: &'a ();
+   |                 ^^
+   |
+   = note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0771`.
diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr
index 8da697fe7ef..2955f11716c 100644
--- a/src/test/ui/consts/const-eval/const_panic.stderr
+++ b/src/test/ui/consts/const-eval/const_panic.stderr
@@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed
 LL | const Y: () = std::unreachable!();
    |               ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:12:15
    |
-   = note: this error originates in the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:15:15
@@ -68,7 +68,7 @@ error[E0080]: evaluation of constant value failed
 LL | const Y_CORE: () = core::unreachable!();
    |                    ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:30:20
    |
-   = note: this error originates in the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:33:20
diff --git a/src/test/ui/consts/const-eval/const_panic_2021.stderr b/src/test/ui/consts/const-eval/const_panic_2021.stderr
index 62fe1715fec..cb3b08e0e09 100644
--- a/src/test/ui/consts/const-eval/const_panic_2021.stderr
+++ b/src/test/ui/consts/const-eval/const_panic_2021.stderr
@@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed
 LL | const C: () = std::unreachable!();
    |               ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:12:15
    |
-   = note: this error originates in the macro `std::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:15:15
@@ -60,7 +60,7 @@ error[E0080]: evaluation of constant value failed
 LL | const C_CORE: () = core::unreachable!();
    |                    ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_2021.rs:27:20
    |
-   = note: this error originates in the macro `core::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_2021.rs:30:20
diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr
index 52c0c136366..417120c453e 100644
--- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr
+++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr
@@ -12,7 +12,7 @@ error[E0080]: evaluation of constant value failed
 LL | const Y: () = unreachable!();
    |               ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:11:15
    |
-   = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_libcore_bin.rs:14:15
diff --git a/src/test/ui/issues/issue-23036.rs b/src/test/ui/issues/issue-23036.rs
index d67f184720e..ac24648e49e 100644
--- a/src/test/ui/issues/issue-23036.rs
+++ b/src/test/ui/issues/issue-23036.rs
@@ -1,4 +1,5 @@
 // run-pass
+// ignore-wasm32-bare FIXME(#93923) llvm miscompilation
 
 use std::collections::HashMap;
 use std::path::Path;
diff --git a/src/test/ui/macros/unreachable-arg.edition_2021.stderr b/src/test/ui/macros/unreachable-arg.edition_2021.stderr
new file mode 100644
index 00000000000..d70ef31eed6
--- /dev/null
+++ b/src/test/ui/macros/unreachable-arg.edition_2021.stderr
@@ -0,0 +1,13 @@
+error: format argument must be a string literal
+  --> $DIR/unreachable-arg.rs:15:18
+   |
+LL |     unreachable!(a);
+   |                  ^
+   |
+help: you might be missing a string literal to format with
+   |
+LL |     unreachable!("{}", a);
+   |                  +++++
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/unreachable-arg.rs b/src/test/ui/macros/unreachable-arg.rs
new file mode 100644
index 00000000000..4024bd20b79
--- /dev/null
+++ b/src/test/ui/macros/unreachable-arg.rs
@@ -0,0 +1,16 @@
+// ignore-emscripten no processes
+
+// revisions: edition_2015 edition_2021
+// [edition_2015]edition:2015
+// [edition_2021]edition:2021
+// [edition_2015]run-fail
+// [edition_2021]check-fail
+// [edition_2015]error-pattern:internal error: entered unreachable code: hello
+// [edition_2021]error-pattern:format argument must be a string literal
+
+#![allow(non_fmt_panics)]
+
+fn main() {
+    let a = "hello";
+    unreachable!(a);
+}
diff --git a/src/test/ui/macros/unreachable-format-arg.rs b/src/test/ui/macros/unreachable-format-arg.rs
new file mode 100644
index 00000000000..ff059ad9e15
--- /dev/null
+++ b/src/test/ui/macros/unreachable-format-arg.rs
@@ -0,0 +1,15 @@
+// run-fail
+// ignore-emscripten no processes
+
+// revisions: edition_2015 edition_2021
+// [edition_2015]edition:2015
+// [edition_2021]edition:2021
+// [edition_2015]error-pattern:internal error: entered unreachable code: x is {x}
+// [edition_2021]error-pattern:internal error: entered unreachable code: x is 5
+
+#![allow(non_fmt_panics)]
+
+fn main() {
+    let x = 5;
+    unreachable!("x is {x}");
+}
diff --git a/src/test/ui/macros/unreachable-format-args.edition_2015.stderr b/src/test/ui/macros/unreachable-format-args.edition_2015.stderr
new file mode 100644
index 00000000000..dda45d14a3f
--- /dev/null
+++ b/src/test/ui/macros/unreachable-format-args.edition_2015.stderr
@@ -0,0 +1,12 @@
+error: there is no argument named `x`
+  --> $DIR/unreachable-format-args.rs:13:5
+   |
+LL |     unreachable!("x is {x} and y is {y}", y = 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: did you intend to capture a variable `x` from the surrounding scope?
+   = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro
+   = note: this error originates in the macro `$crate::concat` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/unreachable-format-args.rs b/src/test/ui/macros/unreachable-format-args.rs
new file mode 100644
index 00000000000..04a31fc1ba3
--- /dev/null
+++ b/src/test/ui/macros/unreachable-format-args.rs
@@ -0,0 +1,14 @@
+// ignore-emscripten no processes
+
+// revisions: edition_2015 edition_2021
+// [edition_2015]edition:2015
+// [edition_2021]edition:2021
+// [edition_2015]check-fail
+// [edition_2021]run-fail
+// [edition_2015]error-pattern:there is no argument named `x`
+// [edition_2021]error-pattern:internal error: entered unreachable code: x is 5 and y is 0
+
+fn main() {
+    let x = 5;
+    unreachable!("x is {x} and y is {y}", y = 0);
+}
diff --git a/src/test/ui/non-fmt-panic.fixed b/src/test/ui/non-fmt-panic.fixed
index d226f4129aa..5191f1877a9 100644
--- a/src/test/ui/non-fmt-panic.fixed
+++ b/src/test/ui/non-fmt-panic.fixed
@@ -11,6 +11,7 @@ static S: &str = "{bla}";
 #[allow(unreachable_code)]
 fn main() {
     panic!("{}", "here's a brace: {"); //~ WARN panic message contains a brace
+    unreachable!("{}", "here's a brace: {"); //~ WARN panic message contains a brace
     std::panic!("{}", "another one: }"); //~ WARN panic message contains a brace
     core::panic!("{}", "Hello {}"); //~ WARN panic message contains an unused formatting placeholder
     assert!(false, "{}", "{:03x} {test} bla");
@@ -24,6 +25,8 @@ fn main() {
     debug_assert!(false, "{}", "{{}} bla"); //~ WARN panic message contains braces
     panic!("{}", C); //~ WARN panic message is not a string literal
     panic!("{}", S); //~ WARN panic message is not a string literal
+    unreachable!("{}", S); //~ WARN panic message is not a string literal
+    unreachable!("{}", S); //~ WARN panic message is not a string literal
     std::panic::panic_any(123); //~ WARN panic message is not a string literal
     core::panic!("{}", &*"abc"); //~ WARN panic message is not a string literal
     std::panic::panic_any(Some(123)); //~ WARN panic message is not a string literal
@@ -41,8 +44,10 @@ fn main() {
     }
 
     std::panic::panic_any(a!()); //~ WARN panic message is not a string literal
+    unreachable!("{}", a!()); //~ WARN panic message is not a string literal
 
     panic!("{}", 1); //~ WARN panic message is not a string literal
+    unreachable!("{}", 1); //~ WARN panic message is not a string literal
     assert!(false, "{}", 1); //~ WARN panic message is not a string literal
     debug_assert!(false, "{}", 1); //~ WARN panic message is not a string literal
 
diff --git a/src/test/ui/non-fmt-panic.rs b/src/test/ui/non-fmt-panic.rs
index 2ffd7638ae0..d0d06b79775 100644
--- a/src/test/ui/non-fmt-panic.rs
+++ b/src/test/ui/non-fmt-panic.rs
@@ -11,6 +11,7 @@ static S: &str = "{bla}";
 #[allow(unreachable_code)]
 fn main() {
     panic!("here's a brace: {"); //~ WARN panic message contains a brace
+    unreachable!("here's a brace: {"); //~ WARN panic message contains a brace
     std::panic!("another one: }"); //~ WARN panic message contains a brace
     core::panic!("Hello {}"); //~ WARN panic message contains an unused formatting placeholder
     assert!(false, "{:03x} {test} bla");
@@ -24,6 +25,8 @@ fn main() {
     debug_assert!(false, "{{}} bla"); //~ WARN panic message contains braces
     panic!(C); //~ WARN panic message is not a string literal
     panic!(S); //~ WARN panic message is not a string literal
+    unreachable!(S); //~ WARN panic message is not a string literal
+    unreachable!(S); //~ WARN panic message is not a string literal
     std::panic!(123); //~ WARN panic message is not a string literal
     core::panic!(&*"abc"); //~ WARN panic message is not a string literal
     panic!(Some(123)); //~ WARN panic message is not a string literal
@@ -41,8 +44,10 @@ fn main() {
     }
 
     panic!(a!()); //~ WARN panic message is not a string literal
+    unreachable!(a!()); //~ WARN panic message is not a string literal
 
     panic!(format!("{}", 1)); //~ WARN panic message is not a string literal
+    unreachable!(format!("{}", 1)); //~ WARN panic message is not a string literal
     assert!(false, format!("{}", 1)); //~ WARN panic message is not a string literal
     debug_assert!(false, format!("{}", 1)); //~ WARN panic message is not a string literal
 
diff --git a/src/test/ui/non-fmt-panic.stderr b/src/test/ui/non-fmt-panic.stderr
index f9e6d895136..3305e5cc906 100644
--- a/src/test/ui/non-fmt-panic.stderr
+++ b/src/test/ui/non-fmt-panic.stderr
@@ -12,7 +12,19 @@ LL |     panic!("{}", "here's a brace: {");
    |            +++++
 
 warning: panic message contains a brace
-  --> $DIR/non-fmt-panic.rs:14:31
+  --> $DIR/non-fmt-panic.rs:14:35
+   |
+LL |     unreachable!("here's a brace: {");
+   |                                   ^
+   |
+   = note: this message is not used as a format string, but will be in Rust 2021
+help: add a "{}" format string to use the message literally
+   |
+LL |     unreachable!("{}", "here's a brace: {");
+   |                  +++++
+
+warning: panic message contains a brace
+  --> $DIR/non-fmt-panic.rs:15:31
    |
 LL |     std::panic!("another one: }");
    |                               ^
@@ -24,7 +36,7 @@ LL |     std::panic!("{}", "another one: }");
    |                 +++++
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/non-fmt-panic.rs:15:25
+  --> $DIR/non-fmt-panic.rs:16:25
    |
 LL |     core::panic!("Hello {}");
    |                         ^^
@@ -40,7 +52,7 @@ LL |     core::panic!("{}", "Hello {}");
    |                  +++++
 
 warning: panic message contains unused formatting placeholders
-  --> $DIR/non-fmt-panic.rs:16:21
+  --> $DIR/non-fmt-panic.rs:17:21
    |
 LL |     assert!(false, "{:03x} {test} bla");
    |                     ^^^^^^ ^^^^^^
@@ -56,7 +68,7 @@ LL |     assert!(false, "{}", "{:03x} {test} bla");
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:18:20
+  --> $DIR/non-fmt-panic.rs:19:20
    |
 LL |     assert!(false, S);
    |                    ^
@@ -69,7 +81,7 @@ LL |     assert!(false, "{}", S);
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:20:20
+  --> $DIR/non-fmt-panic.rs:21:20
    |
 LL |     assert!(false, 123);
    |                    ^^^
@@ -82,7 +94,7 @@ LL |     assert!(false, "{}", 123);
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:22:20
+  --> $DIR/non-fmt-panic.rs:23:20
    |
 LL |     assert!(false, Some(123));
    |                    ^^^^^^^^^
@@ -95,7 +107,7 @@ LL |     assert!(false, "{:?}", Some(123));
    |                    +++++++
 
 warning: panic message contains braces
-  --> $DIR/non-fmt-panic.rs:24:27
+  --> $DIR/non-fmt-panic.rs:25:27
    |
 LL |     debug_assert!(false, "{{}} bla");
    |                           ^^^^
@@ -107,7 +119,7 @@ LL |     debug_assert!(false, "{}", "{{}} bla");
    |                          +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:25:12
+  --> $DIR/non-fmt-panic.rs:26:12
    |
 LL |     panic!(C);
    |            ^
@@ -120,7 +132,7 @@ LL |     panic!("{}", C);
    |            +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:26:12
+  --> $DIR/non-fmt-panic.rs:27:12
    |
 LL |     panic!(S);
    |            ^
@@ -133,7 +145,33 @@ LL |     panic!("{}", S);
    |            +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:27:17
+  --> $DIR/non-fmt-panic.rs:28:18
+   |
+LL |     unreachable!(S);
+   |                  ^
+   |
+   = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+help: add a "{}" format string to Display the message
+   |
+LL |     unreachable!("{}", S);
+   |                  +++++
+
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:29:18
+   |
+LL |     unreachable!(S);
+   |                  ^
+   |
+   = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+help: add a "{}" format string to Display the message
+   |
+LL |     unreachable!("{}", S);
+   |                  +++++
+
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:30:17
    |
 LL |     std::panic!(123);
    |                 ^^^
@@ -150,7 +188,7 @@ LL |     std::panic::panic_any(123);
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:28:18
+  --> $DIR/non-fmt-panic.rs:31:18
    |
 LL |     core::panic!(&*"abc");
    |                  ^^^^^^^
@@ -163,7 +201,7 @@ LL |     core::panic!("{}", &*"abc");
    |                  +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:29:12
+  --> $DIR/non-fmt-panic.rs:32:12
    |
 LL |     panic!(Some(123));
    |            ^^^^^^^^^
@@ -180,7 +218,7 @@ LL |     std::panic::panic_any(Some(123));
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/non-fmt-panic.rs:30:12
+  --> $DIR/non-fmt-panic.rs:33:12
    |
 LL |     panic!(concat!("{", "}"));
    |            ^^^^^^^^^^^^^^^^^
@@ -196,7 +234,7 @@ LL |     panic!("{}", concat!("{", "}"));
    |            +++++
 
 warning: panic message contains braces
-  --> $DIR/non-fmt-panic.rs:31:5
+  --> $DIR/non-fmt-panic.rs:34:5
    |
 LL |     panic!(concat!("{", "{"));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -208,7 +246,7 @@ LL |     panic!("{}", concat!("{", "{"));
    |            +++++
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/non-fmt-panic.rs:33:37
+  --> $DIR/non-fmt-panic.rs:36:37
    |
 LL |     fancy_panic::fancy_panic!("test {} 123");
    |                                     ^^
@@ -216,7 +254,7 @@ LL |     fancy_panic::fancy_panic!("test {} 123");
    = note: this message is not used as a format string when given without arguments, but will be in Rust 2021
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:43:12
+  --> $DIR/non-fmt-panic.rs:46:12
    |
 LL |     panic!(a!());
    |            ^^^^
@@ -233,7 +271,20 @@ LL |     std::panic::panic_any(a!());
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:45:12
+  --> $DIR/non-fmt-panic.rs:47:18
+   |
+LL |     unreachable!(a!());
+   |                  ^^^^
+   |
+   = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+help: add a "{}" format string to Display the message
+   |
+LL |     unreachable!("{}", a!());
+   |                  +++++
+
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:49:12
    |
 LL |     panic!(format!("{}", 1));
    |            ^^^^^^^^^^^^^^^^
@@ -248,7 +299,22 @@ LL +     panic!("{}", 1);
    | 
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:46:20
+  --> $DIR/non-fmt-panic.rs:50:18
+   |
+LL |     unreachable!(format!("{}", 1));
+   |                  ^^^^^^^^^^^^^^^^
+   |
+   = note: this usage of unreachable!() is deprecated; it will be a hard error in Rust 2021
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
+   = note: the unreachable!() macro supports formatting, so there's no need for the format!() macro here
+help: remove the `format!(..)` macro call
+   |
+LL -     unreachable!(format!("{}", 1));
+LL +     unreachable!("{}", 1);
+   | 
+
+warning: panic message is not a string literal
+  --> $DIR/non-fmt-panic.rs:51:20
    |
 LL |     assert!(false, format!("{}", 1));
    |                    ^^^^^^^^^^^^^^^^
@@ -263,7 +329,7 @@ LL +     assert!(false, "{}", 1);
    | 
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:47:26
+  --> $DIR/non-fmt-panic.rs:52:26
    |
 LL |     debug_assert!(false, format!("{}", 1));
    |                          ^^^^^^^^^^^^^^^^
@@ -278,7 +344,7 @@ LL +     debug_assert!(false, "{}", 1);
    | 
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:49:12
+  --> $DIR/non-fmt-panic.rs:54:12
    |
 LL |     panic![123];
    |            ^^^
@@ -295,7 +361,7 @@ LL |     std::panic::panic_any(123);
    |     ~~~~~~~~~~~~~~~~~~~~~~   ~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:50:12
+  --> $DIR/non-fmt-panic.rs:55:12
    |
 LL |     panic!{123};
    |            ^^^
@@ -312,7 +378,7 @@ LL |     std::panic::panic_any(123);
    |     ~~~~~~~~~~~~~~~~~~~~~~   ~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:67:12
+  --> $DIR/non-fmt-panic.rs:72:12
    |
 LL |     panic!(v);
    |     ------ ^
@@ -323,7 +389,7 @@ LL |     panic!(v);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:68:20
+  --> $DIR/non-fmt-panic.rs:73:20
    |
 LL |     assert!(false, v);
    |                    ^
@@ -332,7 +398,7 @@ LL |     assert!(false, v);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:72:12
+  --> $DIR/non-fmt-panic.rs:77:12
    |
 LL |     panic!(v);
    |            ^
@@ -349,7 +415,7 @@ LL |     std::panic::panic_any(v);
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:73:20
+  --> $DIR/non-fmt-panic.rs:78:20
    |
 LL |     assert!(false, v);
    |                    ^
@@ -362,7 +428,7 @@ LL |     assert!(false, "{:?}", v);
    |                    +++++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:77:12
+  --> $DIR/non-fmt-panic.rs:82:12
    |
 LL |     panic!(v);
    |            ^
@@ -379,7 +445,7 @@ LL |     std::panic::panic_any(v);
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:78:20
+  --> $DIR/non-fmt-panic.rs:83:20
    |
 LL |     assert!(false, v);
    |                    ^
@@ -392,7 +458,7 @@ LL |     assert!(false, "{}", v);
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:82:12
+  --> $DIR/non-fmt-panic.rs:87:12
    |
 LL |     panic!(v);
    |            ^
@@ -409,7 +475,7 @@ LL |     std::panic::panic_any(v);
    |     ~~~~~~~~~~~~~~~~~~~~~
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:83:20
+  --> $DIR/non-fmt-panic.rs:88:20
    |
 LL |     assert!(false, v);
    |                    ^
@@ -421,5 +487,5 @@ help: add a "{}" format string to Display the message
 LL |     assert!(false, "{}", v);
    |                    +++++
 
-warning: 30 warnings emitted
+warning: 35 warnings emitted
 
diff --git a/src/test/ui/proc-macro/quote-debug.stdout b/src/test/ui/proc-macro/quote-debug.stdout
index 4bdc04b9ac4..aa87456a771 100644
--- a/src/test/ui/proc-macro/quote-debug.stdout
+++ b/src/test/ui/proc-macro/quote-debug.stdout
@@ -35,9 +35,7 @@ fn main() {
                                                                 lit.set_span(crate::Span::recover_proc_macro_span(2));
                                                                 lit
                                                             } else {
-                                                                {
-                                                                    ::core::panicking::panic("internal error: entered unreachable code")
-                                                                }
+                                                                ::core::panicking::panic("internal error: entered unreachable code")
                                                             }
                                                         })),
      crate::TokenStream::from(crate::TokenTree::Punct(crate::Punct::new('\u{3b}',
diff --git a/src/tools/clippy/tests/ui/panic_in_result_fn.stderr b/src/tools/clippy/tests/ui/panic_in_result_fn.stderr
index 78d09b8b210..8d35c293a7d 100644
--- a/src/tools/clippy/tests/ui/panic_in_result_fn.stderr
+++ b/src/tools/clippy/tests/ui/panic_in_result_fn.stderr
@@ -48,7 +48,7 @@ note: return Err() instead of panicking
    |
 LL |         unreachable!();
    |         ^^^^^^^^^^^^^^
-   = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
   --> $DIR/panic_in_result_fn.rs:21:5
diff --git a/src/tools/clippy/tests/ui/panicking_macros.stderr b/src/tools/clippy/tests/ui/panicking_macros.stderr
index 2b607ff5888..2c6e681d6a1 100644
--- a/src/tools/clippy/tests/ui/panicking_macros.stderr
+++ b/src/tools/clippy/tests/ui/panicking_macros.stderr
@@ -75,7 +75,6 @@ LL |     unreachable!();
    |     ^^^^^^^^^^^^^^
    |
    = note: `-D clippy::unreachable` implied by `-D warnings`
-   = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: usage of the `unreachable!` macro
   --> $DIR/panicking_macros.rs:33:5
@@ -83,7 +82,7 @@ error: usage of the `unreachable!` macro
 LL |     unreachable!("message");
    |     ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in the macro `$crate::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: usage of the `unreachable!` macro
   --> $DIR/panicking_macros.rs:34:5
@@ -91,7 +90,7 @@ error: usage of the `unreachable!` macro
 LL |     unreachable!("{} {}", "panic with", "multiple arguments");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
+   = note: this error originates in the macro `$crate::panic::unreachable_2021` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `panic` should not be present in production code
   --> $DIR/panicking_macros.rs:40:5
@@ -120,8 +119,6 @@ error: usage of the `unreachable!` macro
    |
 LL |     unreachable!();
    |     ^^^^^^^^^^^^^^
-   |
-   = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 16 previous errors