about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_interface/src/passes.rs8
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder.rs34
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs2
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs12
-rw-r--r--compiler/rustc_metadata/src/rmeta/mod.rs3
-rw-r--r--compiler/rustc_middle/src/query/mod.rs5
-rw-r--r--compiler/rustc_query_impl/src/on_disk_cache.rs2
-rw-r--r--compiler/rustc_resolve/src/rustdoc.rs1
-rw-r--r--library/alloc/src/vec/drain.rs2
-rw-r--r--library/core/src/slice/iter.rs8
-rw-r--r--library/std/src/io/impls.rs56
-rw-r--r--library/std/src/io/mod.rs6
-rw-r--r--library/std/src/sys/unsupported/io.rs2
-rw-r--r--src/tools/miri/tests/fail/const-ub-checks.stderr6
-rw-r--r--src/tools/miri/tests/fail/erroneous_const2.stderr14
-rw-r--r--src/tools/miri/tests/pass/track-alloc-1.rs6
-rw-r--r--src/tools/miri/tests/pass/track-alloc-1.stderr5
-rw-r--r--tests/run-make/const-prop-lint/Makefile9
-rw-r--r--tests/run-make/const-prop-lint/input.rs5
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs6
-rw-r--r--tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr54
-rw-r--r--tests/ui/consts/const-eval/issue-100878.rs2
-rw-r--r--tests/ui/issues/issue-33287.rs1
-rw-r--r--tests/ui/polymorphization/generators.stderr12
-rw-r--r--tests/ui/polymorphization/predicates.stderr18
-rw-r--r--tests/ui/polymorphization/type_parameters/closures.stderr30
26 files changed, 218 insertions, 91 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 5fe9d344654..de78f26eec6 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -794,8 +794,14 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
             }
             tcx.ensure().has_ffi_unwind_calls(def_id);
 
-            if tcx.hir().body_const_context(def_id).is_some() {
+            // If we need to codegen, ensure that we emit all errors from
+            // `mir_drops_elaborated_and_const_checked` now, to avoid discovering
+            // them later during codegen.
+            if tcx.sess.opts.output_types.should_codegen()
+                || tcx.hir().body_const_context(def_id).is_some()
+            {
                 tcx.ensure().mir_drops_elaborated_and_const_checked(def_id);
+                tcx.ensure().unused_generic_params(ty::InstanceDef::Item(def_id.to_def_id()));
             }
         }
     });
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index 951fb303e3c..601281fddba 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -876,16 +876,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
             variant_did,
             ctor,
             data.discr,
-            self.root
-                .tables
-                .children
-                .get(self, index)
-                .expect("fields are not encoded for a variant")
-                .decode(self)
-                .map(|index| ty::FieldDef {
-                    did: self.local_def_id(index),
-                    name: self.item_name(index),
-                    vis: self.get_visibility(index),
+            self.get_associated_item_or_field_def_ids(index)
+                .map(|did| ty::FieldDef {
+                    did,
+                    name: self.item_name(did.index),
+                    vis: self.get_visibility(did.index),
                 })
                 .collect(),
             adt_kind,
@@ -910,7 +905,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
         let variants = if let ty::AdtKind::Enum = adt_kind {
             self.root
                 .tables
-                .children
+                .module_children_non_reexports
                 .get(self, item_id)
                 .expect("variants are not encoded for an enum")
                 .decode(self)
@@ -1022,11 +1017,9 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
                 }
             } else {
                 // Iterate over all children.
-                for child_index in self.root.tables.children.get(self, id).unwrap().decode(self) {
-                    // FIXME: Do not encode RPITITs as a part of this list.
-                    if self.root.tables.opt_rpitit_info.get(self, child_index).is_none() {
-                        yield self.get_mod_child(child_index, sess);
-                    }
+                let non_reexports = self.root.tables.module_children_non_reexports.get(self, id);
+                for child_index in non_reexports.unwrap().decode(self) {
+                    yield self.get_mod_child(child_index, sess);
                 }
 
                 let reexports = self.root.tables.module_children_reexports.get(self, id);
@@ -1058,17 +1051,16 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
             .map_or(false, |ident| ident.name == kw::SelfLower)
     }
 
-    fn get_associated_item_def_ids(
+    fn get_associated_item_or_field_def_ids(
         self,
         id: DefIndex,
-        sess: &'a Session,
     ) -> impl Iterator<Item = DefId> + 'a {
         self.root
             .tables
-            .children
+            .associated_item_or_field_def_ids
             .get(self, id)
-            .expect("associated items not encoded for an item")
-            .decode((self, sess))
+            .unwrap_or_else(|| self.missing("associated_item_or_field_def_ids", id))
+            .decode(self)
             .map(move |child_index| self.local_def_id(child_index))
     }
 
diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
index be82d6b1811..141980912b1 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
@@ -276,7 +276,7 @@ provide! { tcx, def_id, other, cdata,
         tcx.calculate_dtor(def_id, |_,_| Ok(()))
     }
     associated_item_def_ids => {
-        tcx.arena.alloc_from_iter(cdata.get_associated_item_def_ids(def_id.index, tcx.sess))
+        tcx.arena.alloc_from_iter(cdata.get_associated_item_or_field_def_ids(def_id.index))
     }
     associated_item => { cdata.get_associated_item(def_id.index, tcx.sess) }
     inherent_impls => { cdata.get_inherent_implementations_for_type(tcx, def_id.index) }
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index 731ba4e4631..14c1b9d5589 100644
--- a/compiler/rustc_metadata/src/rmeta/encoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -1367,7 +1367,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
 
         if adt_def.is_enum() {
             let module_children = tcx.module_children_non_reexports(local_def_id);
-            record_array!(self.tables.children[def_id] <-
+            record_array!(self.tables.module_children_non_reexports[def_id] <-
                 module_children.iter().map(|def_id| def_id.local_def_index));
         } else {
             // For non-enum, there is only one variant, and its def_id is the adt's.
@@ -1385,7 +1385,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
             record!(self.tables.variant_data[variant.def_id] <- data);
 
             self.tables.constness.set_some(variant.def_id.index, hir::Constness::Const);
-            record_array!(self.tables.children[variant.def_id] <- variant.fields.iter().map(|f| {
+            record_array!(self.tables.associated_item_or_field_def_ids[variant.def_id] <- variant.fields.iter().map(|f| {
                 assert!(f.did.is_local());
                 f.did.index
             }));
@@ -1415,7 +1415,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
             record!(self.tables.expn_that_defined[def_id] <- tcx.expn_that_defined(local_def_id));
         } else {
             let non_reexports = tcx.module_children_non_reexports(local_def_id);
-            record_array!(self.tables.children[def_id] <-
+            record_array!(self.tables.module_children_non_reexports[def_id] <-
                 non_reexports.iter().map(|def_id| def_id.local_def_index));
 
             record_defaulted_array!(self.tables.module_children_reexports[def_id] <-
@@ -1617,7 +1617,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
         debug!("EncodeContext::encode_info_for_item({:?})", def_id);
 
         let record_associated_item_def_ids = |this: &mut Self, def_ids: &[DefId]| {
-            record_array!(this.tables.children[def_id] <- def_ids.iter().map(|&def_id| {
+            record_array!(this.tables.associated_item_or_field_def_ids[def_id] <- def_ids.iter().map(|&def_id| {
                 assert!(def_id.is_local());
                 def_id.index
             }))
@@ -1678,6 +1678,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
             hir::ItemKind::Trait(..) => {
                 record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id));
 
+                let module_children = tcx.module_children_non_reexports(item.owner_id.def_id);
+                record_array!(self.tables.module_children_non_reexports[def_id] <-
+                    module_children.iter().map(|def_id| def_id.local_def_index));
+
                 let associated_item_def_ids = self.tcx.associated_item_def_ids(def_id);
                 record_associated_item_def_ids(self, associated_item_def_ids);
                 for &item_def_id in associated_item_def_ids {
diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs
index a6a34765324..f2302c0ad43 100644
--- a/compiler/rustc_metadata/src/rmeta/mod.rs
+++ b/compiler/rustc_metadata/src/rmeta/mod.rs
@@ -361,7 +361,8 @@ define_tables! {
 
 - optional:
     attributes: Table<DefIndex, LazyArray<ast::Attribute>>,
-    children: Table<DefIndex, LazyArray<DefIndex>>,
+    module_children_non_reexports: Table<DefIndex, LazyArray<DefIndex>>,
+    associated_item_or_field_def_ids: Table<DefIndex, LazyArray<DefIndex>>,
     opt_def_kind: Table<DefIndex, DefKind>,
     visibility: Table<DefIndex, LazyValue<ty::Visibility<DefIndex>>>,
     def_span: Table<DefIndex, LazyValue<Span>>,
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index f81c1c39fc1..1c370b29961 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -670,9 +670,10 @@ rustc_queries! {
         desc { "computing the inferred outlives predicates for items in this crate" }
     }
 
-    /// Maps from an impl/trait `DefId` to a list of the `DefId`s of its items.
+    /// Maps from an impl/trait or struct/variant `DefId`
+    /// to a list of the `DefId`s of its associated items or fields.
     query associated_item_def_ids(key: DefId) -> &'tcx [DefId] {
-        desc { |tcx| "collecting associated items of `{}`", tcx.def_path_str(key) }
+        desc { |tcx| "collecting associated items or fields of `{}`", tcx.def_path_str(key) }
         cache_on_disk_if { key.is_local() }
         separate_provide_extern
     }
diff --git a/compiler/rustc_query_impl/src/on_disk_cache.rs b/compiler/rustc_query_impl/src/on_disk_cache.rs
index 40869fdc467..c05323c2d6c 100644
--- a/compiler/rustc_query_impl/src/on_disk_cache.rs
+++ b/compiler/rustc_query_impl/src/on_disk_cache.rs
@@ -300,7 +300,7 @@ impl<'sess> rustc_middle::ty::OnDiskCache<'sess> for OnDiskCache<'sess> {
                     interpret_alloc_index.reserve(new_n - n);
                     for idx in n..new_n {
                         let id = encoder.interpret_allocs[idx];
-                        let pos = encoder.position() as u32;
+                        let pos: u32 = encoder.position().try_into().unwrap();
                         interpret_alloc_index.push(pos);
                         interpret::specialized_encode_alloc_id(&mut encoder, tcx, id);
                     }
diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs
index 9eae99be2e9..d433391f272 100644
--- a/compiler/rustc_resolve/src/rustdoc.rs
+++ b/compiler/rustc_resolve/src/rustdoc.rs
@@ -367,6 +367,7 @@ fn preprocess_link(link: &str) -> Box<str> {
     let link = link.strip_suffix("{}").unwrap_or(link);
     let link = link.strip_suffix("[]").unwrap_or(link);
     let link = if link != "!" { link.strip_suffix('!').unwrap_or(link) } else { link };
+    let link = link.trim();
     strip_generics_from_path(link).unwrap_or_else(|_| link.into())
 }
 
diff --git a/library/alloc/src/vec/drain.rs b/library/alloc/src/vec/drain.rs
index 2b1a787cc54..e3ca6eb7833 100644
--- a/library/alloc/src/vec/drain.rs
+++ b/library/alloc/src/vec/drain.rs
@@ -197,7 +197,7 @@ impl<T, A: Allocator> Drop for Drain<'_, T, A> {
             }
         }
 
-        let iter = mem::replace(&mut self.iter, (&mut []).iter());
+        let iter = mem::take(&mut self.iter);
         let drop_len = iter.len();
 
         let mut vec = self.vec;
diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs
index 88b84bd1352..b2dd92a2379 100644
--- a/library/core/src/slice/iter.rs
+++ b/library/core/src/slice/iter.rs
@@ -685,7 +685,7 @@ where
             None
         } else {
             self.finished = true;
-            Some(mem::replace(&mut self.v, &mut []))
+            Some(mem::take(&mut self.v))
         }
     }
 }
@@ -749,7 +749,7 @@ where
         match idx_opt {
             None => self.finish(),
             Some(idx) => {
-                let tmp = mem::replace(&mut self.v, &mut []);
+                let tmp = mem::take(&mut self.v);
                 let (head, tail) = tmp.split_at_mut(idx);
                 self.v = head;
                 Some(&mut tail[1..])
@@ -830,7 +830,7 @@ where
         if idx == self.v.len() {
             self.finished = true;
         }
-        let tmp = mem::replace(&mut self.v, &mut []);
+        let tmp = mem::take(&mut self.v);
         let (head, tail) = tmp.split_at_mut(idx);
         self.v = tail;
         Some(head)
@@ -876,7 +876,7 @@ where
         if idx == 0 {
             self.finished = true;
         }
-        let tmp = mem::replace(&mut self.v, &mut []);
+        let tmp = mem::take(&mut self.v);
         let (head, tail) = tmp.split_at_mut(idx);
         self.v = head;
         Some(tail)
diff --git a/library/std/src/io/impls.rs b/library/std/src/io/impls.rs
index e5048dcc8ac..a7428776d8f 100644
--- a/library/std/src/io/impls.rs
+++ b/library/std/src/io/impls.rs
@@ -9,6 +9,7 @@ use crate::io::{
     self, BorrowedCursor, BufRead, ErrorKind, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write,
 };
 use crate::mem;
+use crate::str;
 
 // =============================================================================
 // Forwarding implementations
@@ -307,6 +308,17 @@ impl Read for &[u8] {
         *self = &self[len..];
         Ok(len)
     }
+
+    #[inline]
+    fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+        let content = str::from_utf8(self).map_err(|_| {
+            io::const_io_error!(ErrorKind::InvalidData, "stream did not contain valid UTF-8")
+        })?;
+        buf.push_str(content);
+        let len = self.len();
+        *self = &self[len..];
+        Ok(len)
+    }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -336,7 +348,7 @@ impl Write for &mut [u8] {
     #[inline]
     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         let amt = cmp::min(data.len(), self.len());
-        let (a, b) = mem::replace(self, &mut []).split_at_mut(amt);
+        let (a, b) = mem::take(self).split_at_mut(amt);
         a.copy_from_slice(&data[..amt]);
         *self = b;
         Ok(amt)
@@ -434,6 +446,33 @@ impl<A: Allocator> Read for VecDeque<u8, A> {
         self.drain(..n);
         Ok(())
     }
+
+    #[inline]
+    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
+        // The total len is known upfront so we can reserve it in a single call.
+        let len = self.len();
+        buf.reserve(len);
+
+        let (front, back) = self.as_slices();
+        buf.extend_from_slice(front);
+        buf.extend_from_slice(back);
+        self.clear();
+        Ok(len)
+    }
+
+    #[inline]
+    fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
+        // We have to use a single contiguous slice because the `VecDequeue` might be split in the
+        // middle of an UTF-8 character.
+        let len = self.len();
+        let content = self.make_contiguous();
+        let string = str::from_utf8(content).map_err(|_| {
+            io::const_io_error!(ErrorKind::InvalidData, "stream did not contain valid UTF-8")
+        })?;
+        buf.push_str(string);
+        self.clear();
+        Ok(len)
+    }
 }
 
 /// Write is implemented for `VecDeque<u8>` by appending to the `VecDeque`, growing it as needed.
@@ -446,6 +485,21 @@ impl<A: Allocator> Write for VecDeque<u8, A> {
     }
 
     #[inline]
+    fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
+        let len = bufs.iter().map(|b| b.len()).sum();
+        self.reserve(len);
+        for buf in bufs {
+            self.extend(&**buf);
+        }
+        Ok(len)
+    }
+
+    #[inline]
+    fn is_write_vectored(&self) -> bool {
+        true
+    }
+
+    #[inline]
     fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
         self.extend(buf);
         Ok(())
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index 020c723925a..8c1c8cac0ef 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -253,7 +253,7 @@ mod tests;
 
 use crate::cmp;
 use crate::fmt;
-use crate::mem::replace;
+use crate::mem::take;
 use crate::ops::{Deref, DerefMut};
 use crate::slice;
 use crate::str;
@@ -1186,7 +1186,7 @@ impl<'a> IoSliceMut<'a> {
             }
         }
 
-        *bufs = &mut replace(bufs, &mut [])[remove..];
+        *bufs = &mut take(bufs)[remove..];
         if bufs.is_empty() {
             assert!(n == accumulated_len, "advancing io slices beyond their length");
         } else {
@@ -1329,7 +1329,7 @@ impl<'a> IoSlice<'a> {
             }
         }
 
-        *bufs = &mut replace(bufs, &mut [])[remove..];
+        *bufs = &mut take(bufs)[remove..];
         if bufs.is_empty() {
             assert!(n == accumulated_len, "advancing io slices beyond their length");
         } else {
diff --git a/library/std/src/sys/unsupported/io.rs b/library/std/src/sys/unsupported/io.rs
index 82610ffab7e..6372fca74e0 100644
--- a/library/std/src/sys/unsupported/io.rs
+++ b/library/std/src/sys/unsupported/io.rs
@@ -30,7 +30,7 @@ impl<'a> IoSliceMut<'a> {
 
     #[inline]
     pub fn advance(&mut self, n: usize) {
-        let slice = mem::replace(&mut self.0, &mut []);
+        let slice = mem::take(&mut self.0);
         let (_, remaining) = slice.split_at_mut(n);
         self.0 = remaining;
     }
diff --git a/src/tools/miri/tests/fail/const-ub-checks.stderr b/src/tools/miri/tests/fail/const-ub-checks.stderr
index a8b7ea242b9..596a6bb4ca8 100644
--- a/src/tools/miri/tests/fail/const-ub-checks.stderr
+++ b/src/tools/miri/tests/fail/const-ub-checks.stderr
@@ -4,6 +4,12 @@ error[E0080]: evaluation of constant value failed
 LL |     ptr.read();
    |     ^^^^^^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required
 
+note: erroneous constant used
+  --> $DIR/const-ub-checks.rs:LL:CC
+   |
+LL |     let _x = UNALIGNED_READ;
+   |              ^^^^^^^^^^^^^^
+
 error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/tools/miri/tests/fail/erroneous_const2.stderr b/src/tools/miri/tests/fail/erroneous_const2.stderr
index d41fcfd2302..9aad1fc9b02 100644
--- a/src/tools/miri/tests/fail/erroneous_const2.stderr
+++ b/src/tools/miri/tests/fail/erroneous_const2.stderr
@@ -4,6 +4,20 @@ error[E0080]: evaluation of constant value failed
 LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
    |                   ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
 
+note: erroneous constant used
+  --> $DIR/erroneous_const2.rs:LL:CC
+   |
+LL |     println!("{}", FOO);
+   |                    ^^^
+
+note: erroneous constant used
+  --> $DIR/erroneous_const2.rs:LL:CC
+   |
+LL |     println!("{}", FOO);
+   |                    ^^^
+   |
+   = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
+
 error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/tools/miri/tests/pass/track-alloc-1.rs b/src/tools/miri/tests/pass/track-alloc-1.rs
deleted file mode 100644
index 427c800dc51..00000000000
--- a/src/tools/miri/tests/pass/track-alloc-1.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// Ensure that tracking early allocations doesn't ICE Miri.
-// Early allocations are probably part of the runtime and therefore uninteresting, but they
-// shouldn't cause a crash.
-//@compile-flags: -Zmiri-track-alloc-id=1
-//@normalize-stderr-test: "[48] bytes" -> "SIZE bytes"
-fn main() {}
diff --git a/src/tools/miri/tests/pass/track-alloc-1.stderr b/src/tools/miri/tests/pass/track-alloc-1.stderr
deleted file mode 100644
index 7206edbb701..00000000000
--- a/src/tools/miri/tests/pass/track-alloc-1.stderr
+++ /dev/null
@@ -1,5 +0,0 @@
-note: tracking was triggered
-   |
-   = note: created extern static allocation of SIZE bytes (alignment ALIGN bytes) with id 1
-   = note: (no span available)
-
diff --git a/tests/run-make/const-prop-lint/Makefile b/tests/run-make/const-prop-lint/Makefile
new file mode 100644
index 00000000000..f29f282f787
--- /dev/null
+++ b/tests/run-make/const-prop-lint/Makefile
@@ -0,0 +1,9 @@
+include ../tools.mk
+
+# Test that emitting an error because of arithmetic
+# overflow lint does not leave .o files around
+# because of interrupted codegen.
+
+all:
+	$(RUSTC) input.rs; test $$? -eq 1
+	ls *.o; test $$? -ne 0
diff --git a/tests/run-make/const-prop-lint/input.rs b/tests/run-make/const-prop-lint/input.rs
new file mode 100644
index 00000000000..ccbdfb8d50b
--- /dev/null
+++ b/tests/run-make/const-prop-lint/input.rs
@@ -0,0 +1,5 @@
+#![deny(arithmetic_overflow)]
+
+fn main() {
+    let x = 255u8 + 1;
+}
diff --git a/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs
new file mode 100644
index 00000000000..ef9c56f7592
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs
@@ -0,0 +1,6 @@
+// this test used to ICE
+#![deny(rustdoc::broken_intra_doc_links)]
+//! [Clone ()]. //~ ERROR unresolved
+//! [Clone !]. //~ ERROR incompatible
+//! [`Clone ()`]. //~ ERROR unresolved
+//! [`Clone !`]. //~ ERROR incompatible
diff --git a/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr
new file mode 100644
index 00000000000..8669b0c2086
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr
@@ -0,0 +1,54 @@
+error: unresolved link to `Clone`
+  --> $DIR/issue-110495-suffix-with-space.rs:3:6
+   |
+LL | //! [Clone ()].
+   |      ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace
+   |
+note: the lint level is defined here
+  --> $DIR/issue-110495-suffix-with-space.rs:2:9
+   |
+LL | #![deny(rustdoc::broken_intra_doc_links)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: to link to the trait, prefix with `trait@`
+   |
+LL - //! [Clone ()].
+LL + //! [trait@Clone ].
+   |
+
+error: incompatible link kind for `Clone`
+  --> $DIR/issue-110495-suffix-with-space.rs:4:6
+   |
+LL | //! [Clone !].
+   |      ^^^^^^^ this link resolved to a derive macro, which is not a macro
+   |
+help: to link to the derive macro, prefix with `derive@`
+   |
+LL - //! [Clone !].
+LL + //! [derive@Clone ].
+   |
+
+error: unresolved link to `Clone`
+  --> $DIR/issue-110495-suffix-with-space.rs:5:7
+   |
+LL | //! [`Clone ()`].
+   |       ^^^^^^^^ this link resolves to the trait `Clone`, which is not in the value namespace
+   |
+help: to link to the trait, prefix with `trait@`
+   |
+LL - //! [`Clone ()`].
+LL + //! [`trait@Clone (`].
+   |
+
+error: incompatible link kind for `Clone`
+  --> $DIR/issue-110495-suffix-with-space.rs:6:7
+   |
+LL | //! [`Clone !`].
+   |       ^^^^^^^ this link resolved to a derive macro, which is not a macro
+   |
+help: to link to the derive macro, prefix with `derive@`
+   |
+LL | //! [`derive@Clone !`].
+   |       +++++++
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/consts/const-eval/issue-100878.rs b/tests/ui/consts/const-eval/issue-100878.rs
index 353ce505035..bd56f854c8b 100644
--- a/tests/ui/consts/const-eval/issue-100878.rs
+++ b/tests/ui/consts/const-eval/issue-100878.rs
@@ -1,6 +1,8 @@
 // This checks that the const-eval ICE in issue #100878 does not recur.
 //
 // build-pass
+
+#[allow(arithmetic_overflow)]
 pub fn bitshift_data(data: [u8; 1]) -> u8 {
     data[0] << 8
 }
diff --git a/tests/ui/issues/issue-33287.rs b/tests/ui/issues/issue-33287.rs
index 770eb7c02bb..b3f87305781 100644
--- a/tests/ui/issues/issue-33287.rs
+++ b/tests/ui/issues/issue-33287.rs
@@ -1,6 +1,7 @@
 // build-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
+#![allow(unconditional_panic)]
 const A: [u32; 1] = [0];
 
 fn test() {
diff --git a/tests/ui/polymorphization/generators.stderr b/tests/ui/polymorphization/generators.stderr
index 84888f6fb2f..32d49d25f02 100644
--- a/tests/ui/polymorphization/generators.stderr
+++ b/tests/ui/polymorphization/generators.stderr
@@ -15,12 +15,6 @@ LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> +
 LL |     || {
    |     ^^
 
-note: the above error was encountered while instantiating `fn finish::<[generator@$DIR/generators.rs:35:5: 35:7], u32, u32>`
-  --> $DIR/generators.rs:86:5
-   |
-LL |     finish(unused_type::<u32>());
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error: item has unused generic parameters
   --> $DIR/generators.rs:60:5
    |
@@ -29,11 +23,5 @@ LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Retu
 LL |     || {
    |     ^^
 
-note: the above error was encountered while instantiating `fn finish::<[generator@$DIR/generators.rs:60:5: 60:7], u32, u32>`
-  --> $DIR/generators.rs:89:5
-   |
-LL |     finish(unused_const::<1u32>());
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error: aborting due to 2 previous errors; 1 warning emitted
 
diff --git a/tests/ui/polymorphization/predicates.stderr b/tests/ui/polymorphization/predicates.stderr
index 80bb2af25cc..a3b2f75b12d 100644
--- a/tests/ui/polymorphization/predicates.stderr
+++ b/tests/ui/polymorphization/predicates.stderr
@@ -1,4 +1,10 @@
 error: item has unused generic parameters
+  --> $DIR/predicates.rs:10:4
+   |
+LL | fn bar<I>() {
+   |    ^^^ - generic parameter `I` is unused
+
+error: item has unused generic parameters
   --> $DIR/predicates.rs:15:4
    |
 LL | fn foo<I, T>(_: I)
@@ -35,17 +41,5 @@ error: item has unused generic parameters
 LL | fn foobar<F, G>() -> usize
    |    ^^^^^^ - generic parameter `F` is unused
 
-error: item has unused generic parameters
-  --> $DIR/predicates.rs:10:4
-   |
-LL | fn bar<I>() {
-   |    ^^^ - generic parameter `I` is unused
-
-note: the above error was encountered while instantiating `fn foo::<std::slice::Iter<'_, u32>, T>`
-  --> $DIR/predicates.rs:86:5
-   |
-LL |     foo(x.iter());
-   |     ^^^^^^^^^^^^^
-
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/polymorphization/type_parameters/closures.stderr b/tests/ui/polymorphization/type_parameters/closures.stderr
index 94a4a08bd2f..5c3b46c6041 100644
--- a/tests/ui/polymorphization/type_parameters/closures.stderr
+++ b/tests/ui/polymorphization/type_parameters/closures.stderr
@@ -44,21 +44,6 @@ LL |     pub fn unused_all<G: Default>() -> u32 {
    |            ^^^^^^^^^^ - generic parameter `G` is unused
 
 error: item has unused generic parameters
-  --> $DIR/closures.rs:128:23
-   |
-LL |     pub fn used_impl<G: Default>() -> u32 {
-   |                      - generic parameter `G` is unused
-LL |
-LL |         let add_one = |x: u32| {
-   |                       ^^^^^^^^
-
-error: item has unused generic parameters
-  --> $DIR/closures.rs:126:12
-   |
-LL |     pub fn used_impl<G: Default>() -> u32 {
-   |            ^^^^^^^^^ - generic parameter `G` is unused
-
-error: item has unused generic parameters
   --> $DIR/closures.rs:115:23
    |
 LL | impl<F: Default> Foo<F> {
@@ -76,5 +61,20 @@ LL | impl<F: Default> Foo<F> {
 LL |     pub fn used_fn<G: Default>() -> u32 {
    |            ^^^^^^^
 
+error: item has unused generic parameters
+  --> $DIR/closures.rs:128:23
+   |
+LL |     pub fn used_impl<G: Default>() -> u32 {
+   |                      - generic parameter `G` is unused
+LL |
+LL |         let add_one = |x: u32| {
+   |                       ^^^^^^^^
+
+error: item has unused generic parameters
+  --> $DIR/closures.rs:126:12
+   |
+LL |     pub fn used_impl<G: Default>() -> u32 {
+   |            ^^^^^^^^^ - generic parameter `G` is unused
+
 error: aborting due to 9 previous errors