From f2b139f23d574ca1d2c764b581a3b993e9af1570 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Wed, 2 Aug 2023 21:20:51 +0200
Subject: [PATCH 01/15] Command: also print removed env vars

---
 library/std/src/process/tests.rs              | 23 ++++++++++++++++++-
 .../src/sys/unix/process/process_common.rs    |  2 ++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs
index 366b591466c..2c331eb0104 100644
--- a/library/std/src/process/tests.rs
+++ b/library/std/src/process/tests.rs
@@ -452,7 +452,7 @@ fn env_empty() {
 #[test]
 #[cfg(not(windows))]
 #[cfg_attr(any(target_os = "emscripten", target_env = "sgx"), ignore)]
-fn main() {
+fn debug_print() {
     const PIDFD: &'static str =
         if cfg!(target_os = "linux") { "    create_pidfd: false,\n" } else { "" };
 
@@ -538,6 +538,27 @@ fn main() {
     cwd: Some(
         "/some/path",
     ),
+{PIDFD}}}"#
+        )
+    );
+
+    let mut command_with_removed_env = Command::new("boring-name");
+    command_with_removed_env.env_remove("BAR");
+    assert_eq!(format!("{command_with_removed_env:?}"), r#"unset(BAR) "boring-name""#);
+    assert_eq!(
+        format!("{command_with_removed_env:#?}"),
+        format!(
+            r#"Command {{
+    program: "boring-name",
+    args: [
+        "boring-name",
+    ],
+    env: CommandEnv {{
+        clear: false,
+        vars: {{
+            "BAR": None,
+        }},
+    }},
 {PIDFD}}}"#
         )
     );
diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
index 640648e8707..9362fc7f205 100644
--- a/library/std/src/sys/unix/process/process_common.rs
+++ b/library/std/src/sys/unix/process/process_common.rs
@@ -561,6 +561,8 @@ impl fmt::Debug for Command {
             for (key, value_opt) in self.get_envs() {
                 if let Some(value) = value_opt {
                     write!(f, "{}={value:?} ", key.to_string_lossy())?;
+                } else {
+                    write!(f, "unset({}) ", key.to_string_lossy())?;
                 }
             }
             if self.program != self.args[0] {

From 396cbe66397ba77184e4ed896f4ba17f623c00f7 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Thu, 3 Aug 2023 09:22:54 +0200
Subject: [PATCH 02/15] make unsetting env vars print as executable command

---
 library/std/src/process/tests.rs               |  5 +++--
 .../std/src/sys/unix/process/process_common.rs | 18 ++++++++++++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs
index 2c331eb0104..0d5321c2eea 100644
--- a/library/std/src/process/tests.rs
+++ b/library/std/src/process/tests.rs
@@ -543,8 +543,8 @@ fn debug_print() {
     );
 
     let mut command_with_removed_env = Command::new("boring-name");
-    command_with_removed_env.env_remove("BAR");
-    assert_eq!(format!("{command_with_removed_env:?}"), r#"unset(BAR) "boring-name""#);
+    command_with_removed_env.env_remove("FOO").env_remove("BAR");
+    assert_eq!(format!("{command_with_removed_env:?}"), r#"unset BAR FOO && "boring-name""#);
     assert_eq!(
         format!("{command_with_removed_env:#?}"),
         format!(
@@ -557,6 +557,7 @@ fn debug_print() {
         clear: false,
         vars: {{
             "BAR": None,
+            "FOO": None,
         }},
     }},
 {PIDFD}}}"#
diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
index 9362fc7f205..3a02a6c20d9 100644
--- a/library/std/src/sys/unix/process/process_common.rs
+++ b/library/std/src/sys/unix/process/process_common.rs
@@ -558,11 +558,25 @@ impl fmt::Debug for Command {
             if let Some(ref cwd) = self.cwd {
                 write!(f, "cd {cwd:?} && ")?;
             }
+            // Removed env vars need a separate command.
+            // We use a single `unset` command for all of them.
+            let mut any_removed = false;
+            for (key, value_opt) in self.get_envs() {
+                if value_opt.is_none() {
+                    if !any_removed {
+                        write!(f, "unset ")?;
+                        any_removed = true;
+                    }
+                    write!(f, "{} ", key.to_string_lossy())?;
+                }
+            }
+            if any_removed {
+                write!(f, "&& ")?;
+            }
+            // Altered env vars can just be added in front of the program.
             for (key, value_opt) in self.get_envs() {
                 if let Some(value) = value_opt {
                     write!(f, "{}={value:?} ", key.to_string_lossy())?;
-                } else {
-                    write!(f, "unset({}) ", key.to_string_lossy())?;
                 }
             }
             if self.program != self.args[0] {

From 3a28887623fe7c61f7f84759f5d53fbf11f6a55e Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Thu, 3 Aug 2023 12:00:09 +0200
Subject: [PATCH 03/15] fix a typo in env_clear docs

---
 library/std/src/process.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/std/src/process.rs b/library/std/src/process.rs
index f54d5934175..eb88dfae93c 100644
--- a/library/std/src/process.rs
+++ b/library/std/src/process.rs
@@ -789,7 +789,7 @@ impl Command {
     /// or [`Command::envs`]. In addition, it will prevent the spawned child process from inheriting
     /// any environment variable from its parent process.
     ///
-    /// After calling [`Command::env_remove`], the iterator from [`Command::get_envs`] will be
+    /// After calling [`Command::env_clear`], the iterator from [`Command::get_envs`] will be
     /// empty.
     ///
     /// You can use [`Command::env_remove`] to clear a single mapping.

From 53a29e0e60b14486fbe06d0d68f311989d693816 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Thu, 3 Aug 2023 12:07:42 +0200
Subject: [PATCH 04/15] also print clearing the environment entirely

---
 library/std/src/process/tests.rs              | 23 +++++++++++++++
 .../src/sys/unix/process/process_common.rs    | 29 +++++++++++--------
 library/std/src/sys_common/process.rs         |  4 +++
 3 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs
index 0d5321c2eea..b50dea2e737 100644
--- a/library/std/src/process/tests.rs
+++ b/library/std/src/process/tests.rs
@@ -560,6 +560,29 @@ fn debug_print() {
             "FOO": None,
         }},
     }},
+{PIDFD}}}"#
+        )
+    );
+
+    let mut command_with_cleared_env = Command::new("boring-name");
+    command_with_cleared_env.env_clear().env("BAR", "val").env_remove("FOO");
+    assert_eq!(format!("{command_with_cleared_env:?}"), r#"env -i BAR="val" "boring-name""#);
+    assert_eq!(
+        format!("{command_with_cleared_env:#?}"),
+        format!(
+            r#"Command {{
+    program: "boring-name",
+    args: [
+        "boring-name",
+    ],
+    env: CommandEnv {{
+        clear: true,
+        vars: {{
+            "BAR": Some(
+                "val",
+            ),
+        }},
+    }},
 {PIDFD}}}"#
         )
     );
diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
index 3a02a6c20d9..23d9f3b78ee 100644
--- a/library/std/src/sys/unix/process/process_common.rs
+++ b/library/std/src/sys/unix/process/process_common.rs
@@ -558,20 +558,25 @@ impl fmt::Debug for Command {
             if let Some(ref cwd) = self.cwd {
                 write!(f, "cd {cwd:?} && ")?;
             }
-            // Removed env vars need a separate command.
-            // We use a single `unset` command for all of them.
-            let mut any_removed = false;
-            for (key, value_opt) in self.get_envs() {
-                if value_opt.is_none() {
-                    if !any_removed {
-                        write!(f, "unset ")?;
-                        any_removed = true;
+            if self.env.does_clear() {
+                write!(f, "env -i ")?;
+                // Altered env vars will be printed next, that should exactly work as expected.
+            } else {
+                // Removed env vars need a separate command.
+                // We use a single `unset` command for all of them.
+                let mut any_removed = false;
+                for (key, value_opt) in self.get_envs() {
+                    if value_opt.is_none() {
+                        if !any_removed {
+                            write!(f, "unset ")?;
+                            any_removed = true;
+                        }
+                        write!(f, "{} ", key.to_string_lossy())?;
                     }
-                    write!(f, "{} ", key.to_string_lossy())?;
                 }
-            }
-            if any_removed {
-                write!(f, "&& ")?;
+                if any_removed {
+                    write!(f, "&& ")?;
+                }
             }
             // Altered env vars can just be added in front of the program.
             for (key, value_opt) in self.get_envs() {
diff --git a/library/std/src/sys_common/process.rs b/library/std/src/sys_common/process.rs
index 18883048dae..4d295cf0f09 100644
--- a/library/std/src/sys_common/process.rs
+++ b/library/std/src/sys_common/process.rs
@@ -80,6 +80,10 @@ impl CommandEnv {
         self.vars.clear();
     }
 
+    pub fn does_clear(&self) -> bool {
+        self.clear
+    }
+
     pub fn have_changed_path(&self) -> bool {
         self.saw_path || self.clear
     }

From fc75f723f681dc2cb1b0be7395c936adfb2f6f63 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Thu, 3 Aug 2023 12:14:58 +0200
Subject: [PATCH 05/15] also use 'env' for printing unsetting

---
 library/std/src/process/tests.rs                   |  2 +-
 library/std/src/sys/unix/process/process_common.rs | 10 +++-------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs
index b50dea2e737..72894142d17 100644
--- a/library/std/src/process/tests.rs
+++ b/library/std/src/process/tests.rs
@@ -544,7 +544,7 @@ fn debug_print() {
 
     let mut command_with_removed_env = Command::new("boring-name");
     command_with_removed_env.env_remove("FOO").env_remove("BAR");
-    assert_eq!(format!("{command_with_removed_env:?}"), r#"unset BAR FOO && "boring-name""#);
+    assert_eq!(format!("{command_with_removed_env:?}"), r#"env -u BAR -u FOO "boring-name""#);
     assert_eq!(
         format!("{command_with_removed_env:#?}"),
         format!(
diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
index 23d9f3b78ee..957947a674a 100644
--- a/library/std/src/sys/unix/process/process_common.rs
+++ b/library/std/src/sys/unix/process/process_common.rs
@@ -562,21 +562,17 @@ impl fmt::Debug for Command {
                 write!(f, "env -i ")?;
                 // Altered env vars will be printed next, that should exactly work as expected.
             } else {
-                // Removed env vars need a separate command.
-                // We use a single `unset` command for all of them.
+                // Removed env vars need the command to be wrappen in `env`.
                 let mut any_removed = false;
                 for (key, value_opt) in self.get_envs() {
                     if value_opt.is_none() {
                         if !any_removed {
-                            write!(f, "unset ")?;
+                            write!(f, "env ")?;
                             any_removed = true;
                         }
-                        write!(f, "{} ", key.to_string_lossy())?;
+                        write!(f, "-u {} ", key.to_string_lossy())?;
                     }
                 }
-                if any_removed {
-                    write!(f, "&& ")?;
-                }
             }
             // Altered env vars can just be added in front of the program.
             for (key, value_opt) in self.get_envs() {

From 98c94ec72f5c9319b9192d688c5abd851dcd2d15 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Wed, 6 Sep 2023 17:58:21 +0200
Subject: [PATCH 06/15] fix typo

Co-authored-by: Marcin S. <marcin@realemail.net>
---
 library/std/src/sys/unix/process/process_common.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/std/src/sys/unix/process/process_common.rs b/library/std/src/sys/unix/process/process_common.rs
index 957947a674a..644d32b6459 100644
--- a/library/std/src/sys/unix/process/process_common.rs
+++ b/library/std/src/sys/unix/process/process_common.rs
@@ -562,7 +562,7 @@ impl fmt::Debug for Command {
                 write!(f, "env -i ")?;
                 // Altered env vars will be printed next, that should exactly work as expected.
             } else {
-                // Removed env vars need the command to be wrappen in `env`.
+                // Removed env vars need the command to be wrapped in `env`.
                 let mut any_removed = false;
                 for (key, value_opt) in self.get_envs() {
                     if value_opt.is_none() {

From f7cd892b5af65069bfff5ab1e37210abb737877e Mon Sep 17 00:00:00 2001
From: yukang <moorekang@gmail.com>
Date: Thu, 21 Sep 2023 22:56:17 +0800
Subject: [PATCH 07/15] add UI test for delimiter errors

---
 .../issues/issue-98601-delimiter-error-1.rs      |  9 +++++++++
 .../issues/issue-98601-delimiter-error-1.stderr  | 16 ++++++++++++++++
 ...sue-98601-delimiter-error-unexpected-close.rs |  5 +++++
 ...98601-delimiter-error-unexpected-close.stderr | 14 ++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
 create mode 100644 tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
 create mode 100644 tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs
 create mode 100644 tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr

diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
new file mode 100644
index 00000000000..cfbbd014d4f
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
@@ -0,0 +1,9 @@
+fn foo() {
+    match 0 {
+      _ => {}
+    }
+    if foo
+    }
+} //~ ERROR unexpected closing delimiter: `}`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
new file mode 100644
index 00000000000..d568a4c583a
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
@@ -0,0 +1,16 @@
+error: unexpected closing delimiter: `}`
+  --> $DIR/issue-98601-delimiter-error-1.rs:7:1
+   |
+LL | fn foo() {
+   |          - this delimiter might not be properly closed...
+LL |     match 0 {
+LL |       _ => {}
+   |            -- block is empty, you might have not meant to close it
+...
+LL |     }
+   |     - ...as it matches this but it has different indentation
+LL | }
+   | ^ unexpected closing delimiter
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs
new file mode 100644
index 00000000000..254e816cfc9
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs
@@ -0,0 +1,5 @@
+fn main() {
+    todo!();
+}
+
+fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`
diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr
new file mode 100644
index 00000000000..81dd39bb769
--- /dev/null
+++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr
@@ -0,0 +1,14 @@
+error: unexpected closing delimiter: `)`
+  --> $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17
+   |
+LL | fn main() {
+   |           - this opening brace...
+LL |     todo!();
+LL | }
+   | - ...matches this closing brace
+LL |
+LL | fn other(_: i32)) {}
+   |                 ^ unexpected closing delimiter
+
+error: aborting due to previous error
+

From afdd468ab8f4b028ef2eb024b9f724e2feeac72f Mon Sep 17 00:00:00 2001
From: Martin Nordholts <enselic@gmail.com>
Date: Thu, 21 Sep 2023 18:25:13 +0200
Subject: [PATCH 08/15] tests/ui: Fix large_moves attribute cfg

We only want the attribute for the attribute revision.
---
 tests/ui/async-await/large_moves.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/async-await/large_moves.rs
index 62b12104694..485ca92fb89 100644
--- a/tests/ui/async-await/large_moves.rs
+++ b/tests/ui/async-await/large_moves.rs
@@ -1,5 +1,5 @@
 #![deny(large_assignments)]
-#![feature(large_assignments)]
+#![cfg_attr(attribute, feature(large_assignments))]
 #![cfg_attr(attribute, move_size_limit = "1000")]
 // build-fail
 // only-x86_64

From f2ede49c2f9da8c64782abbec3b4a1710d52a4c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Esteban=20K=C3=BCber?= <esteban@kuber.com.ar>
Date: Thu, 21 Sep 2023 17:47:09 +0000
Subject: [PATCH 09/15] Account for nested `impl Trait` in TAIT

Fix #116031.
---
 .../src/collect/type_of/opaque.rs             |  9 +++-
 .../nested-impl-trait-in-tait.rs              |  9 ++++
 .../nested-impl-trait-in-tait.stderr          | 47 +++++++++++++++++++
 3 files changed, 63 insertions(+), 2 deletions(-)
 create mode 100644 tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs
 create mode 100644 tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr

diff --git a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs
index 957a6bb3481..0544c5ca866 100644
--- a/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs
+++ b/compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs
@@ -1,7 +1,7 @@
 use rustc_errors::StashKey;
 use rustc_hir::def_id::LocalDefId;
 use rustc_hir::intravisit::{self, Visitor};
-use rustc_hir::{self as hir, Expr, ImplItem, Item, Node, TraitItem};
+use rustc_hir::{self as hir, def, Expr, ImplItem, Item, Node, TraitItem};
 use rustc_middle::hir::nested_filter;
 use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
 use rustc_span::DUMMY_SP;
@@ -74,9 +74,14 @@ pub(super) fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: Local
 
         hidden.ty
     } else {
+        let mut parent_def_id = def_id;
+        while tcx.def_kind(parent_def_id) == def::DefKind::OpaqueTy {
+            // Account for `type Alias = impl Trait<Foo = impl Trait>;` (#116031)
+            parent_def_id = tcx.local_parent(parent_def_id);
+        }
         let reported = tcx.sess.emit_err(UnconstrainedOpaqueType {
             span: tcx.def_span(def_id),
-            name: tcx.item_name(tcx.local_parent(def_id).to_def_id()),
+            name: tcx.item_name(parent_def_id.to_def_id()),
             what: match tcx.hir().get(scope) {
                 _ if scope == hir::CRATE_HIR_ID => "module",
                 Node::Item(hir::Item { kind: hir::ItemKind::Mod(_), .. }) => "module",
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs
new file mode 100644
index 00000000000..fec0fdc46fb
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.rs
@@ -0,0 +1,9 @@
+#![feature(type_alias_impl_trait)]
+
+pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+//~^ ERROR use of undeclared lifetime name `'db`
+//~| ERROR cannot find type `Key` in this scope
+//~| ERROR unconstrained opaque type
+//~| ERROR unconstrained opaque type
+
+pub fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
new file mode 100644
index 00000000000..d4aeace4ae7
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-impl-trait-in-tait.stderr
@@ -0,0 +1,47 @@
+error[E0261]: use of undeclared lifetime name `'db`
+  --> $DIR/nested-impl-trait-in-tait.rs:3:40
+   |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+   |                                        ^^^ undeclared lifetime
+   |
+   = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
+help: consider making the bound lifetime-generic with a new `'db` lifetime
+   |
+LL | pub type Tait = impl for<'db> Iterator<Item = (&'db Key, impl Iterator)>;
+   |                      ++++++++
+help: consider introducing lifetime `'db` here
+   |
+LL | pub type Tait<'db> = impl Iterator<Item = (&'db Key, impl Iterator)>;
+   |              +++++
+
+error[E0412]: cannot find type `Key` in this scope
+  --> $DIR/nested-impl-trait-in-tait.rs:3:44
+   |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+   |                                            ^^^ not found in this scope
+   |
+help: consider importing this struct
+   |
+LL + use std::thread::local_impl::Key;
+   |
+
+error: unconstrained opaque type
+  --> $DIR/nested-impl-trait-in-tait.rs:3:17
+   |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Tait` must be used in combination with a concrete type within the same module
+
+error: unconstrained opaque type
+  --> $DIR/nested-impl-trait-in-tait.rs:3:49
+   |
+LL | pub type Tait = impl Iterator<Item = (&'db Key, impl Iterator)>;
+   |                                                 ^^^^^^^^^^^^^
+   |
+   = note: `Tait` must be used in combination with a concrete type within the same module
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0261, E0412.
+For more information about an error, try `rustc --explain E0261`.

From 31cfa4a95611b1151bcdee213d39e2edbeee6c19 Mon Sep 17 00:00:00 2001
From: The 8472 <git@infinite-source.de>
Date: Thu, 21 Sep 2023 19:29:36 +0200
Subject: [PATCH 10/15] Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity
 returns an empty mask

---
 library/std/src/sys/unix/thread.rs | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs
index 2afec897a88..0a3936ea8d5 100644
--- a/library/std/src/sys/unix/thread.rs
+++ b/library/std/src/sys/unix/thread.rs
@@ -316,25 +316,38 @@ pub fn available_parallelism() -> io::Result<NonZeroUsize> {
             target_os = "solaris",
             target_os = "illumos",
         ))] {
+            #[allow(unused_assignments)]
+            #[allow(unused_mut)]
+            let mut quota = usize::MAX;
+
             #[cfg(any(target_os = "android", target_os = "linux"))]
             {
-                let quota = cgroups::quota().max(1);
+                quota = cgroups::quota().max(1);
                 let mut set: libc::cpu_set_t = unsafe { mem::zeroed() };
                 unsafe {
                     if libc::sched_getaffinity(0, mem::size_of::<libc::cpu_set_t>(), &mut set) == 0 {
                         let count = libc::CPU_COUNT(&set) as usize;
                         let count = count.min(quota);
-                        // reported to occur on MIPS kernels older than our minimum supported kernel version for those targets
-                        let count = NonZeroUsize::new(count)
-                            .expect("CPU count must be > 0. This may be a bug in sched_getaffinity(); try upgrading the kernel.");
-                        return Ok(count);
+
+                        // According to sched_getaffinity's API it should always be non-zero, but
+                        // some old MIPS kernels were buggy and zero-initialized the mask if
+                        // none was explicitly set.
+                        // In that case we use the sysconf fallback.
+                        if let Some(count) = NonZeroUsize::new(count) {
+                            return Ok(count)
+                        }
                     }
                 }
             }
             match unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) } {
                 -1 => Err(io::Error::last_os_error()),
                 0 => Err(io::const_io_error!(io::ErrorKind::NotFound, "The number of hardware threads is not known for the target platform")),
-                cpus => Ok(unsafe { NonZeroUsize::new_unchecked(cpus as usize) }),
+                cpus => {
+                    let count = cpus as usize;
+                    // Cover the unusual situation where we were able to get the quota but not the affinity mask
+                    let count = count.min(quota);
+                    Ok(unsafe { NonZeroUsize::new_unchecked(count) })
+                }
             }
         } else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "netbsd"))] {
             use crate::ptr;

From d016e9a68602199bc4bb7c6e4f00a31c7284b3d4 Mon Sep 17 00:00:00 2001
From: Martin Nordholts <enselic@gmail.com>
Date: Thu, 21 Sep 2023 18:28:08 +0200
Subject: [PATCH 11/15] tests/ui: Split large_moves.rs and move to
 lint/large_assignments

To make failing tests easier to debug with --emit=mir, etc.
---
 .../async-await/large_moves.attribute.stderr  | 39 -------------------
 .../ui/async-await/large_moves.option.stderr  | 39 -------------------
 .../large_assignments/box_rc_arc_allowed.rs   | 29 ++++++++++++++
 .../box_rc_arc_allowed.stderr                 | 23 +++++++++++
 .../large_future.attribute.stderr             | 23 +++++++++++
 .../large_future.option.stderr                | 23 +++++++++++
 .../large_assignments/large_future.rs}        | 18 ---------
 7 files changed, 98 insertions(+), 96 deletions(-)
 delete mode 100644 tests/ui/async-await/large_moves.attribute.stderr
 delete mode 100644 tests/ui/async-await/large_moves.option.stderr
 create mode 100644 tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
 create mode 100644 tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
 create mode 100644 tests/ui/lint/large_assignments/large_future.attribute.stderr
 create mode 100644 tests/ui/lint/large_assignments/large_future.option.stderr
 rename tests/ui/{async-await/large_moves.rs => lint/large_assignments/large_future.rs} (59%)

diff --git a/tests/ui/async-await/large_moves.attribute.stderr b/tests/ui/async-await/large_moves.attribute.stderr
deleted file mode 100644
index 1d1999462ce..00000000000
--- a/tests/ui/async-await/large_moves.attribute.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:21:14
-   |
-LL |     let z = (x, 42);
-   |              ^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-note: the lint level is defined here
-  --> $DIR/large_moves.rs:1:9
-   |
-LL | #![deny(large_assignments)]
-   |         ^^^^^^^^^^^^^^^^^
-
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:22:13
-   |
-LL |     let a = z.0;
-   |             ^^^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: moving 9999 bytes
-  --> $DIR/large_moves.rs:27:13
-   |
-LL |     let _ = NotBox::new([0; 9999]);
-   |             ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: moving 9999 bytes
-  --> $DIR/large_moves.rs:41:13
-   |
-LL |             data,
-   |             ^^^^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/async-await/large_moves.option.stderr b/tests/ui/async-await/large_moves.option.stderr
deleted file mode 100644
index 1d1999462ce..00000000000
--- a/tests/ui/async-await/large_moves.option.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:21:14
-   |
-LL |     let z = (x, 42);
-   |              ^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-note: the lint level is defined here
-  --> $DIR/large_moves.rs:1:9
-   |
-LL | #![deny(large_assignments)]
-   |         ^^^^^^^^^^^^^^^^^
-
-error: moving 10024 bytes
-  --> $DIR/large_moves.rs:22:13
-   |
-LL |     let a = z.0;
-   |             ^^^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: moving 9999 bytes
-  --> $DIR/large_moves.rs:27:13
-   |
-LL |     let _ = NotBox::new([0; 9999]);
-   |             ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: moving 9999 bytes
-  --> $DIR/large_moves.rs:41:13
-   |
-LL |             data,
-   |             ^^^^ value moved from here
-   |
-   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
new file mode 100644
index 00000000000..33113642023
--- /dev/null
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.rs
@@ -0,0 +1,29 @@
+#![deny(large_assignments)]
+#![feature(large_assignments)]
+#![move_size_limit = "1000"]
+// build-fail
+// only-x86_64
+
+// edition:2018
+// compile-flags: -Zmir-opt-level=0
+
+use std::{sync::Arc, rc::Rc};
+
+fn main() {
+    let _ = Arc::new([0; 9999]); // OK!
+    let _ = Box::new([0; 9999]); // OK!
+    let _ = Rc::new([0; 9999]); // OK!
+    let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
+}
+
+struct NotBox {
+    data: [u8; 9999],
+}
+
+impl NotBox {
+    fn new(data: [u8; 9999]) -> Self {
+        Self {
+            data, //~ ERROR large_assignments
+        }
+    }
+}
diff --git a/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
new file mode 100644
index 00000000000..b45cbe5da4d
--- /dev/null
+++ b/tests/ui/lint/large_assignments/box_rc_arc_allowed.stderr
@@ -0,0 +1,23 @@
+error: moving 9999 bytes
+  --> $DIR/box_rc_arc_allowed.rs:16:13
+   |
+LL |     let _ = NotBox::new([0; 9999]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^ value moved from here
+   |
+   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
+note: the lint level is defined here
+  --> $DIR/box_rc_arc_allowed.rs:1:9
+   |
+LL | #![deny(large_assignments)]
+   |         ^^^^^^^^^^^^^^^^^
+
+error: moving 9999 bytes
+  --> $DIR/box_rc_arc_allowed.rs:26:13
+   |
+LL |             data,
+   |             ^^^^ value moved from here
+   |
+   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lint/large_assignments/large_future.attribute.stderr b/tests/ui/lint/large_assignments/large_future.attribute.stderr
new file mode 100644
index 00000000000..734b7ff7ba2
--- /dev/null
+++ b/tests/ui/lint/large_assignments/large_future.attribute.stderr
@@ -0,0 +1,23 @@
+error: moving 10024 bytes
+  --> $DIR/large_future.rs:19:14
+   |
+LL |     let z = (x, 42);
+   |              ^ value moved from here
+   |
+   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
+note: the lint level is defined here
+  --> $DIR/large_future.rs:1:9
+   |
+LL | #![deny(large_assignments)]
+   |         ^^^^^^^^^^^^^^^^^
+
+error: moving 10024 bytes
+  --> $DIR/large_future.rs:20:13
+   |
+LL |     let a = z.0;
+   |             ^^^ value moved from here
+   |
+   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lint/large_assignments/large_future.option.stderr b/tests/ui/lint/large_assignments/large_future.option.stderr
new file mode 100644
index 00000000000..734b7ff7ba2
--- /dev/null
+++ b/tests/ui/lint/large_assignments/large_future.option.stderr
@@ -0,0 +1,23 @@
+error: moving 10024 bytes
+  --> $DIR/large_future.rs:19:14
+   |
+LL |     let z = (x, 42);
+   |              ^ value moved from here
+   |
+   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
+note: the lint level is defined here
+  --> $DIR/large_future.rs:1:9
+   |
+LL | #![deny(large_assignments)]
+   |         ^^^^^^^^^^^^^^^^^
+
+error: moving 10024 bytes
+  --> $DIR/large_future.rs:20:13
+   |
+LL |     let a = z.0;
+   |             ^^^ value moved from here
+   |
+   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/async-await/large_moves.rs b/tests/ui/lint/large_assignments/large_future.rs
similarity index 59%
rename from tests/ui/async-await/large_moves.rs
rename to tests/ui/lint/large_assignments/large_future.rs
index 485ca92fb89..834746fa97e 100644
--- a/tests/ui/async-await/large_moves.rs
+++ b/tests/ui/lint/large_assignments/large_future.rs
@@ -9,8 +9,6 @@
 // edition:2018
 // compile-flags: -Zmir-opt-level=0
 
-use std::{sync::Arc, rc::Rc};
-
 fn main() {
     let x = async {
         let y = [0; 9999];
@@ -21,24 +19,8 @@ fn main() {
     let z = (x, 42); //~ ERROR large_assignments
     let a = z.0; //~ ERROR large_assignments
     let b = z.1;
-    let _ = Arc::new([0; 9999]); // OK!
-    let _ = Box::new([0; 9999]); // OK!
-    let _ = Rc::new([0; 9999]); // OK!
-    let _ = NotBox::new([0; 9999]); //~ ERROR large_assignments
 }
 
 async fn thing(y: &[u8]) {
     dbg!(y);
 }
-
-struct NotBox {
-    data: [u8; 9999],
-}
-
-impl NotBox {
-    fn new(data: [u8; 9999]) -> Self {
-        Self {
-            data, //~ ERROR large_assignments
-        }
-    }
-}

From 7fc081b4d96dc2f5cc4e291569a14e9b7f6461aa Mon Sep 17 00:00:00 2001
From: Michael Goulet <michael@errs.io>
Date: Thu, 21 Sep 2023 19:05:09 +0000
Subject: [PATCH 12/15] Add note to is_known_rigid

---
 compiler/rustc_middle/src/ty/sty.rs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index e3e014a3b2a..c37cf384303 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -2946,6 +2946,11 @@ impl<'tcx> Ty<'tcx> {
         }
     }
 
+    /// Returns `true` when the outermost type cannot be further normalized,
+    /// resolved, or substituted. This includes all primitive types, but also
+    /// things like ADTs and trait objects, sice even if their arguments or
+    /// nested types may be further simplified, the outermost [`TyKind`] or
+    /// type constructor remains the same.
     pub fn is_known_rigid(self) -> bool {
         match self.kind() {
             Bool

From e888d470e91ee4e027871d850766802a6b6dad86 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Fri, 22 Sep 2023 08:25:11 +0200
Subject: [PATCH 13/15] give FutureIncompatibilityReason variants more explicit
 names

---
 compiler/rustc_errors/src/diagnostic.rs |  8 +++++++-
 compiler/rustc_lint_defs/src/builtin.rs | 20 ++++++++++----------
 compiler/rustc_lint_defs/src/lib.rs     | 16 +++++++++++-----
 compiler/rustc_middle/src/lint.rs       |  9 ++++++---
 4 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 3fd087b1d5e..470f318eb33 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -151,7 +151,12 @@ impl fmt::Display for DiagnosticLocation {
 #[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable)]
 pub enum DiagnosticId {
     Error(String),
-    Lint { name: String, has_future_breakage: bool, is_force_warn: bool },
+    Lint {
+        name: String,
+        /// Indicates whether this lint should show up in cargo's future breakage report.
+        has_future_breakage: bool,
+        is_force_warn: bool,
+    },
 }
 
 /// A "sub"-diagnostic attached to a parent diagnostic.
@@ -301,6 +306,7 @@ impl Diagnostic {
         }
     }
 
+    /// Indicates whether this diagnostic should show up in cargo's future breakage report.
     pub fn has_future_breakage(&self) -> bool {
         match self.code {
             Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 860366fdd61..f71d49572d3 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -1017,7 +1017,7 @@ declare_lint! {
     "raw pointers must be aligned before dereferencing",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #68585 <https://github.com/rust-lang/rust/issues/104616>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
 }
 
@@ -1387,7 +1387,7 @@ declare_lint! {
     "trait-object types were treated as different depending on marker-trait order",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
 }
 
@@ -2006,7 +2006,7 @@ declare_lint! {
     "detects proc macro derives using inaccessible names from parent modules",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
 }
 
@@ -2618,7 +2618,7 @@ declare_lint! {
     "a C-like enum implementing Drop is cast",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
 }
 
@@ -2976,7 +2976,7 @@ declare_lint! {
     "trailing semicolon in macro body used as expression",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
 }
 
@@ -3709,7 +3709,7 @@ declare_lint! {
     "detects usage of old versions of certain proc-macro crates",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #83125 <https://github.com/rust-lang/rust/issues/83125>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
 }
 
@@ -4222,7 +4222,7 @@ declare_lint! {
     "impl method assumes more implied bounds than its corresponding trait method",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
 }
 
@@ -4254,7 +4254,7 @@ declare_lint! {
     "`[u8]` or `str` used in a packed struct with `derive`",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #107457 <https://github.com/rust-lang/rust/issues/107457>",
-        reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
     };
     report_in_external_macro
 }
@@ -4483,7 +4483,7 @@ declare_lint! {
     Warn,
     "detects certain glob imports that require reporting an ambiguity error",
     @future_incompatible = FutureIncompatibleInfo {
-        reason: FutureIncompatibilityReason::FutureReleaseError,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #114095 <https://github.com/rust-lang/rust/issues/114095>",
     };
 }
@@ -4568,7 +4568,7 @@ declare_lint! {
     Warn,
     "elided lifetimes cannot be used in associated constants in impls",
     @future_incompatible = FutureIncompatibleInfo {
-        reason: FutureIncompatibilityReason::FutureReleaseError,
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #115010 <https://github.com/rust-lang/rust/issues/115010>",
     };
 }
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs
index ef2f7940477..aced50ca510 100644
--- a/compiler/rustc_lint_defs/src/lib.rs
+++ b/compiler/rustc_lint_defs/src/lib.rs
@@ -347,12 +347,18 @@ pub struct FutureIncompatibleInfo {
 /// The reason for future incompatibility
 #[derive(Copy, Clone, Debug)]
 pub enum FutureIncompatibilityReason {
-    /// This will be an error in a future release
-    /// for all editions
-    FutureReleaseError,
+    /// This will be an error in a future release for all editions
+    ///
+    /// This will *not* show up in cargo's future breakage report.
+    /// The warning will hence only be seen in local crates, not in dependencies.
+    FutureReleaseErrorDontReportInDeps,
     /// This will be an error in a future release, and
     /// Cargo should create a report even for dependencies
-    FutureReleaseErrorReportNow,
+    ///
+    /// This is the *only* reason that will make future incompatibility warnings show up in cargo's
+    /// reports. All other future incompatibility warnings are not visible when they occur in a
+    /// dependency.
+    FutureReleaseErrorReportInDeps,
     /// Code that changes meaning in some way in a
     /// future release.
     FutureReleaseSemanticsChange,
@@ -380,7 +386,7 @@ impl FutureIncompatibleInfo {
     pub const fn default_fields_for_macro() -> Self {
         FutureIncompatibleInfo {
             reference: "",
-            reason: FutureIncompatibilityReason::FutureReleaseError,
+            reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
             explain_reason: true,
         }
     }
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs
index 037f84f476f..59849e8eb40 100644
--- a/compiler/rustc_middle/src/lint.rs
+++ b/compiler/rustc_middle/src/lint.rs
@@ -314,7 +314,10 @@ pub fn struct_lint_level(
             // Default allow lints trigger too often for testing.
             sess.opts.unstable_opts.future_incompat_test && lint.default_level != Level::Allow,
             |incompat| {
-                matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
+                matches!(
+                    incompat.reason,
+                    FutureIncompatibilityReason::FutureReleaseErrorReportInDeps
+                )
             },
         );
 
@@ -404,8 +407,8 @@ pub fn struct_lint_level(
 
         if let Some(future_incompatible) = future_incompatible {
             let explanation = match future_incompatible.reason {
-                FutureIncompatibilityReason::FutureReleaseError
-                | FutureIncompatibilityReason::FutureReleaseErrorReportNow => {
+                FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps
+                | FutureIncompatibilityReason::FutureReleaseErrorReportInDeps => {
                     "this was previously accepted by the compiler but is being phased out; \
                          it will become a hard error in a future release!"
                         .to_owned()

From 5586c2a68f2b6b9b09d025ad52df7ba288852222 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Fri, 22 Sep 2023 08:59:32 +0200
Subject: [PATCH 14/15] make the reason: field mandatory for
 @future_incompatible lints

---
 compiler/rustc_lint/src/array_into_iter.rs    |  2 +-
 compiler/rustc_lint/src/builtin.rs            |  6 +--
 .../src/deref_into_dyn_supertrait.rs          |  2 +
 compiler/rustc_lint_defs/src/builtin.rs       | 54 ++++++++++++++-----
 compiler/rustc_lint_defs/src/lib.rs           |  6 ++-
 5 files changed, 51 insertions(+), 19 deletions(-)

diff --git a/compiler/rustc_lint/src/array_into_iter.rs b/compiler/rustc_lint/src/array_into_iter.rs
index d0967ba5644..814991cd8c9 100644
--- a/compiler/rustc_lint/src/array_into_iter.rs
+++ b/compiler/rustc_lint/src/array_into_iter.rs
@@ -34,8 +34,8 @@ declare_lint! {
     Warn,
     "detects calling `into_iter` on arrays in Rust 2015 and 2018",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
         reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
+        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>",
     };
 }
 
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index d38c6b2642a..4f6b79d9aee 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -844,8 +844,8 @@ declare_lint! {
     Warn,
     "detects anonymous parameters",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
+        reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
     };
 }
 
@@ -1669,8 +1669,8 @@ declare_lint! {
     Warn,
     "`...` range patterns are deprecated",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
+        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
     };
 }
 
@@ -1804,8 +1804,8 @@ declare_lint! {
     Allow,
     "detects edition keywords being used as an identifier",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
+        reference: "issue #49716 <https://github.com/rust-lang/rust/issues/49716>",
     };
 }
 
diff --git a/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs b/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs
index 851c6493daf..9be2edf8453 100644
--- a/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs
+++ b/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs
@@ -5,6 +5,7 @@ use crate::{
 
 use rustc_hir as hir;
 use rustc_middle::{traits::util::supertraits, ty};
+use rustc_session::lint::FutureIncompatibilityReason;
 use rustc_span::sym;
 
 declare_lint! {
@@ -48,6 +49,7 @@ declare_lint! {
     Warn,
     "`Deref` implementation usage with a supertrait trait object for output might be shadowed in the future",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #89460 <https://github.com/rust-lang/rust/issues/89460>",
     };
 }
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index f71d49572d3..1951db49e91 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -39,6 +39,7 @@ declare_lint! {
     Warn,
     "applying forbid to lint-groups",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #81670 <https://github.com/rust-lang/rust/issues/81670>",
     };
 }
@@ -74,6 +75,7 @@ declare_lint! {
     Deny,
     "ill-formed attribute inputs that were previously accepted and used in practice",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #57571 <https://github.com/rust-lang/rust/issues/57571>",
     };
     crate_level_only
@@ -110,6 +112,7 @@ declare_lint! {
     Deny,
     "conflicts between `#[repr(..)]` hints that were previously accepted and used in practice",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #68585 <https://github.com/rust-lang/rust/issues/68585>",
     };
 }
@@ -1016,8 +1019,8 @@ declare_lint! {
     Deny,
     "raw pointers must be aligned before dereferencing",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #68585 <https://github.com/rust-lang/rust/issues/104616>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #68585 <https://github.com/rust-lang/rust/issues/104616>",
     };
 }
 
@@ -1096,6 +1099,7 @@ declare_lint! {
     Deny,
     "detect public re-exports of private extern crates",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
     };
 }
@@ -1125,6 +1129,7 @@ declare_lint! {
     Deny,
     "type parameter default erroneously allowed in invalid location",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
     };
 }
@@ -1267,6 +1272,7 @@ declare_lint! {
     Deny,
     "patterns in functions without body were erroneously allowed",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
     };
 }
@@ -1310,6 +1316,7 @@ declare_lint! {
     Deny,
     "detects missing fragment specifiers in unused `macro_rules!` patterns",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
     };
 }
@@ -1351,6 +1358,7 @@ declare_lint! {
     Warn,
     "detects generic lifetime arguments in path segments with late bound lifetime parameters",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
     };
 }
@@ -1386,8 +1394,8 @@ declare_lint! {
     Deny,
     "trait-object types were treated as different depending on marker-trait order",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
     };
 }
 
@@ -1426,6 +1434,7 @@ declare_lint! {
     Warn,
     "distinct impls distinguished only by the leak-check code",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #56105 <https://github.com/rust-lang/rust/issues/56105>",
     };
 }
@@ -1617,8 +1626,8 @@ declare_lint! {
     Warn,
     "raw pointer to an inference variable",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
+        reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
     };
 }
 
@@ -1685,8 +1694,8 @@ declare_lint! {
     Warn,
     "suggest using `dyn Trait` for trait objects",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
+        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>",
     };
 }
 
@@ -1740,8 +1749,8 @@ declare_lint! {
     "fully qualified paths that start with a module name \
      instead of `crate`, `self`, or an extern crate name",
      @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2018),
+        reference: "issue #53130 <https://github.com/rust-lang/rust/issues/53130>",
      };
 }
 
@@ -1789,6 +1798,7 @@ declare_lint! {
     Warn,
     "floating-point literals cannot be used in patterns",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
     };
 }
@@ -1939,6 +1949,7 @@ declare_lint! {
     Warn,
     "checks the object safety of where clauses",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #51443 <https://github.com/rust-lang/rust/issues/51443>",
     };
 }
@@ -2005,8 +2016,8 @@ declare_lint! {
     Deny,
     "detects proc macro derives using inaccessible names from parent modules",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
     };
 }
 
@@ -2108,6 +2119,7 @@ declare_lint! {
     "macro-expanded `macro_export` macros from the current crate \
      cannot be referred to by absolute paths",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #52234 <https://github.com/rust-lang/rust/issues/52234>",
     };
     crate_level_only
@@ -2199,6 +2211,7 @@ declare_lint! {
     Warn,
     "constant used in pattern contains value of non-structural-match type in a field or a variant",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
     };
 }
@@ -2253,6 +2266,7 @@ declare_lint! {
     Allow,
     "pointers are not structural-match",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>",
     };
 }
@@ -2291,6 +2305,7 @@ declare_lint! {
     "constant used in pattern of non-structural-match type and the constant's initializer \
     expression contains values of non-structural-match types",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #73448 <https://github.com/rust-lang/rust/issues/73448>",
     };
 }
@@ -2348,6 +2363,7 @@ declare_lint! {
     Deny,
     "ambiguous associated items",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #57644 <https://github.com/rust-lang/rust/issues/57644>",
     };
 }
@@ -2389,6 +2405,7 @@ declare_lint! {
     Deny,
     "a feature gate that doesn't break dependent crates",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #64266 <https://github.com/rust-lang/rust/issues/64266>",
     };
 }
@@ -2617,8 +2634,8 @@ declare_lint! {
     Deny,
     "a C-like enum implementing Drop is cast",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #73333 <https://github.com/rust-lang/rust/issues/73333>",
     };
 }
 
@@ -2747,6 +2764,7 @@ declare_lint! {
     Warn,
     "detects a generic constant is used in a type without a emitting a warning",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #76200 <https://github.com/rust-lang/rust/issues/76200>",
     };
 }
@@ -2805,6 +2823,7 @@ declare_lint! {
     Warn,
     "uninhabited static",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #74840 <https://github.com/rust-lang/rust/issues/74840>",
     };
 }
@@ -2975,8 +2994,8 @@ declare_lint! {
     Warn,
     "trailing semicolon in macro body used as expression",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #79813 <https://github.com/rust-lang/rust/issues/79813>",
     };
 }
 
@@ -3022,6 +3041,7 @@ declare_lint! {
     Warn,
     "detects derive helper attributes that are used before they are introduced",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #79202 <https://github.com/rust-lang/rust/issues/79202>",
     };
 }
@@ -3090,6 +3110,7 @@ declare_lint! {
     Deny,
     "detects usage of `#![cfg_attr(..., crate_type/crate_name = \"...\")]`",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #91632 <https://github.com/rust-lang/rust/issues/91632>",
     };
 }
@@ -3181,6 +3202,7 @@ declare_lint! {
     Warn,
     "transparent type contains an external ZST that is marked #[non_exhaustive] or contains private fields",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #78586 <https://github.com/rust-lang/rust/issues/78586>",
     };
 }
@@ -3231,6 +3253,7 @@ declare_lint! {
     Warn,
     "unstable syntax can change at any point in the future, causing a hard error!",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #65860 <https://github.com/rust-lang/rust/issues/65860>",
     };
 }
@@ -3662,6 +3685,7 @@ declare_lint! {
     Warn,
     "detects invalid `#[doc(...)]` attributes",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #82730 <https://github.com/rust-lang/rust/issues/82730>",
     };
 }
@@ -3708,8 +3732,8 @@ declare_lint! {
     Deny,
     "detects usage of old versions of certain proc-macro crates",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #83125 <https://github.com/rust-lang/rust/issues/83125>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #83125 <https://github.com/rust-lang/rust/issues/83125>",
     };
 }
 
@@ -3747,8 +3771,8 @@ declare_lint! {
     Allow,
     "detects usage of old versions of or-patterns",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/or-patterns-macro-rules.html>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
+        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/or-patterns-macro-rules.html>",
     };
 }
 
@@ -3796,8 +3820,8 @@ declare_lint! {
     "detects the usage of trait methods which are ambiguous with traits added to the \
         prelude in future editions",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
+        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>",
     };
 }
 
@@ -3833,8 +3857,8 @@ declare_lint! {
     Allow,
     "identifiers that will be parsed as a prefix in Rust 2021",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/reserving-syntax.html>",
         reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021),
+        reference: "<https://doc.rust-lang.org/nightly/edition-guide/rust-2021/reserving-syntax.html>",
     };
     crate_level_only
 }
@@ -3881,6 +3905,7 @@ declare_lint! {
     Warn,
     "use of unsupported calling convention",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #87678 <https://github.com/rust-lang/rust/issues/87678>",
     };
 }
@@ -4221,8 +4246,8 @@ declare_lint! {
     Deny,
     "impl method assumes more implied bounds than its corresponding trait method",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
     };
 }
 
@@ -4253,8 +4278,8 @@ declare_lint! {
     Warn,
     "`[u8]` or `str` used in a packed struct with `derive`",
     @future_incompatible = FutureIncompatibleInfo {
-        reference: "issue #107457 <https://github.com/rust-lang/rust/issues/107457>",
         reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
+        reference: "issue #107457 <https://github.com/rust-lang/rust/issues/107457>",
     };
     report_in_external_macro
 }
@@ -4415,6 +4440,7 @@ declare_lint! {
     "impls that are not considered to overlap may be considered to \
     overlap in the future",
     @future_incompatible = FutureIncompatibleInfo {
+        reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
         reference: "issue #114040 <https://github.com/rust-lang/rust/issues/114040>",
     };
 }
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs
index aced50ca510..84e7ecb0b88 100644
--- a/compiler/rustc_lint_defs/src/lib.rs
+++ b/compiler/rustc_lint_defs/src/lib.rs
@@ -724,7 +724,10 @@ macro_rules! declare_lint {
     );
     ($(#[$attr:meta])* $vis: vis $NAME: ident, $Level: ident, $desc: expr,
      $(@feature_gate = $gate:expr;)?
-     $(@future_incompatible = FutureIncompatibleInfo { $($field:ident : $val:expr),* $(,)*  }; )?
+     $(@future_incompatible = FutureIncompatibleInfo {
+        reason: $reason:expr,
+        $($field:ident : $val:expr),* $(,)*
+     }; )?
      $(@edition $lint_edition:ident => $edition_level:ident;)?
      $($v:ident),*) => (
         $(#[$attr])*
@@ -736,6 +739,7 @@ macro_rules! declare_lint {
             $($v: true,)*
             $(feature_gate: Some($gate),)?
             $(future_incompatible: Some($crate::FutureIncompatibleInfo {
+                reason: $reason,
                 $($field: $val,)*
                 ..$crate::FutureIncompatibleInfo::default_fields_for_macro()
             }),)?

From 7abbb9a4ffb17af4fea40222264ed87c736310e6 Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Fri, 22 Sep 2023 10:37:05 +0200
Subject: [PATCH 15/15] hide rustc line numbers in test

---
 .../session-diagnostic/diagnostic-derive-doc-comment-field.rs   | 2 +-
 .../diagnostic-derive-doc-comment-field.stderr                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs
index 642b58b0753..283d87d3eb6 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs
@@ -1,7 +1,7 @@
 // check-fail
 // Tests that a doc comment will not preclude a field from being considered a diagnostic argument
 // normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr"
-// normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC"
+// normalize-stderr-test "(COMPILER_DIR/.*\.rs):[0-9]+:[0-9]+" -> "$1:LL:CC"
 
 // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly,
 // changing the output of this test. Since Subdiagnostic is strictly internal to the compiler
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
index e014fc8c693..70d7b3225b5 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr
@@ -23,7 +23,7 @@ LL |     arg: NotIntoDiagnosticArg,
    |
    = help: normalized in stderr
 note: required by a bound in `Diagnostic::set_arg`
-  --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:968:5
+  --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:LL:CC
 
 error: aborting due to 2 previous errors