about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bootstrap.example.toml2
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/expr.rs11
-rw-r--r--compiler/rustc_hir_pretty/src/lib.rs23
-rw-r--r--compiler/rustc_interface/src/tests.rs8
-rw-r--r--compiler/rustc_lint/src/builtin.rs2
-rw-r--r--compiler/rustc_lint/src/impl_trait_overcaptures.rs2
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs4
-rw-r--r--compiler/rustc_session/src/config.rs3
-rw-r--r--compiler/rustc_session/src/utils.rs6
-rw-r--r--compiler/rustc_span/src/hygiene.rs172
-rw-r--r--library/alloc/src/ffi/c_str.rs13
-rw-r--r--library/alloc/src/ffi/mod.rs2
-rw-r--r--library/alloc/src/str.rs4
-rw-r--r--library/core/src/ffi/c_str.rs5
-rw-r--r--library/core/src/ffi/mod.rs2
-rw-r--r--library/core/src/iter/adapters/peekable.rs6
-rw-r--r--library/core/src/str/mod.rs6
-rw-r--r--library/std/src/ffi/mod.rs2
-rw-r--r--library/std/src/lib.rs1
-rw-r--r--src/librustdoc/doctest/runner.rs17
-rw-r--r--src/tools/lint-docs/src/lib.rs22
-rw-r--r--tests/pretty/hir-if-else.pp39
-rw-r--r--tests/pretty/hir-if-else.rs59
-rw-r--r--tests/pretty/if-else.pp52
-rw-r--r--tests/pretty/if-else.rs65
-rw-r--r--tests/pretty/never-pattern.pp17
-rw-r--r--tests/pretty/never-pattern.rs16
-rw-r--r--tests/rustdoc-ui/doctest/edition-2024-error-output.stdout4
-rw-r--r--tests/rustdoc-ui/doctest/stdout-and-stderr.rs26
-rw-r--r--tests/rustdoc-ui/doctest/stdout-and-stderr.stdout46
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout94
-rw-r--r--tests/ui/match/issue-82392.stdout14
-rw-r--r--tests/ui/proc-macro/quote/debug.stdout24
33 files changed, 529 insertions, 240 deletions
diff --git a/bootstrap.example.toml b/bootstrap.example.toml
index 72c4492d465..72fd56fb5bd 100644
--- a/bootstrap.example.toml
+++ b/bootstrap.example.toml
@@ -500,7 +500,7 @@
 # building without optimizations takes much longer than optimizing. Further, some platforms
 # fail to build without this optimization (c.f. #65352).
 # The valid options are:
-# true - Enable optimizations.
+# true - Enable optimizations (same as 3).
 # false - Disable optimizations.
 # 0 - Disable optimizations.
 # 1 - Basic optimizations.
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
index df848a26d39..48da9fc63b8 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
@@ -21,7 +21,7 @@ impl<'a> State<'a> {
             match &_else.kind {
                 // Another `else if` block.
                 ast::ExprKind::If(i, then, e) => {
-                    self.cbox(INDENT_UNIT - 1);
+                    self.cbox(0);
                     self.ibox(0);
                     self.word(" else if ");
                     self.print_expr_as_cond(i);
@@ -30,8 +30,8 @@ impl<'a> State<'a> {
                     self.print_else(e.as_deref())
                 }
                 // Final `else` block.
-                ast::ExprKind::Block(b, _) => {
-                    self.cbox(INDENT_UNIT - 1);
+                ast::ExprKind::Block(b, None) => {
+                    self.cbox(0);
                     self.ibox(0);
                     self.word(" else ");
                     self.print_block(b)
@@ -45,7 +45,9 @@ impl<'a> State<'a> {
     }
 
     fn print_if(&mut self, test: &ast::Expr, blk: &ast::Block, elseopt: Option<&ast::Expr>) {
-        self.head("if");
+        self.cbox(0);
+        self.ibox(0);
+        self.word_nbsp("if");
         self.print_expr_as_cond(test);
         self.space();
         self.print_block(blk);
@@ -876,6 +878,7 @@ impl<'a> State<'a> {
                 }
             }
         } else {
+            self.end(); // Close the ibox for the pattern.
             self.word(",");
         }
         self.end(); // Close enclosing cbox.
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index 779fae80f19..c95d6a277c7 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -1064,18 +1064,18 @@ impl<'a> State<'a> {
         if let Some(els_inner) = els {
             match els_inner.kind {
                 // Another `else if` block.
-                hir::ExprKind::If(i, then, e) => {
-                    self.cbox(INDENT_UNIT - 1);
+                hir::ExprKind::If(i, hir::Expr { kind: hir::ExprKind::Block(t, None), .. }, e) => {
+                    self.cbox(0);
                     self.ibox(0);
                     self.word(" else if ");
                     self.print_expr_as_cond(i);
                     self.space();
-                    self.print_expr(then);
+                    self.print_block(t);
                     self.print_else(e);
                 }
                 // Final `else` block.
-                hir::ExprKind::Block(b, _) => {
-                    self.cbox(INDENT_UNIT - 1);
+                hir::ExprKind::Block(b, None) => {
+                    self.cbox(0);
                     self.ibox(0);
                     self.word(" else ");
                     self.print_block(b);
@@ -1094,11 +1094,18 @@ impl<'a> State<'a> {
         blk: &hir::Expr<'_>,
         elseopt: Option<&hir::Expr<'_>>,
     ) {
-        self.head("if");
+        self.cbox(0);
+        self.ibox(0);
+        self.word_nbsp("if");
         self.print_expr_as_cond(test);
         self.space();
-        self.print_expr(blk);
-        self.print_else(elseopt)
+        match blk.kind {
+            hir::ExprKind::Block(blk, None) => {
+                self.print_block(blk);
+                self.print_else(elseopt)
+            }
+            _ => panic!("non-block then expr"),
+        }
     }
 
     fn print_anon_const(&mut self, constant: &hir::AnonConst) {
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs
index 5c8c51c8bbc..0ceda220134 100644
--- a/compiler/rustc_interface/src/tests.rs
+++ b/compiler/rustc_interface/src/tests.rs
@@ -1,7 +1,7 @@
 #![allow(rustc::bad_opt_access)]
-use std::collections::{BTreeMap, BTreeSet};
+use std::collections::BTreeMap;
 use std::num::NonZero;
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
 use std::sync::atomic::AtomicBool;
 
 use rustc_abi::Align;
@@ -89,8 +89,8 @@ where
     S: Into<String>,
     I: IntoIterator<Item = S>,
 {
-    let locations: BTreeSet<CanonicalizedPath> =
-        locations.into_iter().map(|s| CanonicalizedPath::new(Path::new(&s.into()))).collect();
+    let locations =
+        locations.into_iter().map(|s| CanonicalizedPath::new(PathBuf::from(s.into()))).collect();
 
     ExternEntry {
         location: ExternLocation::ExactPaths(locations),
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index e65f4beab24..41b43f64798 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -948,7 +948,7 @@ declare_lint! {
     ///
     /// ### Example
     ///
-    /// ```rust,compile_fail
+    /// ```rust,compile_fail,edition2021
     /// #[no_mangle]
     /// const FOO: i32 = 5;
     /// ```
diff --git a/compiler/rustc_lint/src/impl_trait_overcaptures.rs b/compiler/rustc_lint/src/impl_trait_overcaptures.rs
index f1dc420aa3c..7f4789ad0d9 100644
--- a/compiler/rustc_lint/src/impl_trait_overcaptures.rs
+++ b/compiler/rustc_lint/src/impl_trait_overcaptures.rs
@@ -41,7 +41,7 @@ declare_lint! {
     ///
     /// ### Example
     ///
-    /// ```rust,compile_fail
+    /// ```rust,compile_fail,edition2021
     /// # #![deny(impl_trait_overcaptures)]
     /// # use std::fmt::Display;
     /// let mut x = vec![];
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 17d501c5730..03b8112938c 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -1424,7 +1424,7 @@ declare_lint! {
     ///
     /// ### Example
     ///
-    /// ```rust,compile_fail
+    /// ```rust,compile_fail,edition2021
     /// macro_rules! foo {
     ///    () => {};
     ///    ($name) => { };
@@ -4128,7 +4128,7 @@ declare_lint! {
     ///
     /// ### Example
     ///
-    /// ```rust,compile_fail
+    /// ```rust,compile_fail,edition2021
     /// #![deny(dependency_on_unit_never_type_fallback)]
     /// fn main() {
     ///     if true {
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 43955cc23a9..e2d36f6a4e2 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -2323,14 +2323,13 @@ pub fn parse_externs(
         let ExternOpt { crate_name: name, path, options } =
             split_extern_opt(early_dcx, unstable_opts, &arg).unwrap_or_else(|e| e.emit());
 
-        let path = path.map(|p| CanonicalizedPath::new(p.as_path()));
-
         let entry = externs.entry(name.to_owned());
 
         use std::collections::btree_map::Entry;
 
         let entry = if let Some(path) = path {
             // --extern prelude_name=some_file.rlib
+            let path = CanonicalizedPath::new(path);
             match entry {
                 Entry::Vacant(vacant) => {
                     let files = BTreeSet::from_iter(iter::once(path));
diff --git a/compiler/rustc_session/src/utils.rs b/compiler/rustc_session/src/utils.rs
index 2243e831b66..e9ddd66b5e8 100644
--- a/compiler/rustc_session/src/utils.rs
+++ b/compiler/rustc_session/src/utils.rs
@@ -1,4 +1,4 @@
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
 use std::sync::OnceLock;
 
 use rustc_data_structures::profiling::VerboseTimingGuard;
@@ -104,8 +104,8 @@ pub struct CanonicalizedPath {
 }
 
 impl CanonicalizedPath {
-    pub fn new(path: &Path) -> Self {
-        Self { original: path.to_owned(), canonicalized: try_canonicalize(path).ok() }
+    pub fn new(path: PathBuf) -> Self {
+        Self { canonicalized: try_canonicalize(&path).ok(), original: path }
     }
 
     pub fn canonicalized(&self) -> &PathBuf {
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index 53908914965..ab0a802dc7f 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -72,21 +72,6 @@ struct SyntaxContextData {
 }
 
 impl SyntaxContextData {
-    fn new(
-        (parent, outer_expn, outer_transparency): SyntaxContextKey,
-        opaque: SyntaxContext,
-        opaque_and_semiopaque: SyntaxContext,
-    ) -> SyntaxContextData {
-        SyntaxContextData {
-            outer_expn,
-            outer_transparency,
-            parent,
-            opaque,
-            opaque_and_semiopaque,
-            dollar_crate_name: kw::DollarCrate,
-        }
-    }
-
     fn root() -> SyntaxContextData {
         SyntaxContextData {
             outer_expn: ExpnId::root(),
@@ -98,14 +83,6 @@ impl SyntaxContextData {
         }
     }
 
-    fn decode_placeholder() -> SyntaxContextData {
-        SyntaxContextData { dollar_crate_name: kw::Empty, ..SyntaxContextData::root() }
-    }
-
-    fn is_decode_placeholder(&self) -> bool {
-        self.dollar_crate_name == kw::Empty
-    }
-
     fn key(&self) -> SyntaxContextKey {
         (self.parent, self.outer_expn, self.outer_transparency)
     }
@@ -148,7 +125,7 @@ impl !PartialOrd for LocalExpnId {}
 /// with a non-default mode. With this check in place, we can avoid the need
 /// to maintain separate versions of `ExpnData` hashes for each permutation
 /// of `HashingControls` settings.
-fn assert_default_hashing_controls<CTX: HashStableContext>(ctx: &CTX, msg: &str) {
+fn assert_default_hashing_controls(ctx: &impl HashStableContext, msg: &str) {
     match ctx.hashing_controls() {
         // Note that we require that `hash_spans` be set according to the global
         // `-Z incremental-ignore-spans` option. Normally, this option is disabled,
@@ -416,7 +393,7 @@ impl HygieneData {
         }
     }
 
-    fn with<T, F: FnOnce(&mut HygieneData) -> T>(f: F) -> T {
+    fn with<R>(f: impl FnOnce(&mut HygieneData) -> R) -> R {
         with_session_globals(|session_globals| f(&mut session_globals.hygiene_data.borrow_mut()))
     }
 
@@ -460,28 +437,23 @@ impl HygieneData {
     }
 
     fn normalize_to_macros_2_0(&self, ctxt: SyntaxContext) -> SyntaxContext {
-        debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
         self.syntax_context_data[ctxt.0 as usize].opaque
     }
 
     fn normalize_to_macro_rules(&self, ctxt: SyntaxContext) -> SyntaxContext {
-        debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
         self.syntax_context_data[ctxt.0 as usize].opaque_and_semiopaque
     }
 
     fn outer_expn(&self, ctxt: SyntaxContext) -> ExpnId {
-        debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
         self.syntax_context_data[ctxt.0 as usize].outer_expn
     }
 
     fn outer_mark(&self, ctxt: SyntaxContext) -> (ExpnId, Transparency) {
-        debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
         let data = &self.syntax_context_data[ctxt.0 as usize];
         (data.outer_expn, data.outer_transparency)
     }
 
     fn parent_ctxt(&self, ctxt: SyntaxContext) -> SyntaxContext {
-        debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
         self.syntax_context_data[ctxt.0 as usize].parent
     }
 
@@ -592,8 +564,6 @@ impl HygieneData {
         expn_id: ExpnId,
         transparency: Transparency,
     ) -> SyntaxContext {
-        debug_assert!(!self.syntax_context_data[parent.0 as usize].is_decode_placeholder());
-
         // Look into the cache first.
         let key = (parent, expn_id, transparency);
         if let Some(ctxt) = self.syntax_context_map.get(&key) {
@@ -601,16 +571,20 @@ impl HygieneData {
         }
 
         // Reserve a new syntax context.
+        // The inserted dummy data can only be potentially accessed by nested `alloc_ctxt` calls,
+        // the assert below ensures that it doesn't happen.
         let ctxt = SyntaxContext::from_usize(self.syntax_context_data.len());
-        self.syntax_context_data.push(SyntaxContextData::decode_placeholder());
+        self.syntax_context_data
+            .push(SyntaxContextData { dollar_crate_name: sym::dummy, ..SyntaxContextData::root() });
         self.syntax_context_map.insert(key, ctxt);
 
         // Opaque and semi-opaque versions of the parent. Note that they may be equal to the
         // parent itself. E.g. `parent_opaque` == `parent` if the expn chain contains only opaques,
         // and `parent_opaque_and_semiopaque` == `parent` if the expn contains only (semi-)opaques.
-        let parent_opaque = self.syntax_context_data[parent.0 as usize].opaque;
-        let parent_opaque_and_semiopaque =
-            self.syntax_context_data[parent.0 as usize].opaque_and_semiopaque;
+        let parent_data = &self.syntax_context_data[parent.0 as usize];
+        assert_ne!(parent_data.dollar_crate_name, sym::dummy);
+        let parent_opaque = parent_data.opaque;
+        let parent_opaque_and_semiopaque = parent_data.opaque_and_semiopaque;
 
         // Evaluate opaque and semi-opaque versions of the new syntax context.
         let (opaque, opaque_and_semiopaque) = match transparency {
@@ -629,8 +603,14 @@ impl HygieneData {
         };
 
         // Fill the full data, now that we have it.
-        self.syntax_context_data[ctxt.as_u32() as usize] =
-            SyntaxContextData::new(key, opaque, opaque_and_semiopaque);
+        self.syntax_context_data[ctxt.as_u32() as usize] = SyntaxContextData {
+            outer_expn: expn_id,
+            outer_transparency: transparency,
+            parent,
+            opaque,
+            opaque_and_semiopaque,
+            dollar_crate_name: kw::DollarCrate,
+        };
         ctxt
     }
 }
@@ -650,13 +630,12 @@ pub fn walk_chain_collapsed(span: Span, to: Span) -> Span {
 
 pub fn update_dollar_crate_names(mut get_name: impl FnMut(SyntaxContext) -> Symbol) {
     // The new contexts that need updating are at the end of the list and have `$crate` as a name.
-    // Also decoding placeholders can be encountered among both old and new contexts.
     let mut to_update = vec![];
     HygieneData::with(|data| {
         for (idx, scdata) in data.syntax_context_data.iter().enumerate().rev() {
             if scdata.dollar_crate_name == kw::DollarCrate {
                 to_update.push((idx, kw::DollarCrate));
-            } else if !scdata.is_decode_placeholder() {
+            } else {
                 break;
             }
         }
@@ -922,10 +901,7 @@ impl SyntaxContext {
     }
 
     pub(crate) fn dollar_crate_name(self) -> Symbol {
-        HygieneData::with(|data| {
-            debug_assert!(!data.syntax_context_data[self.0 as usize].is_decode_placeholder());
-            data.syntax_context_data[self.0 as usize].dollar_crate_name
-        })
+        HygieneData::with(|data| data.syntax_context_data[self.0 as usize].dollar_crate_name)
     }
 
     pub fn edition(self) -> Edition {
@@ -1293,49 +1269,47 @@ impl HygieneEncodeContext {
                 self.latest_ctxts
             );
 
-            // Consume the current round of SyntaxContexts.
-            // Drop the lock() temporary early
-            let latest_ctxts = { mem::take(&mut *self.latest_ctxts.lock()) };
-
-            // It's fine to iterate over a HashMap, because the serialization
-            // of the table that we insert data into doesn't depend on insertion
-            // order
+            // Consume the current round of syntax contexts.
+            // Drop the lock() temporary early.
+            // It's fine to iterate over a HashMap, because the serialization of the table
+            // that we insert data into doesn't depend on insertion order.
             #[allow(rustc::potential_query_instability)]
-            for_all_ctxts_in(latest_ctxts.into_iter(), |index, ctxt, data| {
+            let latest_ctxts = { mem::take(&mut *self.latest_ctxts.lock()) }.into_iter();
+            let all_ctxt_data: Vec<_> = HygieneData::with(|data| {
+                latest_ctxts
+                    .map(|ctxt| (ctxt, data.syntax_context_data[ctxt.0 as usize].key()))
+                    .collect()
+            });
+            for (ctxt, ctxt_key) in all_ctxt_data {
                 if self.serialized_ctxts.lock().insert(ctxt) {
-                    encode_ctxt(encoder, index, data);
+                    encode_ctxt(encoder, ctxt.0, &ctxt_key);
                 }
-            });
-
-            let latest_expns = { mem::take(&mut *self.latest_expns.lock()) };
+            }
 
-            // Same as above, this is fine as we are inserting into a order-independent hashset
+            // Same as above, but for expansions instead of syntax contexts.
             #[allow(rustc::potential_query_instability)]
-            for_all_expns_in(latest_expns.into_iter(), |expn, data, hash| {
+            let latest_expns = { mem::take(&mut *self.latest_expns.lock()) }.into_iter();
+            let all_expn_data: Vec<_> = HygieneData::with(|data| {
+                latest_expns
+                    .map(|expn| (expn, data.expn_data(expn).clone(), data.expn_hash(expn)))
+                    .collect()
+            });
+            for (expn, expn_data, expn_hash) in all_expn_data {
                 if self.serialized_expns.lock().insert(expn) {
-                    encode_expn(encoder, expn, data, hash);
+                    encode_expn(encoder, expn, &expn_data, expn_hash);
                 }
-            });
+            }
         }
         debug!("encode_hygiene: Done serializing SyntaxContextData");
     }
 }
 
-#[derive(Default)]
 /// Additional information used to assist in decoding hygiene data
-struct HygieneDecodeContextInner {
-    // Maps serialized `SyntaxContext` ids to a `SyntaxContext` in the current
-    // global `HygieneData`. When we deserialize a `SyntaxContext`, we need to create
-    // a new id in the global `HygieneData`. This map tracks the ID we end up picking,
-    // so that multiple occurrences of the same serialized id are decoded to the same
-    // `SyntaxContext`. This only stores `SyntaxContext`s which are completely decoded.
-    remapped_ctxts: Vec<Option<SyntaxContext>>,
-}
-
 #[derive(Default)]
-/// Additional information used to assist in decoding hygiene data
 pub struct HygieneDecodeContext {
-    inner: Lock<HygieneDecodeContextInner>,
+    // A cache mapping raw serialized per-crate syntax context ids to corresponding decoded
+    // `SyntaxContext`s in the current global `HygieneData`.
+    remapped_ctxts: Lock<IndexVec<u32, Option<SyntaxContext>>>,
 }
 
 /// Register an expansion which has been decoded from the on-disk-cache for the local crate.
@@ -1406,10 +1380,10 @@ pub fn decode_expn_id(
 // to track which `SyntaxContext`s we have already decoded.
 // The provided closure will be invoked to deserialize a `SyntaxContextData`
 // if we haven't already seen the id of the `SyntaxContext` we are deserializing.
-pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContextKey>(
+pub fn decode_syntax_context<D: Decoder>(
     d: &mut D,
     context: &HygieneDecodeContext,
-    decode_data: F,
+    decode_data: impl FnOnce(&mut D, u32) -> SyntaxContextKey,
 ) -> SyntaxContext {
     let raw_id: u32 = Decodable::decode(d);
     if raw_id == 0 {
@@ -1418,12 +1392,11 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
         return SyntaxContext::root();
     }
 
+    // Look into the cache first.
     // Reminder: `HygieneDecodeContext` is per-crate, so there are no collisions between
     // raw ids from different crate metadatas.
-    if let Some(ctxt) = context.inner.lock().remapped_ctxts.get(raw_id as usize).copied().flatten()
-    {
-        // This has already been decoded.
-        return ctxt;
+    if let Some(Some(ctxt)) = context.remapped_ctxts.lock().get(raw_id) {
+        return *ctxt;
     }
 
     // Don't try to decode data while holding the lock, since we need to
@@ -1432,48 +1405,11 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
     let ctxt =
         HygieneData::with(|hygiene_data| hygiene_data.alloc_ctxt(parent, expn_id, transparency));
 
-    let mut inner = context.inner.lock();
-    let new_len = raw_id as usize + 1;
-    if inner.remapped_ctxts.len() < new_len {
-        inner.remapped_ctxts.resize(new_len, None);
-    }
-    inner.remapped_ctxts[raw_id as usize] = Some(ctxt);
+    context.remapped_ctxts.lock().insert(raw_id, ctxt);
 
     ctxt
 }
 
-fn for_all_ctxts_in<F: FnMut(u32, SyntaxContext, &SyntaxContextKey)>(
-    ctxts: impl Iterator<Item = SyntaxContext>,
-    mut f: F,
-) {
-    let all_data: Vec<_> = HygieneData::with(|data| {
-        ctxts
-            .map(|ctxt| {
-                (ctxt, {
-                    let item = data.syntax_context_data[ctxt.0 as usize];
-                    debug_assert!(!item.is_decode_placeholder());
-                    item.key()
-                })
-            })
-            .collect()
-    });
-    for (ctxt, data) in all_data.into_iter() {
-        f(ctxt.0, ctxt, &data);
-    }
-}
-
-fn for_all_expns_in(
-    expns: impl Iterator<Item = ExpnId>,
-    mut f: impl FnMut(ExpnId, &ExpnData, ExpnHash),
-) {
-    let all_data: Vec<_> = HygieneData::with(|data| {
-        expns.map(|expn| (expn, data.expn_data(expn).clone(), data.expn_hash(expn))).collect()
-    });
-    for (expn, data, hash) in all_data.into_iter() {
-        f(expn, &data, hash);
-    }
-}
-
 impl<E: SpanEncoder> Encodable<E> for LocalExpnId {
     fn encode(&self, e: &mut E) {
         self.to_expn_id().encode(e);
@@ -1486,10 +1422,10 @@ impl<D: SpanDecoder> Decodable<D> for LocalExpnId {
     }
 }
 
-pub fn raw_encode_syntax_context<E: Encoder>(
+pub fn raw_encode_syntax_context(
     ctxt: SyntaxContext,
     context: &HygieneEncodeContext,
-    e: &mut E,
+    e: &mut impl Encoder,
 ) {
     if !context.serialized_ctxts.lock().contains(&ctxt) {
         context.latest_ctxts.lock().insert(ctxt);
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs
index d5b19470e31..8b448a18402 100644
--- a/library/alloc/src/ffi/c_str.rs
+++ b/library/alloc/src/ffi/c_str.rs
@@ -351,9 +351,14 @@ impl CString {
     /// # Safety
     ///
     /// This should only ever be called with a pointer that was earlier
-    /// obtained by calling [`CString::into_raw`]. Other usage (e.g., trying to take
-    /// ownership of a string that was allocated by foreign code) is likely to lead
-    /// to undefined behavior or allocator corruption.
+    /// obtained by calling [`CString::into_raw`], and the memory it points to must not be accessed
+    /// through any other pointer during the lifetime of reconstructed `CString`.
+    /// Other usage (e.g., trying to take ownership of a string that was allocated by foreign code)
+    /// is likely to lead to undefined behavior or allocator corruption.
+    ///
+    /// This function does not validate ownership of the raw pointer's memory.
+    /// A double-free may occur if the function is called twice on the same raw pointer.
+    /// Additionally, the caller must ensure the pointer is not dangling.
     ///
     /// It should be noted that the length isn't just "recomputed," but that
     /// the recomputed length must match the original length from the
@@ -818,6 +823,7 @@ impl From<Vec<NonZero<u8>>> for CString {
     }
 }
 
+#[stable(feature = "c_string_from_str", since = "1.85.0")]
 impl FromStr for CString {
     type Err = NulError;
 
@@ -830,6 +836,7 @@ impl FromStr for CString {
     }
 }
 
+#[stable(feature = "c_string_from_str", since = "1.85.0")]
 impl TryFrom<CString> for String {
     type Error = IntoStringError;
 
diff --git a/library/alloc/src/ffi/mod.rs b/library/alloc/src/ffi/mod.rs
index 695d7ad07cf..05a2763a225 100644
--- a/library/alloc/src/ffi/mod.rs
+++ b/library/alloc/src/ffi/mod.rs
@@ -87,5 +87,5 @@ pub use self::c_str::CString;
 #[stable(feature = "alloc_c_string", since = "1.64.0")]
 pub use self::c_str::{FromVecWithNulError, IntoStringError, NulError};
 
-#[unstable(feature = "c_str_module", issue = "112134")]
+#[stable(feature = "c_str_module", since = "CURRENT_RUSTC_VERSION")]
 pub mod c_str;
diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs
index 0664f2c3cf2..24c5d4c92f7 100644
--- a/library/alloc/src/str.rs
+++ b/library/alloc/src/str.rs
@@ -603,6 +603,10 @@ impl str {
 /// Converts a boxed slice of bytes to a boxed string slice without checking
 /// that the string contains valid UTF-8.
 ///
+/// # Safety
+///
+/// * The provided bytes must contain a valid UTF-8 sequence.
+///
 /// # Examples
 ///
 /// ```
diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs
index 85e87445a1b..ac07c645c01 100644
--- a/library/core/src/ffi/c_str.rs
+++ b/library/core/src/ffi/c_str.rs
@@ -79,8 +79,9 @@ use crate::{fmt, ops, slice, str};
 ///
 /// fn my_string_safe() -> String {
 ///     let cstr = unsafe { CStr::from_ptr(my_string()) };
-///     // Get copy-on-write Cow<'_, str>, then guarantee a freshly-owned String allocation
-///     String::from_utf8_lossy(cstr.to_bytes()).to_string()
+///     // Get a copy-on-write Cow<'_, str>, then extract the
+///     // allocated String (or allocate a fresh one if needed).
+///     cstr.to_string_lossy().into_owned()
 /// }
 ///
 /// println!("string: {}", my_string_safe());
diff --git a/library/core/src/ffi/mod.rs b/library/core/src/ffi/mod.rs
index 9bae5fd466a..c9c73a25d89 100644
--- a/library/core/src/ffi/mod.rs
+++ b/library/core/src/ffi/mod.rs
@@ -20,7 +20,7 @@ pub use self::c_str::FromBytesUntilNulError;
 pub use self::c_str::FromBytesWithNulError;
 use crate::fmt;
 
-#[unstable(feature = "c_str_module", issue = "112134")]
+#[stable(feature = "c_str_module", since = "CURRENT_RUSTC_VERSION")]
 pub mod c_str;
 
 #[unstable(
diff --git a/library/core/src/iter/adapters/peekable.rs b/library/core/src/iter/adapters/peekable.rs
index cc12cd9c356..a6522659620 100644
--- a/library/core/src/iter/adapters/peekable.rs
+++ b/library/core/src/iter/adapters/peekable.rs
@@ -271,7 +271,7 @@ impl<I: Iterator> Peekable<I> {
     /// assert_eq!(iter.next_if(|&x| x == 0), Some(0));
     /// // The next item returned is now 1, so `next_if` will return `None`.
     /// assert_eq!(iter.next_if(|&x| x == 0), None);
-    /// // `next_if` saves the value of the next item if it was not equal to `expected`.
+    /// // `next_if` retains the next item if the predicate evaluates to `false` for it.
     /// assert_eq!(iter.next(), Some(1));
     /// ```
     ///
@@ -304,9 +304,9 @@ impl<I: Iterator> Peekable<I> {
     /// let mut iter = (0..5).peekable();
     /// // The first item of the iterator is 0; consume it.
     /// assert_eq!(iter.next_if_eq(&0), Some(0));
-    /// // The next item returned is now 1, so `next_if` will return `None`.
+    /// // The next item returned is now 1, so `next_if_eq` will return `None`.
     /// assert_eq!(iter.next_if_eq(&0), None);
-    /// // `next_if_eq` saves the value of the next item if it was not equal to `expected`.
+    /// // `next_if_eq` retains the next item if it was not equal to `expected`.
     /// assert_eq!(iter.next(), Some(1));
     /// ```
     #[stable(feature = "peekable_next_if", since = "1.51.0")]
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs
index 79b4953fcc1..fe35bfdbdf7 100644
--- a/library/core/src/str/mod.rs
+++ b/library/core/src/str/mod.rs
@@ -2115,7 +2115,7 @@ impl str {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_diagnostic_item = "str_trim"]
     pub fn trim(&self) -> &str {
-        self.trim_matches(|c: char| c.is_whitespace())
+        self.trim_matches(char::is_whitespace)
     }
 
     /// Returns a string slice with leading whitespace removed.
@@ -2154,7 +2154,7 @@ impl str {
     #[stable(feature = "trim_direction", since = "1.30.0")]
     #[rustc_diagnostic_item = "str_trim_start"]
     pub fn trim_start(&self) -> &str {
-        self.trim_start_matches(|c: char| c.is_whitespace())
+        self.trim_start_matches(char::is_whitespace)
     }
 
     /// Returns a string slice with trailing whitespace removed.
@@ -2193,7 +2193,7 @@ impl str {
     #[stable(feature = "trim_direction", since = "1.30.0")]
     #[rustc_diagnostic_item = "str_trim_end"]
     pub fn trim_end(&self) -> &str {
-        self.trim_end_matches(|c: char| c.is_whitespace())
+        self.trim_end_matches(char::is_whitespace)
     }
 
     /// Returns a string slice with leading whitespace removed.
diff --git a/library/std/src/ffi/mod.rs b/library/std/src/ffi/mod.rs
index d34e3ca00b9..bd9446f5aba 100644
--- a/library/std/src/ffi/mod.rs
+++ b/library/std/src/ffi/mod.rs
@@ -161,7 +161,7 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
-#[unstable(feature = "c_str_module", issue = "112134")]
+#[stable(feature = "c_str_module", since = "CURRENT_RUSTC_VERSION")]
 pub mod c_str;
 
 #[stable(feature = "core_c_void", since = "1.30.0")]
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index f77bf92a806..3c22b8a5589 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -329,7 +329,6 @@
 #![feature(array_chunks)]
 #![feature(bstr)]
 #![feature(bstr_internals)]
-#![feature(c_str_module)]
 #![feature(char_internals)]
 #![feature(clone_to_uninit)]
 #![feature(core_intrinsics)]
diff --git a/src/librustdoc/doctest/runner.rs b/src/librustdoc/doctest/runner.rs
index 784d628805d..39a4f23560a 100644
--- a/src/librustdoc/doctest/runner.rs
+++ b/src/librustdoc/doctest/runner.rs
@@ -131,7 +131,22 @@ mod __doctest_mod {{
             .output()
             .expect(\"failed to run command\");
         if !out.status.success() {{
-            eprint!(\"{{}}\", String::from_utf8_lossy(&out.stderr));
+            if let Some(code) = out.status.code() {{
+                eprintln!(\"Test executable failed (exit status: {{code}}).\");
+            }} else {{
+                eprintln!(\"Test executable failed (terminated by signal).\");
+            }}
+            if !out.stdout.is_empty() || !out.stderr.is_empty() {{
+                eprintln!();
+            }}
+            if !out.stdout.is_empty() {{
+                eprintln!(\"stdout:\");
+                eprintln!(\"{{}}\", String::from_utf8_lossy(&out.stdout));
+            }}
+            if !out.stderr.is_empty() {{
+                eprintln!(\"stderr:\");
+                eprintln!(\"{{}}\", String::from_utf8_lossy(&out.stderr));
+            }}
             ExitCode::FAILURE
         }} else {{
             ExitCode::SUCCESS
diff --git a/src/tools/lint-docs/src/lib.rs b/src/tools/lint-docs/src/lib.rs
index 9fd33e23204..d6c69d39e17 100644
--- a/src/tools/lint-docs/src/lib.rs
+++ b/src/tools/lint-docs/src/lib.rs
@@ -444,21 +444,15 @@ impl<'a> LintExtractor<'a> {
         fs::write(&tempfile, source)
             .map_err(|e| format!("failed to write {}: {}", tempfile.display(), e))?;
         let mut cmd = Command::new(self.rustc_path);
-        if options.contains(&"edition2024") {
-            cmd.arg("--edition=2024");
-            cmd.arg("-Zunstable-options");
-        } else if options.contains(&"edition2021") {
-            cmd.arg("--edition=2021");
-        } else if options.contains(&"edition2018") {
-            cmd.arg("--edition=2018");
-        } else if options.contains(&"edition2015") {
-            cmd.arg("--edition=2015");
-        } else if options.contains(&"edition") {
-            panic!("lint-docs: unknown edition");
-        } else {
+        let edition = options
+            .iter()
+            .filter_map(|opt| opt.strip_prefix("edition"))
+            .next()
             // defaults to latest edition
-            cmd.arg("--edition=2021");
-        }
+            .unwrap_or("2024");
+        cmd.arg(format!("--edition={edition}"));
+        // Just in case this is an unstable edition.
+        cmd.arg("-Zunstable-options");
         cmd.arg("--error-format=json");
         cmd.arg("--target").arg(self.rustc_target);
         if let Some(target_linker) = self.rustc_linker {
diff --git a/tests/pretty/hir-if-else.pp b/tests/pretty/hir-if-else.pp
new file mode 100644
index 00000000000..200e34ac4f5
--- /dev/null
+++ b/tests/pretty/hir-if-else.pp
@@ -0,0 +1,39 @@
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-if-else.pp
+
+fn f(x: u32,
+    y:
+        u32) {
+    let mut a = 0;
+    if x > y { a = 1; } else { a = 2; }
+
+    if x < 1 {
+        a = 1;
+    } else if x < 2 {
+        a = 2;
+    } else if x < 3 { a = 3; } else if x < 4 { a = 4; } else { a = 5; }
+
+    if x < y {
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+    } else { a += 1; a += 1; a += 1; a += 1; a += 1; a += 1; }
+
+    if x < 1 {
+        if x < 2 {
+            if x < 3 {
+                a += 1;
+            } else if x < 4 { a += 1; if x < 5 { a += 1; } }
+        } else if x < 6 { a += 1; }
+    }
+}
+
+fn main() { f(3, 4); }
diff --git a/tests/pretty/hir-if-else.rs b/tests/pretty/hir-if-else.rs
new file mode 100644
index 00000000000..a1cc7504f89
--- /dev/null
+++ b/tests/pretty/hir-if-else.rs
@@ -0,0 +1,59 @@
+//@ pretty-compare-only
+//@ pretty-mode:hir
+//@ pp-exact:hir-if-else.pp
+
+fn f(x: u32, y: u32) {
+    let mut a = 0;
+    if x > y {
+        a = 1;
+    } else {
+        a = 2;
+    }
+
+    if x < 1 {
+        a = 1;
+    } else if x < 2 {
+        a = 2;
+    } else if x < 3 {
+        a = 3;
+    } else if x < 4 {
+        a = 4;
+    } else {
+        a = 5;
+    }
+
+    if x < y {
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+    } else {
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+    }
+
+    if x < 1 {
+        if x < 2 {
+            if x < 3 {
+                a += 1;
+            } else if x < 4 {
+                a += 1;
+                if x < 5 {
+                    a += 1;
+                }
+            }
+        } else if x < 6 {
+            a += 1;
+        }
+    }
+}
+
+fn main() {
+    f(3, 4);
+}
diff --git a/tests/pretty/if-else.pp b/tests/pretty/if-else.pp
new file mode 100644
index 00000000000..d4ff02c5441
--- /dev/null
+++ b/tests/pretty/if-else.pp
@@ -0,0 +1,52 @@
+#![feature(prelude_import)]
+#![no_std]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+//@ pretty-compare-only
+//@ pretty-mode:expanded
+//@ pp-exact:if-else.pp
+
+fn f(x: u32, y: u32) {
+    let mut a = 0;
+    if x > y { a = 1; } else { a = 2; }
+
+    if x < 1 {
+        a = 1;
+    } else if x < 2 {
+        a = 2;
+    } else if x < 3 { a = 3; } else if x < 4 { a = 4; } else { a = 5; }
+
+    if x < y {
+        a += 1;
+        a += 1;
+        a += 1;
+    } else {
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+    }
+
+    if x < 1 {
+        if x < 2 {
+            if x < 3 {
+                a += 1;
+            } else if x < 4 { a += 1; if x < 5 { a += 1; } }
+        } else if x < 6 { a += 1; }
+    }
+}
+
+fn main() { f(3, 4); }
diff --git a/tests/pretty/if-else.rs b/tests/pretty/if-else.rs
new file mode 100644
index 00000000000..b4085ea5606
--- /dev/null
+++ b/tests/pretty/if-else.rs
@@ -0,0 +1,65 @@
+//@ pretty-compare-only
+//@ pretty-mode:expanded
+//@ pp-exact:if-else.pp
+
+fn f(x: u32, y: u32) {
+    let mut a = 0;
+    if x > y {
+        a = 1;
+    } else {
+        a = 2;
+    }
+
+    if x < 1 {
+        a = 1;
+    } else if x < 2 {
+        a = 2;
+    } else if x < 3 {
+        a = 3;
+    } else if x < 4 {
+        a = 4;
+    } else {
+        a = 5;
+    }
+
+    if x < y {
+        a += 1;
+        a += 1;
+        a += 1;
+    } else {
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+        a += 1;
+    }
+
+    if x < 1 {
+        if x < 2 {
+            if x < 3 {
+                a += 1;
+            } else if x < 4 {
+                a += 1;
+                if x < 5 {
+                    a += 1;
+                }
+            }
+        } else if x < 6 {
+            a += 1;
+        }
+    }
+}
+
+fn main() {
+    f(3, 4);
+}
diff --git a/tests/pretty/never-pattern.pp b/tests/pretty/never-pattern.pp
new file mode 100644
index 00000000000..923ad9b82c7
--- /dev/null
+++ b/tests/pretty/never-pattern.pp
@@ -0,0 +1,17 @@
+#![feature(prelude_import)]
+#![no_std]
+//@ pretty-mode:expanded
+//@ pp-exact:never-pattern.pp
+//@ only-x86_64
+
+#![allow(incomplete_features)]
+#![feature(never_patterns)]
+#![feature(never_type)]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+
+fn f(x: Result<u32, !>) { _ = match x { Ok(x) => x, Err(!) , }; }
+
+fn main() {}
diff --git a/tests/pretty/never-pattern.rs b/tests/pretty/never-pattern.rs
new file mode 100644
index 00000000000..fe170bafc66
--- /dev/null
+++ b/tests/pretty/never-pattern.rs
@@ -0,0 +1,16 @@
+//@ pretty-mode:expanded
+//@ pp-exact:never-pattern.pp
+//@ only-x86_64
+
+#![allow(incomplete_features)]
+#![feature(never_patterns)]
+#![feature(never_type)]
+
+fn f(x: Result<u32, !>) {
+    _ = match x {
+        Ok(x) => x,
+        Err(!),
+    };
+}
+
+fn main() {}
diff --git a/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout b/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout
index 8f056a5f703..273d7071237 100644
--- a/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout
+++ b/tests/rustdoc-ui/doctest/edition-2024-error-output.stdout
@@ -5,6 +5,9 @@ test $DIR/edition-2024-error-output.rs - (line 12) ... FAILED
 failures:
 
 ---- $DIR/edition-2024-error-output.rs - (line 12) stdout ----
+Test executable failed (exit status: 101).
+
+stderr:
 
 thread 'main' panicked at $TMP:6:1:
 assertion `left == right` failed
@@ -13,6 +16,7 @@ assertion `left == right` failed
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 
 
+
 failures:
     $DIR/edition-2024-error-output.rs - (line 12)
 
diff --git a/tests/rustdoc-ui/doctest/stdout-and-stderr.rs b/tests/rustdoc-ui/doctest/stdout-and-stderr.rs
new file mode 100644
index 00000000000..9b0c69d8839
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/stdout-and-stderr.rs
@@ -0,0 +1,26 @@
+// This test ensures that the output is correctly generated when the
+// doctest fails. It checks when there is stderr and stdout, no stdout
+// and no stderr/stdout.
+//
+// This is a regression test for <https://github.com/rust-lang/rust/issues/140289>.
+
+//@ edition: 2024
+//@ compile-flags:--test --test-args=--test-threads=1
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ normalize-stdout: "panicked at .+rs:" -> "panicked at $$TMP:"
+//@ failure-status: 101
+//@ rustc-env:RUST_BACKTRACE=0
+
+//! ```
+//! println!("######## from a DOC TEST ########");
+//! assert_eq!("doc", "test");
+//! ```
+//!
+//! ```
+//! assert_eq!("doc", "test");
+//! ```
+//!
+//! ```
+//! std::process::exit(1);
+//! ```
diff --git a/tests/rustdoc-ui/doctest/stdout-and-stderr.stdout b/tests/rustdoc-ui/doctest/stdout-and-stderr.stdout
new file mode 100644
index 00000000000..b2febe1344f
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/stdout-and-stderr.stdout
@@ -0,0 +1,46 @@
+
+running 3 tests
+test $DIR/stdout-and-stderr.rs - (line 15) ... FAILED
+test $DIR/stdout-and-stderr.rs - (line 20) ... FAILED
+test $DIR/stdout-and-stderr.rs - (line 24) ... FAILED
+
+failures:
+
+---- $DIR/stdout-and-stderr.rs - (line 15) stdout ----
+Test executable failed (exit status: 101).
+
+stdout:
+######## from a DOC TEST ########
+
+stderr:
+
+thread 'main' panicked at $TMP:7:1:
+assertion `left == right` failed
+  left: "doc"
+ right: "test"
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+
+
+---- $DIR/stdout-and-stderr.rs - (line 20) stdout ----
+Test executable failed (exit status: 101).
+
+stderr:
+
+thread 'main' panicked at $TMP:15:1:
+assertion `left == right` failed
+  left: "doc"
+ right: "test"
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+
+
+---- $DIR/stdout-and-stderr.rs - (line 24) stdout ----
+Test executable failed (exit status: 1).
+
+
+failures:
+    $DIR/stdout-and-stderr.rs - (line 15)
+    $DIR/stdout-and-stderr.rs - (line 20)
+    $DIR/stdout-and-stderr.rs - (line 24)
+
+test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout
index 9300f610f8e..33193c78334 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout
@@ -18,18 +18,18 @@ fn arbitrary_consuming_method_for_demonstration_purposes() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!(*{
-                                    (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                                    __local_bind0
-                                } as usize)) {
+                                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+                                __local_bind0
+                            } as usize)) {
 
 
 
 
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: elem as usize\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: elem as usize\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
 }
 fn addr_of() {
@@ -40,12 +40,12 @@ fn addr_of() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!&*__local_bind0) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: &elem\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: &elem\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
 }
 fn binary() {
@@ -56,12 +56,12 @@ fn binary() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!(*__local_bind0 == 1)) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: elem == 1\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: elem == 1\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
     {
         #[allow(unused_imports)]
@@ -69,12 +69,12 @@ fn binary() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!(*__local_bind0 >= 1)) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: elem >= 1\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: elem >= 1\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
     {
         #[allow(unused_imports)]
@@ -82,12 +82,12 @@ fn binary() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!(*__local_bind0 > 0)) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: elem > 0\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: elem > 0\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
     {
         #[allow(unused_imports)]
@@ -95,12 +95,12 @@ fn binary() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!(*__local_bind0 < 3)) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: elem < 3\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: elem < 3\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
     {
         #[allow(unused_imports)]
@@ -108,12 +108,12 @@ fn binary() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!(*__local_bind0 <= 3)) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: elem <= 3\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: elem <= 3\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
     {
         #[allow(unused_imports)]
@@ -121,12 +121,12 @@ fn binary() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!(*__local_bind0 != 3)) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: elem != 3\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: elem != 3\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
 }
 fn unary() {
@@ -137,12 +137,12 @@ fn unary() {
         let mut __capture0 = ::core::asserting::Capture::new();
         let __local_bind0 = &elem;
         if ::core::intrinsics::unlikely(!**__local_bind0) {
-                (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
-                {
-                    ::std::rt::panic_fmt(format_args!("Assertion failed: *elem\nWith captures:\n  elem = {0:?}\n",
-                            __capture0));
-                }
+            (&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
+            {
+                ::std::rt::panic_fmt(format_args!("Assertion failed: *elem\nWith captures:\n  elem = {0:?}\n",
+                        __capture0));
             }
+        }
     };
 }
 fn main() {}
diff --git a/tests/ui/match/issue-82392.stdout b/tests/ui/match/issue-82392.stdout
index 8b7edabf004..a0d83d962e7 100644
--- a/tests/ui/match/issue-82392.stdout
+++ b/tests/ui/match/issue-82392.stdout
@@ -8,10 +8,10 @@ extern crate std;
 //@ edition:2015
 
 fn main() ({
-    (if (true as bool)
-            ({ } as
-                ()) else if (let Some(a) =
-                   ((Some as
-                           fn(i32) -> Option<i32> {Option::<i32>::Some})((3 as i32)) as
-                       Option<i32>) as bool) ({ } as ()) as ())
-           } as ())
+    (if (true as bool) {
+    } else if (let Some(a) =
+            ((Some as
+                    fn(i32) -> Option<i32> {Option::<i32>::Some})((3 as i32)) as
+                Option<i32>) as bool) {
+    } as ())
+} as ())
diff --git a/tests/ui/proc-macro/quote/debug.stdout b/tests/ui/proc-macro/quote/debug.stdout
index 6ebb3a37951..3acb472d9c0 100644
--- a/tests/ui/proc-macro/quote/debug.stdout
+++ b/tests/ui/proc-macro/quote/debug.stdout
@@ -32,12 +32,12 @@ fn main() {
                         let mut iter =
                             "\"world\"".parse::<crate::TokenStream>().unwrap().into_iter();
                         if let (Some(crate::TokenTree::Literal(mut lit)), None) =
-                                    (iter.next(), iter.next()) {
-                                lit.set_span(crate::Span::recover_proc_macro_span(2));
-                                lit
-                            } else {
-                               ::core::panicking::panic("internal error: entered unreachable code")
-                           }
+                                (iter.next(), iter.next()) {
+                            lit.set_span(crate::Span::recover_proc_macro_span(2));
+                            lit
+                        } else {
+                            ::core::panicking::panic("internal error: entered unreachable code")
+                        }
                     }), &mut ts);
         crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
                         crate::Spacing::Alone)), &mut ts);
@@ -51,12 +51,12 @@ fn main() {
                         let mut iter =
                             "r#\"raw\"literal\"#".parse::<crate::TokenStream>().unwrap().into_iter();
                         if let (Some(crate::TokenTree::Literal(mut lit)), None) =
-                                    (iter.next(), iter.next()) {
-                                lit.set_span(crate::Span::recover_proc_macro_span(5));
-                                lit
-                            } else {
-                               ::core::panicking::panic("internal error: entered unreachable code")
-                           }
+                                (iter.next(), iter.next()) {
+                            lit.set_span(crate::Span::recover_proc_macro_span(5));
+                            lit
+                        } else {
+                            ::core::panicking::panic("internal error: entered unreachable code")
+                        }
                     }), &mut ts);
         crate::ToTokens::to_tokens(&crate::TokenTree::Punct(crate::Punct::new(';',
                         crate::Spacing::Alone)), &mut ts);