about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs8
-rw-r--r--compiler/rustc_index/src/bit_set.rs26
-rw-r--r--compiler/rustc_index/src/bit_set/tests.rs19
-rw-r--r--compiler/rustc_lint/messages.ftl2
-rw-r--r--compiler/rustc_lint/src/types.rs16
-rw-r--r--compiler/rustc_target/src/target_features.rs26
-rw-r--r--compiler/rustc_type_ir/src/interner.rs136
-rw-r--r--library/core/src/fmt/mod.rs14
-rw-r--r--library/core/src/primitive_docs.rs14
-rw-r--r--library/core/src/str/traits.rs14
-rw-r--r--library/std/src/ffi/os_str.rs3
-rw-r--r--library/std/src/path.rs3
-rw-r--r--library/std/src/sys/os_str/bytes.rs2
-rw-r--r--library/std/src/sys/os_str/wtf8.rs2
-rw-r--r--library/std/src/sys_common/wtf8.rs2
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs30
-rw-r--r--src/ci/docker/host-x86_64/dist-sparcv9-solaris/Dockerfile36
-rw-r--r--src/ci/docker/host-x86_64/dist-various-2/Dockerfile11
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh111
-rw-r--r--src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile1
-rw-r--r--src/ci/docker/host-x86_64/dist-x86_64-solaris/Dockerfile36
-rw-r--r--src/ci/docker/scripts/illumos-toolchain.sh52
-rw-r--r--src/ci/docker/scripts/shared.sh34
-rw-r--r--src/ci/docker/scripts/solaris-toolchain.sh162
-rw-r--r--src/ci/github-actions/jobs.yml6
-rw-r--r--src/doc/rustc/src/platform-support.md4
-rw-r--r--src/doc/rustc/src/platform-support/solaris.md4
-rw-r--r--src/tools/miri/src/alloc/isolated_alloc.rs5
-rw-r--r--tests/ui/asm/naked-functions-ffi.rs1
-rw-r--r--tests/ui/asm/naked-functions-ffi.stderr10
-rw-r--r--tests/ui/autoref-autoderef/autoderef-privacy.rs16
-rw-r--r--tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs2
-rw-r--r--tests/ui/auxiliary/pub-and-stability.rs8
-rw-r--r--tests/ui/check-cfg/target_feature.stderr12
-rw-r--r--tests/ui/coherence/coherence_inherent.rs6
-rw-r--r--tests/ui/consts/const-blocks/migrate-fail.rs2
-rw-r--r--tests/ui/consts/const-blocks/migrate-pass.rs4
-rw-r--r--tests/ui/consts/const-blocks/nll-fail.rs2
-rw-r--r--tests/ui/consts/const-blocks/nll-pass.rs4
-rw-r--r--tests/ui/cross-crate/auxiliary/static_priv_by_default.rs10
-rw-r--r--tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs4
-rw-r--r--tests/ui/dep-graph/dep-graph-caller-callee.rs4
-rw-r--r--tests/ui/dep-graph/dep-graph-struct-signature.rs4
-rw-r--r--tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs6
-rw-r--r--tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs6
-rw-r--r--tests/ui/dep-graph/dep-graph-trait-impl.rs6
-rw-r--r--tests/ui/derived-errors/issue-31997.rs2
-rw-r--r--tests/ui/derived-errors/issue-31997.stderr6
-rw-r--r--tests/ui/drop/issue-23338-ensure-param-drop-order.rs2
-rw-r--r--tests/ui/drop/issue-23611-enum-swap-in-drop.rs2
-rw-r--r--tests/ui/dropck/dropck_trait_cycle_checked.rs2
-rw-r--r--tests/ui/error-codes/E0659.rs4
-rw-r--r--tests/ui/error-codes/E0659.stderr8
-rw-r--r--tests/ui/explore-issue-38412.stderr8
-rw-r--r--tests/ui/imports/duplicate.rs18
-rw-r--r--tests/ui/imports/duplicate.stderr24
-rw-r--r--tests/ui/imports/export-glob-imports-target.rs2
-rw-r--r--tests/ui/imports/glob-cycles.rs6
-rw-r--r--tests/ui/imports/glob-shadowing.rs6
-rw-r--r--tests/ui/imports/glob-shadowing.stderr12
-rw-r--r--tests/ui/imports/import-glob-1.rs2
-rw-r--r--tests/ui/imports/import-glob-circular.rs6
-rw-r--r--tests/ui/imports/import-loop-2.rs4
-rw-r--r--tests/ui/imports/import-loop-2.stderr6
-rw-r--r--tests/ui/imports/import-loop.rs2
-rw-r--r--tests/ui/imports/import-loop.stderr6
-rw-r--r--tests/ui/imports/import-rpass.rs4
-rw-r--r--tests/ui/imports/import4.rs4
-rw-r--r--tests/ui/imports/import4.stderr6
-rw-r--r--tests/ui/imports/import5.rs2
-rw-r--r--tests/ui/imports/import6.rs2
-rw-r--r--tests/ui/imports/imports.rs21
-rw-r--r--tests/ui/imports/issue-18083.rs4
-rw-r--r--tests/ui/imports/issue-19498.rs2
-rw-r--r--tests/ui/imports/issue-19498.stderr8
-rw-r--r--tests/ui/imports/issue-32222.rs2
-rw-r--r--tests/ui/imports/issue-4366-2.rs4
-rw-r--r--tests/ui/imports/issue-4366.rs4
-rw-r--r--tests/ui/imports/issue-4865-1.rs8
-rw-r--r--tests/ui/imports/issue-4865-2.rs2
-rw-r--r--tests/ui/imports/issue-4865-3.rs4
-rw-r--r--tests/ui/imports/issue-8208.rs2
-rw-r--r--tests/ui/imports/issue-8208.stderr6
-rw-r--r--tests/ui/imports/issue-8640.rs2
-rw-r--r--tests/ui/imports/issue-8640.stderr8
-rw-r--r--tests/ui/imports/local-modularized-tricky-fail-2.rs4
-rw-r--r--tests/ui/imports/local-modularized-tricky-fail-2.stderr8
-rw-r--r--tests/ui/imports/macros.rs4
-rw-r--r--tests/ui/imports/macros.stderr4
-rw-r--r--tests/ui/imports/reexport-star.rs2
-rw-r--r--tests/ui/imports/reexports.rs4
-rw-r--r--tests/ui/imports/reexports.stderr12
-rw-r--r--tests/ui/imports/shadow_builtin_macros.rs10
-rw-r--r--tests/ui/imports/shadow_builtin_macros.stderr12
-rw-r--r--tests/ui/intrinsics/intrinsic-alignment.rs20
-rw-r--r--tests/ui/lint/lint-ctypes-enum.rs10
-rw-r--r--tests/ui/lint/lint-ctypes-enum.stderr112
-rw-r--r--tests/ui/lint/lint-ctypes-fn.rs15
-rw-r--r--tests/ui/lint/lint-ctypes-fn.stderr48
-rw-r--r--tests/ui/lint/lint-ctypes.rs12
-rw-r--r--tests/ui/lint/lint-ctypes.stderr70
101 files changed, 778 insertions, 678 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 8f57f0983ab..9718c95f38a 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -282,6 +282,14 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
         }
         // Filter out features that are not supported by the current LLVM version
         ("riscv32" | "riscv64", "zacas") if get_version().0 < 20 => None,
+        (
+            "s390x",
+            "message-security-assist-extension12"
+            | "concurrent-functions"
+            | "miscellaneous-extensions-4"
+            | "vector-enhancements-3"
+            | "vector-packed-decimal-enhancement-3",
+        ) if get_version().0 < 20 => None,
         // Enable the evex512 target feature if an avx512 target feature is enabled.
         ("x86", s) if s.starts_with("avx512") => Some(LLVMFeature::with_dependencies(
             s,
diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs
index 07934389158..a4885aabe1f 100644
--- a/compiler/rustc_index/src/bit_set.rs
+++ b/compiler/rustc_index/src/bit_set.rs
@@ -234,6 +234,32 @@ impl<T: Idx> DenseBitSet<T> {
         self.clear_excess_bits();
     }
 
+    /// Checks whether any bit in the given range is a 1.
+    #[inline]
+    pub fn contains_any(&self, elems: impl RangeBounds<T>) -> bool {
+        let Some((start, end)) = inclusive_start_end(elems, self.domain_size) else {
+            return false;
+        };
+        let (start_word_index, start_mask) = word_index_and_mask(start);
+        let (end_word_index, end_mask) = word_index_and_mask(end);
+
+        if start_word_index == end_word_index {
+            self.words[start_word_index] & (end_mask | (end_mask - start_mask)) != 0
+        } else {
+            if self.words[start_word_index] & !(start_mask - 1) != 0 {
+                return true;
+            }
+
+            let remaining = start_word_index + 1..end_word_index;
+            if remaining.start <= remaining.end {
+                self.words[remaining].iter().any(|&w| w != 0)
+                    || self.words[end_word_index] & (end_mask | (end_mask - 1)) != 0
+            } else {
+                false
+            }
+        }
+    }
+
     /// Returns `true` if the set has changed.
     #[inline]
     pub fn remove(&mut self, elem: T) -> bool {
diff --git a/compiler/rustc_index/src/bit_set/tests.rs b/compiler/rustc_index/src/bit_set/tests.rs
index 323a66ddc6f..9ce4cf4293f 100644
--- a/compiler/rustc_index/src/bit_set/tests.rs
+++ b/compiler/rustc_index/src/bit_set/tests.rs
@@ -692,6 +692,25 @@ fn dense_last_set_before() {
     }
 }
 
+#[test]
+fn dense_contains_any() {
+    let mut set: DenseBitSet<usize> = DenseBitSet::new_empty(300);
+    assert!(!set.contains_any(0..300));
+    set.insert_range(10..20);
+    set.insert_range(60..70);
+    set.insert_range(150..=250);
+
+    assert!(set.contains_any(0..30));
+    assert!(set.contains_any(5..100));
+    assert!(set.contains_any(250..255));
+
+    assert!(!set.contains_any(20..59));
+    assert!(!set.contains_any(256..290));
+
+    set.insert(22);
+    assert!(set.contains_any(20..59));
+}
+
 #[bench]
 fn bench_insert(b: &mut Bencher) {
     let mut bs = DenseBitSet::new_filled(99999usize);
diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl
index 17485a838f3..e7e60e8701a 100644
--- a/compiler/rustc_lint/messages.ftl
+++ b/compiler/rustc_lint/messages.ftl
@@ -374,8 +374,6 @@ lint_improper_ctypes = `extern` {$desc} uses type `{$ty}`, which is not FFI-safe
     .label = not FFI-safe
     .note = the type is defined here
 
-lint_improper_ctypes_128bit = 128-bit integers don't currently have a known stable ABI
-
 lint_improper_ctypes_array_help = consider passing a pointer to the array
 
 lint_improper_ctypes_array_reason = passing raw arrays by value is not FFI-safe
diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs
index 77dc6335113..fec23354c91 100644
--- a/compiler/rustc_lint/src/types.rs
+++ b/compiler/rustc_lint/src/types.rs
@@ -1,9 +1,7 @@
 use std::iter;
 use std::ops::ControlFlow;
 
-use rustc_abi::{
-    BackendRepr, Integer, IntegerType, TagEncoding, VariantIdx, Variants, WrappingRange,
-};
+use rustc_abi::{BackendRepr, TagEncoding, VariantIdx, Variants, WrappingRange};
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::DiagMessage;
 use rustc_hir::intravisit::VisitorExt;
@@ -1284,14 +1282,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
                             };
                         }
 
-                        if let Some(IntegerType::Fixed(Integer::I128, _)) = def.repr().int {
-                            return FfiUnsafe {
-                                ty,
-                                reason: fluent::lint_improper_ctypes_128bit,
-                                help: None,
-                            };
-                        }
-
                         use improper_ctypes::check_non_exhaustive_variant;
 
                         let non_exhaustive = def.variant_list_has_applicable_non_exhaustive();
@@ -1324,10 +1314,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
             // but only the base type is relevant for being representable in FFI.
             ty::Pat(base, ..) => self.check_type_for_ffi(acc, base),
 
-            ty::Int(ty::IntTy::I128) | ty::Uint(ty::UintTy::U128) => {
-                FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_128bit, help: None }
-            }
-
             // Primitive types with a stable representation.
             ty::Bool | ty::Int(..) | ty::Uint(..) | ty::Float(..) | ty::Never => FfiSafe,
 
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index 576c9bd6b57..682c4c5068f 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -710,29 +710,35 @@ static LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
     // tidy-alphabetical-end
 ];
 
+#[rustfmt::skip]
 const IBMZ_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
     // tidy-alphabetical-start
     ("backchain", Unstable(sym::s390x_target_feature), &[]),
+    ("concurrent-functions", Unstable(sym::s390x_target_feature), &[]),
     ("deflate-conversion", Unstable(sym::s390x_target_feature), &[]),
     ("enhanced-sort", Unstable(sym::s390x_target_feature), &[]),
     ("guarded-storage", Unstable(sym::s390x_target_feature), &[]),
     ("high-word", Unstable(sym::s390x_target_feature), &[]),
+    // LLVM does not define message-security-assist-extension versions 1, 2, 6, 10 and 11.
+    ("message-security-assist-extension12", Unstable(sym::s390x_target_feature), &[]),
+    ("message-security-assist-extension3", Unstable(sym::s390x_target_feature), &[]),
+    ("message-security-assist-extension4", Unstable(sym::s390x_target_feature), &[]),
+    ("message-security-assist-extension5", Unstable(sym::s390x_target_feature), &[]),
+    ("message-security-assist-extension8", Unstable(sym::s390x_target_feature), &["message-security-assist-extension3"]),
+    ("message-security-assist-extension9", Unstable(sym::s390x_target_feature), &["message-security-assist-extension3", "message-security-assist-extension4"]),
+    ("miscellaneous-extensions-2", Unstable(sym::s390x_target_feature), &[]),
+    ("miscellaneous-extensions-3", Unstable(sym::s390x_target_feature), &[]),
+    ("miscellaneous-extensions-4", Unstable(sym::s390x_target_feature), &[]),
     ("nnp-assist", Unstable(sym::s390x_target_feature), &["vector"]),
     ("transactional-execution", Unstable(sym::s390x_target_feature), &[]),
     ("vector", Unstable(sym::s390x_target_feature), &[]),
     ("vector-enhancements-1", Unstable(sym::s390x_target_feature), &["vector"]),
     ("vector-enhancements-2", Unstable(sym::s390x_target_feature), &["vector-enhancements-1"]),
+    ("vector-enhancements-3", Unstable(sym::s390x_target_feature), &["vector-enhancements-2"]),
     ("vector-packed-decimal", Unstable(sym::s390x_target_feature), &["vector"]),
-    (
-        "vector-packed-decimal-enhancement",
-        Unstable(sym::s390x_target_feature),
-        &["vector-packed-decimal"],
-    ),
-    (
-        "vector-packed-decimal-enhancement-2",
-        Unstable(sym::s390x_target_feature),
-        &["vector-packed-decimal-enhancement"],
-    ),
+    ("vector-packed-decimal-enhancement", Unstable(sym::s390x_target_feature), &["vector-packed-decimal"]),
+    ("vector-packed-decimal-enhancement-2", Unstable(sym::s390x_target_feature), &["vector-packed-decimal-enhancement"]),
+    ("vector-packed-decimal-enhancement-3", Unstable(sym::s390x_target_feature), &["vector-packed-decimal-enhancement-2"]),
     // tidy-alphabetical-end
 ];
 
diff --git a/compiler/rustc_type_ir/src/interner.rs b/compiler/rustc_type_ir/src/interner.rs
index a9917192144..05ca6f10323 100644
--- a/compiler/rustc_type_ir/src/interner.rs
+++ b/compiler/rustc_type_ir/src/interner.rs
@@ -4,7 +4,6 @@ use std::ops::Deref;
 
 use rustc_ast_ir::Movability;
 use rustc_index::bit_set::DenseBitSet;
-use smallvec::SmallVec;
 
 use crate::fold::TypeFoldable;
 use crate::inherent::*;
@@ -382,28 +381,45 @@ impl<T, R> CollectAndApply<T, R> for T {
         F: FnOnce(&[T]) -> R,
     {
         // This code is hot enough that it's worth specializing for the most
-        // common length lists, to avoid the overhead of `SmallVec` creation.
-        // Lengths 0, 1, and 2 typically account for ~95% of cases. If
-        // `size_hint` is incorrect a panic will occur via an `unwrap` or an
-        // `assert`.
-        match iter.size_hint() {
-            (0, Some(0)) => {
-                assert!(iter.next().is_none());
-                f(&[])
-            }
-            (1, Some(1)) => {
-                let t0 = iter.next().unwrap();
-                assert!(iter.next().is_none());
-                f(&[t0])
-            }
-            (2, Some(2)) => {
-                let t0 = iter.next().unwrap();
-                let t1 = iter.next().unwrap();
-                assert!(iter.next().is_none());
-                f(&[t0, t1])
-            }
-            _ => f(&iter.collect::<SmallVec<[_; 8]>>()),
-        }
+        // common length lists, to avoid the overhead of `Vec` creation.
+
+        let Some(t0) = iter.next() else {
+            return f(&[]);
+        };
+
+        let Some(t1) = iter.next() else {
+            return f(&[t0]);
+        };
+
+        let Some(t2) = iter.next() else {
+            return f(&[t0, t1]);
+        };
+
+        let Some(t3) = iter.next() else {
+            return f(&[t0, t1, t2]);
+        };
+
+        let Some(t4) = iter.next() else {
+            return f(&[t0, t1, t2, t3]);
+        };
+
+        let Some(t5) = iter.next() else {
+            return f(&[t0, t1, t2, t3, t4]);
+        };
+
+        let Some(t6) = iter.next() else {
+            return f(&[t0, t1, t2, t3, t4, t5]);
+        };
+
+        let Some(t7) = iter.next() else {
+            return f(&[t0, t1, t2, t3, t4, t5, t6]);
+        };
+
+        let Some(t8) = iter.next() else {
+            return f(&[t0, t1, t2, t3, t4, t5, t6, t7]);
+        };
+
+        f(&[t0, t1, t2, t3, t4, t5, t6, t7, t8].into_iter().chain(iter).collect::<Vec<_>>())
     }
 }
 
@@ -419,29 +435,57 @@ impl<T, R, E> CollectAndApply<T, R> for Result<T, E> {
         F: FnOnce(&[T]) -> R,
     {
         // This code is hot enough that it's worth specializing for the most
-        // common length lists, to avoid the overhead of `SmallVec` creation.
-        // Lengths 0, 1, and 2 typically account for ~95% of cases. If
-        // `size_hint` is incorrect a panic will occur via an `unwrap` or an
-        // `assert`, unless a failure happens first, in which case the result
-        // will be an error anyway.
-        Ok(match iter.size_hint() {
-            (0, Some(0)) => {
-                assert!(iter.next().is_none());
-                f(&[])
-            }
-            (1, Some(1)) => {
-                let t0 = iter.next().unwrap()?;
-                assert!(iter.next().is_none());
-                f(&[t0])
-            }
-            (2, Some(2)) => {
-                let t0 = iter.next().unwrap()?;
-                let t1 = iter.next().unwrap()?;
-                assert!(iter.next().is_none());
-                f(&[t0, t1])
-            }
-            _ => f(&iter.collect::<Result<SmallVec<[_; 8]>, _>>()?),
-        })
+        // common length lists, to avoid the overhead of `Vec` creation.
+
+        let Some(t0) = iter.next() else {
+            return Ok(f(&[]));
+        };
+        let t0 = t0?;
+
+        let Some(t1) = iter.next() else {
+            return Ok(f(&[t0]));
+        };
+        let t1 = t1?;
+
+        let Some(t2) = iter.next() else {
+            return Ok(f(&[t0, t1]));
+        };
+        let t2 = t2?;
+
+        let Some(t3) = iter.next() else {
+            return Ok(f(&[t0, t1, t2]));
+        };
+        let t3 = t3?;
+
+        let Some(t4) = iter.next() else {
+            return Ok(f(&[t0, t1, t2, t3]));
+        };
+        let t4 = t4?;
+
+        let Some(t5) = iter.next() else {
+            return Ok(f(&[t0, t1, t2, t3, t4]));
+        };
+        let t5 = t5?;
+
+        let Some(t6) = iter.next() else {
+            return Ok(f(&[t0, t1, t2, t3, t4, t5]));
+        };
+        let t6 = t6?;
+
+        let Some(t7) = iter.next() else {
+            return Ok(f(&[t0, t1, t2, t3, t4, t5, t6]));
+        };
+        let t7 = t7?;
+
+        let Some(t8) = iter.next() else {
+            return Ok(f(&[t0, t1, t2, t3, t4, t5, t6, t7]));
+        };
+        let t8 = t8?;
+
+        Ok(f(&[Ok(t0), Ok(t1), Ok(t2), Ok(t3), Ok(t4), Ok(t5), Ok(t6), Ok(t7), Ok(t8)]
+            .into_iter()
+            .chain(iter)
+            .collect::<Result<Vec<_>, _>>()?))
     }
 }
 
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs
index 5978cb660f6..145e581d1fb 100644
--- a/library/core/src/fmt/mod.rs
+++ b/library/core/src/fmt/mod.rs
@@ -928,6 +928,20 @@ pub use macros::Debug;
 /// [tostring]: ../../std/string/trait.ToString.html
 /// [tostring_function]: ../../std/string/trait.ToString.html#tymethod.to_string
 ///
+/// # Completeness and parseability
+///
+/// `Display` for a type might not necessarily be a lossless or complete representation of the type.
+/// It may omit internal state, precision, or other information the type does not consider important
+/// for user-facing output, as determined by the type. As such, the output of `Display` might not be
+/// possible to parse, and even if it is, the result of parsing might not exactly match the original
+/// value.
+///
+/// However, if a type has a lossless `Display` implementation whose output is meant to be
+/// conveniently machine-parseable and not just meant for human consumption, then the type may wish
+/// to accept the same format in `FromStr`, and document that usage. Having both `Display` and
+/// `FromStr` implementations where the result of `Display` cannot be parsed with `FromStr` may
+/// surprise users.
+///
 /// # Internationalization
 ///
 /// Because a type can only have one `Display` implementation, it is often preferable
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs
index 10b11613f90..cb1cf818bf0 100644
--- a/library/core/src/primitive_docs.rs
+++ b/library/core/src/primitive_docs.rs
@@ -1428,6 +1428,18 @@ mod prim_i64 {}
 #[rustc_doc_primitive = "i128"]
 //
 /// The 128-bit signed integer type.
+///
+/// # ABI compatibility
+///
+/// Rust's `i128` is expected to be ABI-compatible with C's `__int128` on platforms where the type
+/// is available, which includes most 64-bit architectures. If any platforms that do not specify
+/// `__int128` are updated to introduce it, the Rust `i128` ABI on relevant targets will be changed
+/// to match.
+///
+/// It is important to note that in C, `__int128` is _not_ the same as `_BitInt(128)`, and the two
+/// types are allowed to have different ABIs. In particular, on x86, `__int128` and `_BitInt(128)`
+/// do not use the same alignment. `i128` is intended to always match `__int128` and does not
+/// attempt to match `_BitInt(128)` on platforms without `__int128`.
 #[stable(feature = "i128", since = "1.26.0")]
 mod prim_i128 {}
 
@@ -1458,6 +1470,8 @@ mod prim_u64 {}
 #[rustc_doc_primitive = "u128"]
 //
 /// The 128-bit unsigned integer type.
+///
+/// Please see [the documentation for `i128`](prim@i128) for information on ABI compatibility.
 #[stable(feature = "i128", since = "1.26.0")]
 mod prim_u128 {}
 
diff --git a/library/core/src/str/traits.rs b/library/core/src/str/traits.rs
index 4baf9aacad7..b9559c83171 100644
--- a/library/core/src/str/traits.rs
+++ b/library/core/src/str/traits.rs
@@ -756,6 +756,20 @@ unsafe impl SliceIndex<str> for ops::RangeToInclusive<usize> {
 /// parse an `i32` with `FromStr`, but not a `&i32`. You can parse a struct that
 /// contains an `i32`, but not one that contains an `&i32`.
 ///
+/// # Input format and round-tripping
+///
+/// The input format expected by a type's `FromStr` implementation depends on the type. Check the
+/// type's documentation for the input formats it knows how to parse. Note that the input format of
+/// a type's `FromStr` implementation might not necessarily accept the output format of its
+/// `Display` implementation, and even if it does, the `Display` implementation may not be lossless
+/// so the round-trip may lose information.
+///
+/// However, if a type has a lossless `Display` implementation whose output is meant to be
+/// conveniently machine-parseable and not just meant for human consumption, then the type may wish
+/// to accept the same format in `FromStr`, and document that usage. Having both `Display` and
+/// `FromStr` implementations where the result of `Display` cannot be parsed with `FromStr` may
+/// surprise users.
+///
 /// # Examples
 ///
 /// Basic implementation of `FromStr` on an example `Point` type:
diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs
index b0580b467be..21d5b7292e8 100644
--- a/library/std/src/ffi/os_str.rs
+++ b/library/std/src/ffi/os_str.rs
@@ -137,7 +137,8 @@ impl OsString {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[must_use]
     #[inline]
-    pub fn new() -> OsString {
+    #[rustc_const_unstable(feature = "const_pathbuf_osstring_new", issue = "141520")]
+    pub const fn new() -> OsString {
         OsString { inner: Buf::from_string(String::new()) }
     }
 
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 050c617f564..014b56d28f4 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -1191,7 +1191,8 @@ impl PathBuf {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[must_use]
     #[inline]
-    pub fn new() -> PathBuf {
+    #[rustc_const_unstable(feature = "const_pathbuf_osstring_new", issue = "141520")]
+    pub const fn new() -> PathBuf {
         PathBuf { inner: OsString::new() }
     }
 
diff --git a/library/std/src/sys/os_str/bytes.rs b/library/std/src/sys/os_str/bytes.rs
index 4a8808c9230..f8ab4543a3a 100644
--- a/library/std/src/sys/os_str/bytes.rs
+++ b/library/std/src/sys/os_str/bytes.rs
@@ -115,7 +115,7 @@ impl Buf {
     }
 
     #[inline]
-    pub fn from_string(s: String) -> Buf {
+    pub const fn from_string(s: String) -> Buf {
         Buf { inner: s.into_bytes() }
     }
 
diff --git a/library/std/src/sys/os_str/wtf8.rs b/library/std/src/sys/os_str/wtf8.rs
index 892bd2e3de6..bbc704ebf86 100644
--- a/library/std/src/sys/os_str/wtf8.rs
+++ b/library/std/src/sys/os_str/wtf8.rs
@@ -92,7 +92,7 @@ impl Buf {
     }
 
     #[inline]
-    pub fn from_string(s: String) -> Buf {
+    pub const fn from_string(s: String) -> Buf {
         Buf { inner: Wtf8Buf::from_string(s) }
     }
 
diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs
index f9ec112b197..50bde88b5a4 100644
--- a/library/std/src/sys_common/wtf8.rs
+++ b/library/std/src/sys_common/wtf8.rs
@@ -209,7 +209,7 @@ impl Wtf8Buf {
     ///
     /// Since WTF-8 is a superset of UTF-8, this always succeeds.
     #[inline]
-    pub fn from_string(string: String) -> Wtf8Buf {
+    pub const fn from_string(string: String) -> Wtf8Buf {
         Wtf8Buf { bytes: string.into_bytes(), is_known_utf8: true }
     }
 
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 37d53ce476a..d52b9dd1f3a 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -1878,23 +1878,27 @@ impl Step for Sysroot {
         // so that any tools relying on `rust-src` also work for local builds,
         // and also for translating the virtual `/rustc/$hash` back to the real
         // directory (for running tests with `rust.remap-debuginfo = true`).
-        let sysroot_lib_rustlib_src = sysroot.join("lib/rustlib/src");
-        t!(fs::create_dir_all(&sysroot_lib_rustlib_src));
-        let sysroot_lib_rustlib_src_rust = sysroot_lib_rustlib_src.join("rust");
-        if let Err(e) = symlink_dir(&builder.config, &builder.src, &sysroot_lib_rustlib_src_rust) {
-            eprintln!(
-                "ERROR: creating symbolic link `{}` to `{}` failed with {}",
-                sysroot_lib_rustlib_src_rust.display(),
-                builder.src.display(),
-                e,
-            );
-            if builder.config.rust_remap_debuginfo {
+        if compiler.stage != 0 {
+            let sysroot_lib_rustlib_src = sysroot.join("lib/rustlib/src");
+            t!(fs::create_dir_all(&sysroot_lib_rustlib_src));
+            let sysroot_lib_rustlib_src_rust = sysroot_lib_rustlib_src.join("rust");
+            if let Err(e) =
+                symlink_dir(&builder.config, &builder.src, &sysroot_lib_rustlib_src_rust)
+            {
                 eprintln!(
-                    "ERROR: some `tests/ui` tests will fail when lacking `{}`",
+                    "ERROR: creating symbolic link `{}` to `{}` failed with {}",
                     sysroot_lib_rustlib_src_rust.display(),
+                    builder.src.display(),
+                    e,
                 );
+                if builder.config.rust_remap_debuginfo {
+                    eprintln!(
+                        "ERROR: some `tests/ui` tests will fail when lacking `{}`",
+                        sysroot_lib_rustlib_src_rust.display(),
+                    );
+                }
+                build_helper::exit!(1);
             }
-            build_helper::exit!(1);
         }
 
         // rustc-src component is already part of CI rustc's sysroot
diff --git a/src/ci/docker/host-x86_64/dist-sparcv9-solaris/Dockerfile b/src/ci/docker/host-x86_64/dist-sparcv9-solaris/Dockerfile
new file mode 100644
index 00000000000..f7852c6364d
--- /dev/null
+++ b/src/ci/docker/host-x86_64/dist-sparcv9-solaris/Dockerfile
@@ -0,0 +1,36 @@
+FROM ubuntu:22.04
+
+COPY scripts/cross-apt-packages.sh /tmp/
+RUN bash /tmp/cross-apt-packages.sh
+
+# Required gcc dependencies.
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+    libgmp-dev \
+    libmpfr-dev \
+    libmpc-dev \
+    && rm -rf /var/lib/apt/lists/*
+
+COPY scripts/shared.sh /tmp/
+COPY scripts/solaris-toolchain.sh /tmp/
+
+RUN bash /tmp/solaris-toolchain.sh sparcv9 sysroot
+RUN bash /tmp/solaris-toolchain.sh sparcv9 binutils
+RUN bash /tmp/solaris-toolchain.sh sparcv9 gcc
+
+COPY scripts/sccache.sh /scripts/
+RUN sh /scripts/sccache.sh
+
+COPY scripts/cmake.sh /scripts/
+RUN /scripts/cmake.sh
+
+ENV \
+    AR_sparcv9_sun_solaris=sparcv9-solaris-ar \
+    RANLIB_sparcv9_sun_solaris=sparcv9-solaris-ranlib \
+    CC_sparcv9_sun_solaris=sparcv9-solaris-gcc \
+    CXX_sparcv9_sun_solaris=sparcv9-solaris-g++
+
+ENV HOSTS=sparcv9-sun-solaris
+
+ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
+ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
index 03ec77f507e..e1d83d36087 100644
--- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
@@ -43,12 +43,6 @@ ENV \
     CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++ \
     CXXFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \
     LDFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib" \
-    AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
-    CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
-    CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
-    AR_x86_64_pc_solaris=x86_64-pc-solaris2.10-ar \
-    CC_x86_64_pc_solaris=x86_64-pc-solaris2.10-gcc \
-    CXX_x86_64_pc_solaris=x86_64-pc-solaris2.10-g++ \
     CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-9 \
     CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-9 \
     AR_x86_64_fortanix_unknown_sgx=ar \
@@ -84,9 +78,6 @@ WORKDIR /tmp
 COPY scripts/shared.sh /tmp/
 COPY scripts/build-fuchsia-toolchain.sh /tmp/
 RUN /tmp/build-fuchsia-toolchain.sh
-COPY host-x86_64/dist-various-2/build-solaris-toolchain.sh /tmp/
-RUN /tmp/build-solaris-toolchain.sh x86_64  amd64   solaris-i386  pc
-RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc sun
 COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
 RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh
 
@@ -118,8 +109,6 @@ ENV TARGETS=$TARGETS,wasm32-wasip1
 ENV TARGETS=$TARGETS,wasm32-wasip1-threads
 ENV TARGETS=$TARGETS,wasm32-wasip2
 ENV TARGETS=$TARGETS,wasm32v1-none
-ENV TARGETS=$TARGETS,sparcv9-sun-solaris
-ENV TARGETS=$TARGETS,x86_64-pc-solaris
 ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
 ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
 ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
deleted file mode 100755
index d046b539036..00000000000
--- a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env bash
-
-set -ex
-source shared.sh
-
-ARCH=$1
-LIB_ARCH=$2
-APT_ARCH=$3
-MANUFACTURER=$4
-BINUTILS=2.28.1
-GCC=6.5.0
-
-TARGET=${ARCH}-${MANUFACTURER}-solaris2.10
-
-# First up, build binutils
-mkdir binutils
-cd binutils
-
-curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
-mkdir binutils-build
-cd binutils-build
-hide_output ../binutils-$BINUTILS/configure --target=$TARGET
-hide_output make -j10
-hide_output make install
-
-cd ../..
-rm -rf binutils
-
-# Next, download and install the relevant solaris packages
-mkdir solaris
-cd solaris
-
-dpkg --add-architecture $APT_ARCH
-apt-get update
-apt-get install -y --download-only                           \
-  libc:$APT_ARCH                                             \
-  liblgrp:$APT_ARCH                                          \
-  libm-dev:$APT_ARCH                                         \
-  libpthread:$APT_ARCH                                       \
-  libresolv:$APT_ARCH                                        \
-  librt:$APT_ARCH                                            \
-  libsendfile:$APT_ARCH                                      \
-  libsocket:$APT_ARCH                                        \
-  system-crt:$APT_ARCH                                       \
-  system-header:$APT_ARCH
-
-for deb in /var/cache/apt/archives/*$APT_ARCH.deb; do
-  dpkg -x $deb .
-done
-apt-get clean
-
-# The -dev packages are not available from the apt repository we're using.
-# However, those packages are just symlinks from *.so to *.so.<version>.
-# This makes all those symlinks.
-for lib in $(find -name '*.so.*'); do
-  target=${lib%.so.*}.so
-  ln -s ${lib##*/} $target || echo "warning: silenced error symlinking $lib"
-done
-
-# Remove Solaris 11 functions that are optionally used by libbacktrace.
-# This is for Solaris 10 compatibility.
-rm usr/include/link.h
-patch -p0  << 'EOF'
---- usr/include/string.h
-+++ usr/include/string10.h
-@@ -93 +92,0 @@
--extern size_t strnlen(const char *, size_t);
-EOF
-
-mkdir                  /usr/local/$TARGET/usr
-mv usr/include         /usr/local/$TARGET/usr/include
-mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib
-mv     lib/$LIB_ARCH/* /usr/local/$TARGET/lib
-
-ln -s usr/include /usr/local/$TARGET/sys-include
-ln -s usr/include /usr/local/$TARGET/include
-
-cd ..
-rm -rf solaris
-
-# Finally, download and build gcc to target solaris
-mkdir gcc
-cd gcc
-
-curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf -
-cd gcc-$GCC
-
-mkdir ../gcc-build
-cd ../gcc-build
-hide_output ../gcc-$GCC/configure \
-  --enable-languages=c,c++        \
-  --target=$TARGET                \
-  --with-gnu-as                   \
-  --with-gnu-ld                   \
-  --disable-multilib              \
-  --disable-nls                   \
-  --disable-libgomp               \
-  --disable-libquadmath           \
-  --disable-libssp                \
-  --disable-libvtv                \
-  --disable-libcilkrts            \
-  --disable-libada                \
-  --disable-libsanitizer          \
-  --disable-libquadmath-support   \
-  --disable-lto
-
-hide_output make -j10
-hide_output make install
-
-cd ../..
-rm -rf gcc
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile
index 55fefd2b725..37a8dc56a5f 100644
--- a/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile
@@ -15,6 +15,7 @@ RUN apt-get update && \
     python2.7 \
     && rm -rf /var/lib/apt/lists/*
 
+COPY scripts/shared.sh /tmp/
 COPY scripts/illumos-toolchain.sh /tmp/
 
 RUN bash /tmp/illumos-toolchain.sh x86_64 sysroot
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-solaris/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-solaris/Dockerfile
new file mode 100644
index 00000000000..4d77f0aad26
--- /dev/null
+++ b/src/ci/docker/host-x86_64/dist-x86_64-solaris/Dockerfile
@@ -0,0 +1,36 @@
+FROM ubuntu:22.04
+
+COPY scripts/cross-apt-packages.sh /tmp/
+RUN bash /tmp/cross-apt-packages.sh
+
+# Required gcc dependencies.
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+    libgmp-dev \
+    libmpfr-dev \
+    libmpc-dev \
+    && rm -rf /var/lib/apt/lists/*
+
+COPY scripts/shared.sh /tmp/
+COPY scripts/solaris-toolchain.sh /tmp/
+
+RUN bash /tmp/solaris-toolchain.sh x86_64 sysroot
+RUN bash /tmp/solaris-toolchain.sh x86_64 binutils
+RUN bash /tmp/solaris-toolchain.sh x86_64 gcc
+
+COPY scripts/sccache.sh /scripts/
+RUN sh /scripts/sccache.sh
+
+COPY scripts/cmake.sh /scripts/
+RUN /scripts/cmake.sh
+
+ENV \
+    AR_x86_64_pc_solaris=x86_64-solaris-ar \
+    RANLIB_x86_64_pc_solaris=x86_64-solaris-ranlib \
+    CC_x86_64_pc_solaris=x86_64-solaris-gcc \
+    CXX_x86_64_pc_solaris=x86_64-solaris-g++
+
+ENV HOSTS=x86_64-pc-solaris
+
+ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
+ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
diff --git a/src/ci/docker/scripts/illumos-toolchain.sh b/src/ci/docker/scripts/illumos-toolchain.sh
index 0b2c09b3eed..7a3ca875554 100644
--- a/src/ci/docker/scripts/illumos-toolchain.sh
+++ b/src/ci/docker/scripts/illumos-toolchain.sh
@@ -4,6 +4,8 @@ set -o errexit
 set -o pipefail
 set -o xtrace
 
+source /tmp/shared.sh
+
 ARCH="$1"
 PHASE="$2"
 
@@ -59,52 +61,13 @@ BINUTILS_TAR="$BINUTILS_BASE.tar.bz2"
 BINUTILS_URL="https://ftp.gnu.org/gnu/binutils/$BINUTILS_TAR"
 
 
-download_file() {
-        local file="$1"
-        local url="$2"
-        local sum="$3"
-
-        while :; do
-                if [[ -f "$file" ]]; then
-                        if ! h="$(sha256sum "$file" | awk '{ print $1 }')"; then
-                                printf 'ERROR: reading hash\n' >&2
-                                exit 1
-                        fi
-
-                        if [[ "$h" == "$sum" ]]; then
-                                return 0
-                        fi
-
-                        printf 'WARNING: hash mismatch: %s != expected %s\n' \
-                            "$h" "$sum" >&2
-                        rm -f "$file"
-                fi
-
-                printf 'Downloading: %s\n' "$url"
-                if ! curl -f -L -o "$file" "$url"; then
-                        rm -f "$file"
-                        sleep 1
-                fi
-        done
-}
-
-
 case "$PHASE" in
 sysroot)
-        download_file "/tmp/$SYSROOT_TAR" "$SYSROOT_URL" "$SYSROOT_SUM"
-        mkdir -p "$SYSROOT_DIR"
-        cd "$SYSROOT_DIR"
-        tar -xzf "/tmp/$SYSROOT_TAR"
-        rm -f "/tmp/$SYSROOT_TAR"
+        download_tar_and_extract_into_dir "$SYSROOT_URL" "$SYSROOT_SUM" "$SYSROOT_DIR"
         ;;
 
 binutils)
-        download_file "/tmp/$BINUTILS_TAR" "$BINUTILS_URL" "$BINUTILS_SUM"
-        mkdir -p /ws/src/binutils
-        cd /ws/src/binutils
-        tar -xjf "/tmp/$BINUTILS_TAR"
-        rm -f "/tmp/$BINUTILS_TAR"
-
+        download_tar_and_extract_into_dir "$BINUTILS_URL" "$BINUTILS_SUM" /ws/src/binutils
         mkdir -p /ws/build/binutils
         cd /ws/build/binutils
         "/ws/src/binutils/$BINUTILS_BASE/configure" \
@@ -123,12 +86,7 @@ binutils)
         ;;
 
 gcc)
-        download_file "/tmp/$GCC_TAR" "$GCC_URL" "$GCC_SUM"
-        mkdir -p /ws/src/gcc
-        cd /ws/src/gcc
-        tar -xJf "/tmp/$GCC_TAR"
-        rm -f "/tmp/$GCC_TAR"
-
+        download_tar_and_extract_into_dir "$GCC_URL" "$GCC_SUM" /ws/src/gcc
         mkdir -p /ws/build/gcc
         cd /ws/build/gcc
         export CFLAGS='-fPIC'
diff --git a/src/ci/docker/scripts/shared.sh b/src/ci/docker/scripts/shared.sh
index 9969659088d..6efdbb2070d 100644
--- a/src/ci/docker/scripts/shared.sh
+++ b/src/ci/docker/scripts/shared.sh
@@ -40,3 +40,37 @@ function retry {
     }
   done
 }
+
+download_tar_and_extract_into_dir() {
+  local url="$1"
+  local sum="$2"
+  local dir="$3"
+  local file=$(mktemp -u)
+
+  while :; do
+    if [[ -f "$file" ]]; then
+      if ! h="$(sha256sum "$file" | awk '{ print $1 }')"; then
+        printf 'ERROR: reading hash\n' >&2
+        exit 1
+      fi
+
+      if [[ "$h" == "$sum" ]]; then
+        break
+      fi
+
+      printf 'WARNING: hash mismatch: %s != expected %s\n' "$h" "$sum" >&2
+      rm -f "$file"
+    fi
+
+    printf 'Downloading: %s\n' "$url"
+    if ! curl -f -L -o "$file" "$url"; then
+       rm -f "$file"
+      sleep 1
+    fi
+  done
+
+  mkdir -p "$dir"
+  cd "$dir"
+  tar -xf "$file"
+  rm -f "$file"
+}
diff --git a/src/ci/docker/scripts/solaris-toolchain.sh b/src/ci/docker/scripts/solaris-toolchain.sh
new file mode 100644
index 00000000000..82f0f105523
--- /dev/null
+++ b/src/ci/docker/scripts/solaris-toolchain.sh
@@ -0,0 +1,162 @@
+#!/bin/bash
+
+set -o errexit
+set -o pipefail
+set -o xtrace
+
+source /tmp/shared.sh
+
+ARCH="$1"
+PHASE="$2"
+
+JOBS="$(getconf _NPROCESSORS_ONLN)"
+
+case "$ARCH" in
+x86_64)
+        SYSROOT_MACH='i386'
+        ;;
+sparcv9)
+        SYSROOT_MACH='sparc'
+        ;;
+*)
+        printf 'ERROR: unknown architecture: %s\n' "$ARCH"
+        exit 1
+esac
+
+BUILD_TARGET="$ARCH-pc-solaris2.11"
+
+#
+# The illumos and the Solaris build both use the same GCC-level host triple,
+# though different versions of GCC are used and with different configuration
+# options.  To ensure as little accidental cross-pollination as possible, we
+# build the illumos toolchain in a specific directory tree and just symlink the
+# expected tools into /usr/local/bin at the end.  We omit /usr/local/bin from
+# PATH here for similar reasons.
+#
+PREFIX="/opt/solaris/$ARCH"
+export PATH="$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin"
+
+#
+# NOTE: The compiler version selected here is more specific than might appear.
+# GCC 7.X releases do not appear to cross-compile correctly for Solaris
+# targets, at least insofar as they refuse to enable TLS in libstdc++.  When
+# changing the GCC version in future, one must carefully verify that TLS is
+# enabled in all of the static libraries we intend to include in output
+# binaries.
+#
+GCC_VERSION='8.4.0'
+GCC_SUM='e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4'
+GCC_BASE="gcc-$GCC_VERSION"
+GCC_TAR="gcc-$GCC_VERSION.tar.xz"
+GCC_URL="https://ci-mirrors.rust-lang.org/rustc/$GCC_TAR"
+
+SYSROOT_VER='2025-02-21'
+if [ $ARCH = "x86_64" ]; then
+SYSROOT_SUM='e82b78c14464cc2dc71f3cdab312df3dd63441d7c23eeeaf34d41d8b947688d3'
+SYSROOT_TAR="solaris-11.4.42.111.0-i386-sysroot-v$SYSROOT_VER.tar.bz2"
+SYSROOT_DIR="$PREFIX/sysroot-x86_64"
+else
+SYSROOT_SUM='e249a7ef781b9b3297419bd014fa0574800703981d84e113d6af3a897a8b4ffc'
+SYSROOT_TAR="solaris-11.4.42.111.0-sparc-sysroot-v$SYSROOT_VER.tar.bz2"
+SYSROOT_DIR="$PREFIX/sysroot-sparcv9"
+fi
+SYSROOT_URL="https://ci-mirrors.rust-lang.org/rustc/$SYSROOT_TAR"
+
+BINUTILS_VERSION='2.44'
+BINUTILS_SUM='ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237'
+BINUTILS_BASE="binutils-$BINUTILS_VERSION"
+BINUTILS_TAR="$BINUTILS_BASE.tar.xz"
+BINUTILS_URL="https://ci-mirrors.rust-lang.org/rustc/$BINUTILS_TAR"
+
+
+case "$PHASE" in
+sysroot)
+        download_tar_and_extract_into_dir "$SYSROOT_URL" "$SYSROOT_SUM" "$SYSROOT_DIR"
+        ;;
+
+binutils)
+        download_tar_and_extract_into_dir "$BINUTILS_URL" "$BINUTILS_SUM" /ws/src/binutils
+        cat > binutils.patch <<EOF
+Workaround for: https://github.com/rust-lang/rust/issues/137997
+--- binutils-2.44/bfd/elflink.c
++++ binutils-2.44/bfd/elflink.c
+@@ -5150,7 +5150,7 @@
+          if it is not a function, because it might be the version
+          symbol itself.  FIXME: What if it isn't?  */
+       if ((iver.vs_vers & VERSYM_HIDDEN) != 0
+-          || (vernum > 1
++          || (vernum > 1 && strcmp(name, "logb") != 0
+           && (!bfd_is_abs_section (sec)
+               || bed->is_function_type (ELF_ST_TYPE (isym->st_info)))))
+         {
+EOF
+        f=binutils-$BINUTILS_VERSION/bfd/elflink.c && expand -t 4 "$f" > "$f.exp"
+        mv binutils-$BINUTILS_VERSION/bfd/elflink.c.exp binutils-$BINUTILS_VERSION/bfd/elflink.c
+        patch binutils-$BINUTILS_VERSION/bfd/elflink.c < binutils.patch
+        rm binutils.patch
+
+        mkdir -p /ws/build/binutils
+        cd /ws/build/binutils
+        "/ws/src/binutils/$BINUTILS_BASE/configure" \
+            --prefix="$PREFIX" \
+            --target="$BUILD_TARGET" \
+            --program-prefix="$ARCH-solaris-" \
+            --with-sysroot="$SYSROOT_DIR"
+
+        make -j "$JOBS"
+
+        mkdir -p "$PREFIX"
+        make install
+
+        cd
+        rm -rf /ws/src/binutils /ws/build/binutils
+        ;;
+
+gcc)
+        download_tar_and_extract_into_dir "$GCC_URL" "$GCC_SUM" /ws/src/gcc
+        mkdir -p /ws/build/gcc
+        cd /ws/build/gcc
+        export CFLAGS='-fPIC'
+        export CXXFLAGS='-fPIC'
+        export CXXFLAGS_FOR_TARGET='-fPIC'
+        export CFLAGS_FOR_TARGET='-fPIC'
+        "/ws/src/gcc/$GCC_BASE/configure" \
+            --prefix="$PREFIX" \
+            --target="$BUILD_TARGET" \
+            --program-prefix="$ARCH-solaris-" \
+            --with-sysroot="$SYSROOT_DIR" \
+            --with-gnu-as \
+            --with-gnu-ld \
+            --disable-nls \
+            --disable-libgomp \
+            --disable-libquadmath \
+            --disable-libssp \
+            --disable-libvtv \
+            --disable-libcilkrts \
+            --disable-libada \
+            --disable-libsanitizer \
+            --disable-libquadmath-support \
+            --disable-shared \
+            --enable-tls
+
+        make -j "$JOBS"
+
+        mkdir -p "$PREFIX"
+        make install
+
+        #
+        # Link toolchain commands into /usr/local/bin so that cmake and others
+        # can find them:
+        #
+        (cd "$PREFIX/bin" && ls -U) | grep "^$ARCH-solaris-" |
+            xargs -t -I% ln -s "$PREFIX/bin/%" '/usr/local/bin/'
+
+        cd
+        rm -rf /ws/src/gcc /ws/build/gcc
+        ;;
+
+*)
+        printf 'ERROR: unknown phase "%s"\n' "$PHASE" >&2
+        exit 100
+        ;;
+esac
diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml
index 543b79b2f5d..d59e440fb68 100644
--- a/src/ci/github-actions/jobs.yml
+++ b/src/ci/github-actions/jobs.yml
@@ -253,6 +253,12 @@ auto:
   - name: dist-x86_64-netbsd
     <<: *job-linux-4c
 
+  - name: dist-x86_64-solaris
+    <<: *job-linux-4c
+
+  - name: dist-sparcv9-solaris
+    <<: *job-linux-4c
+
   # The i686-gnu job is split into multiple jobs to run tests in parallel.
   # i686-gnu-1 skips tests that run in i686-gnu-2.
   - name: i686-gnu-1
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index 60002a5f9e5..e7dfaaf4fd5 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -110,6 +110,8 @@ target | notes
 `x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.3
 [`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | x86_64 OpenHarmony
 [`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64
+[`x86_64-pc-solaris`](platform-support/solaris.md) | 64-bit x86 Solaris 11.4
+[`sparcv9-sun-solaris`](platform-support/solaris.md) | SPARC V9 Solaris 11.4
 
 ## Tier 2 without Host Tools
 
@@ -183,7 +185,6 @@ target | std | notes
 `riscv64gc-unknown-none-elf` | * | Bare RISC-V (RV64IMAFDC ISA)
 `riscv64imac-unknown-none-elf` | * | Bare RISC-V (RV64IMAC ISA)
 `sparc64-unknown-linux-gnu` | ✓ | SPARC Linux (kernel 4.4, glibc 2.23)
-[`sparcv9-sun-solaris`](platform-support/solaris.md) | ✓ | SPARC V9 Solaris 11.4
 [`thumbv6m-none-eabi`](platform-support/thumbv6m-none-eabi.md) | * | Bare Armv6-M
 [`thumbv7em-none-eabi`](platform-support/thumbv7em-none-eabi.md) | * | Bare Armv7E-M
 [`thumbv7em-none-eabihf`](platform-support/thumbv7em-none-eabi.md) | * | Bare Armv7E-M, hardfloat
@@ -203,7 +204,6 @@ target | std | notes
 [`x86_64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | Mac Catalyst on x86_64
 [`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
 [`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android
-[`x86_64-pc-solaris`](platform-support/solaris.md) | ✓ | 64-bit x86 Solaris 11.4
 [`x86_64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ✓ | 64-bit x86 MinGW (Windows 10+), LLVM ABI
 [`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia
 `x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
diff --git a/src/doc/rustc/src/platform-support/solaris.md b/src/doc/rustc/src/platform-support/solaris.md
index c22b5c24c12..1b2372eaa0e 100644
--- a/src/doc/rustc/src/platform-support/solaris.md
+++ b/src/doc/rustc/src/platform-support/solaris.md
@@ -12,7 +12,9 @@ Rust for Solaris operating system.
 
 ## Requirements
 
-Binary built for this target is expected to run on sparcv9 or x86_64, and Solaris 11.4.
+The `sparcv9-sun-solaris` and `x86_64-pc-solaris` targets are Tier 2 with host tools.
+
+Binary built for these targets are expected to run on sparcv9 or x86_64, and Solaris 11.4.
 
 ## Testing
 
diff --git a/src/tools/miri/src/alloc/isolated_alloc.rs b/src/tools/miri/src/alloc/isolated_alloc.rs
index 7b74d171373..3a7879f372a 100644
--- a/src/tools/miri/src/alloc/isolated_alloc.rs
+++ b/src/tools/miri/src/alloc/isolated_alloc.rs
@@ -145,10 +145,7 @@ impl IsolatedAlloc {
             if pinfo.domain_size() < offset_pinfo + size_pinfo {
                 break;
             }
-            // FIXME: is there a more efficient way to check whether the entire range is unset
-            // in the bitset?
-            let range_avail = !(offset_pinfo..offset_pinfo + size_pinfo).any(|i| pinfo.contains(i));
-            if range_avail {
+            if !pinfo.contains_any(offset_pinfo..offset_pinfo + size_pinfo) {
                 pinfo.insert_range(offset_pinfo..offset_pinfo + size_pinfo);
                 // SAFETY: We checked the available bytes after `idx` in the call
                 // to `domain_size` above and asserted there are at least `idx +
diff --git a/tests/ui/asm/naked-functions-ffi.rs b/tests/ui/asm/naked-functions-ffi.rs
index 565c440022d..4ba5ccc57f6 100644
--- a/tests/ui/asm/naked-functions-ffi.rs
+++ b/tests/ui/asm/naked-functions-ffi.rs
@@ -7,6 +7,5 @@ use std::arch::naked_asm;
 #[unsafe(naked)]
 pub extern "C" fn naked(p: char) -> u128 {
     //~^ WARN uses type `char`
-    //~| WARN uses type `u128`
     naked_asm!("")
 }
diff --git a/tests/ui/asm/naked-functions-ffi.stderr b/tests/ui/asm/naked-functions-ffi.stderr
index 9df6185498e..f7893a3b8de 100644
--- a/tests/ui/asm/naked-functions-ffi.stderr
+++ b/tests/ui/asm/naked-functions-ffi.stderr
@@ -8,13 +8,5 @@ LL | pub extern "C" fn naked(p: char) -> u128 {
    = note: the `char` type has no C equivalent
    = note: `#[warn(improper_ctypes_definitions)]` on by default
 
-warning: `extern` fn uses type `u128`, which is not FFI-safe
-  --> $DIR/naked-functions-ffi.rs:8:37
-   |
-LL | pub extern "C" fn naked(p: char) -> u128 {
-   |                                     ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-warning: 2 warnings emitted
+warning: 1 warning emitted
 
diff --git a/tests/ui/autoref-autoderef/autoderef-privacy.rs b/tests/ui/autoref-autoderef/autoderef-privacy.rs
index d2a217257e5..5fa28750f73 100644
--- a/tests/ui/autoref-autoderef/autoderef-privacy.rs
+++ b/tests/ui/autoref-autoderef/autoderef-privacy.rs
@@ -14,28 +14,28 @@ impl Bar2 {
 
 mod foo {
     #[derive(Default)]
-    pub struct Bar { i: ::Bar2 }
+    pub struct Bar { i: crate::Bar2 }
     #[derive(Default)]
-    pub struct Baz(::Baz2);
+    pub struct Baz(crate::Baz2);
 
     impl Bar {
         fn f(&self) -> bool { false }
     }
 
     impl ::std::ops::Deref for Bar {
-        type Target = ::Bar2;
-        fn deref(&self) -> &::Bar2 { &self.i }
+        type Target = crate::Bar2;
+        fn deref(&self) -> &crate::Bar2 { &self.i }
     }
 
     impl ::std::ops::Deref for Baz {
-        type Target = ::Baz2;
-        fn deref(&self) -> &::Baz2 { &self.0 }
+        type Target = crate::Baz2;
+        fn deref(&self) -> &crate::Baz2 { &self.0 }
     }
 
     pub fn f(bar: &Bar, baz: &Baz) {
         // Since the private fields and methods are visible here, there should be no autoderefs.
-        let _: &::Bar2 = &bar.i;
-        let _: &::Baz2 = &baz.0;
+        let _: &crate::Bar2 = &bar.i;
+        let _: &crate::Baz2 = &baz.0;
         assert!(!bar.f());
     }
 }
diff --git a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs b/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs
index d08504005a5..06413e13526 100644
--- a/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs
+++ b/tests/ui/auxiliary/crate-method-reexport-grrrrrrr2.rs
@@ -16,7 +16,7 @@ pub mod name_pool {
 }
 
 pub mod rust {
-    pub use name_pool::add;
+    pub use crate::name_pool::add;
 
     pub type rt = Box<()>;
 
diff --git a/tests/ui/auxiliary/pub-and-stability.rs b/tests/ui/auxiliary/pub-and-stability.rs
index d2d07f99398..8866233b61e 100644
--- a/tests/ui/auxiliary/pub-and-stability.rs
+++ b/tests/ui/auxiliary/pub-and-stability.rs
@@ -44,7 +44,7 @@ mod m {
         #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY
         pub(crate) b_crate: i32,
         #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY
-        pub(in m) c_mod: i32,
+        pub(in crate::m) c_mod: i32,
         #[stable(feature = "unit_test", since = "1.0.0")] // SILLY
         d_priv: i32
     }
@@ -60,7 +60,7 @@ mod m {
         pub i32,
 
         pub(crate) i32,
-        pub(in m) i32,
+        pub(in crate::m) i32,
         i32);
 
     impl Record {
@@ -113,7 +113,7 @@ mod m {
         #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY
         pub(crate) fn pub_crate(&self) -> i32 { self.d_priv }
         #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY
-        pub(in m) fn pub_mod(&self) -> i32 { self.d_priv }
+        pub(in crate::m) fn pub_mod(&self) -> i32 { self.d_priv }
         #[stable(feature = "unit_test", since = "1.0.0")] // SILLY
         fn private(&self) -> i32 { self.d_priv }
     }
@@ -127,7 +127,7 @@ mod m {
         pub fn stable(&self) -> i32 { self.0 }
 
         pub(crate) fn pub_crate(&self) -> i32 { self.0 }
-        pub(in m) fn pub_mod(&self) -> i32 { self.0 }
+        pub(in crate::m) fn pub_mod(&self) -> i32 { self.0 }
         fn private(&self) -> i32 { self.0 }
     }
 }
diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr
index eb66633f9dd..ec81ba2e3d8 100644
--- a/tests/ui/check-cfg/target_feature.stderr
+++ b/tests/ui/check-cfg/target_feature.stderr
@@ -62,6 +62,7 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `c`
 `cache`
 `cmpxchg16b`
+`concurrent-functions`
 `crc`
 `crt-static`
 `cssc`
@@ -159,6 +160,15 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `lzcnt`
 `m`
 `mclass`
+`message-security-assist-extension12`
+`message-security-assist-extension3`
+`message-security-assist-extension4`
+`message-security-assist-extension5`
+`message-security-assist-extension8`
+`message-security-assist-extension9`
+`miscellaneous-extensions-2`
+`miscellaneous-extensions-3`
+`miscellaneous-extensions-4`
 `mops`
 `movbe`
 `movrs`
@@ -287,9 +297,11 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `vector`
 `vector-enhancements-1`
 `vector-enhancements-2`
+`vector-enhancements-3`
 `vector-packed-decimal`
 `vector-packed-decimal-enhancement`
 `vector-packed-decimal-enhancement-2`
+`vector-packed-decimal-enhancement-3`
 `vfp2`
 `vfp3`
 `vfp4`
diff --git a/tests/ui/coherence/coherence_inherent.rs b/tests/ui/coherence/coherence_inherent.rs
index f3ebf000386..b2007e3437d 100644
--- a/tests/ui/coherence/coherence_inherent.rs
+++ b/tests/ui/coherence/coherence_inherent.rs
@@ -15,8 +15,8 @@ mod Lib {
 
 mod Import {
     // Trait is in scope here:
-    use Lib::TheStruct;
-    use Lib::TheTrait;
+    use crate::Lib::TheStruct;
+    use crate::Lib::TheTrait;
 
     fn call_the_fn(s: &TheStruct) {
         s.the_fn();
@@ -25,7 +25,7 @@ mod Import {
 
 mod NoImport {
     // Trait is not in scope here:
-    use Lib::TheStruct;
+    use crate::Lib::TheStruct;
 
     fn call_the_fn(s: &TheStruct) {
         s.the_fn();
diff --git a/tests/ui/consts/const-blocks/migrate-fail.rs b/tests/ui/consts/const-blocks/migrate-fail.rs
index fddbfbb9d32..e7dbb68d920 100644
--- a/tests/ui/consts/const-blocks/migrate-fail.rs
+++ b/tests/ui/consts/const-blocks/migrate-fail.rs
@@ -4,7 +4,7 @@
 struct Bar;
 
 mod non_constants {
-    use Bar;
+    use crate::Bar;
 
     fn no_impl_copy_empty_value_multiple_elements() {
         let x = None;
diff --git a/tests/ui/consts/const-blocks/migrate-pass.rs b/tests/ui/consts/const-blocks/migrate-pass.rs
index 308834bd646..629d4db0dc6 100644
--- a/tests/ui/consts/const-blocks/migrate-pass.rs
+++ b/tests/ui/consts/const-blocks/migrate-pass.rs
@@ -5,7 +5,7 @@
 struct Bar;
 
 mod constants {
-    use Bar;
+    use crate::Bar;
 
     fn no_impl_copy_empty_value_no_elements() {
         const FOO: Option<Bar> = None;
@@ -69,7 +69,7 @@ mod constants {
 }
 
 mod non_constants {
-    use Bar;
+    use crate::Bar;
 
     fn no_impl_copy_empty_value_no_elements() {
         let x = None;
diff --git a/tests/ui/consts/const-blocks/nll-fail.rs b/tests/ui/consts/const-blocks/nll-fail.rs
index fddbfbb9d32..e7dbb68d920 100644
--- a/tests/ui/consts/const-blocks/nll-fail.rs
+++ b/tests/ui/consts/const-blocks/nll-fail.rs
@@ -4,7 +4,7 @@
 struct Bar;
 
 mod non_constants {
-    use Bar;
+    use crate::Bar;
 
     fn no_impl_copy_empty_value_multiple_elements() {
         let x = None;
diff --git a/tests/ui/consts/const-blocks/nll-pass.rs b/tests/ui/consts/const-blocks/nll-pass.rs
index 308834bd646..629d4db0dc6 100644
--- a/tests/ui/consts/const-blocks/nll-pass.rs
+++ b/tests/ui/consts/const-blocks/nll-pass.rs
@@ -5,7 +5,7 @@
 struct Bar;
 
 mod constants {
-    use Bar;
+    use crate::Bar;
 
     fn no_impl_copy_empty_value_no_elements() {
         const FOO: Option<Bar> = None;
@@ -69,7 +69,7 @@ mod constants {
 }
 
 mod non_constants {
-    use Bar;
+    use crate::Bar;
 
     fn no_impl_copy_empty_value_no_elements() {
         let x = None;
diff --git a/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs b/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs
index 39f912066ec..fe9aef42feb 100644
--- a/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs
+++ b/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs
@@ -31,11 +31,11 @@ mod foo {
 }
 
 pub mod bar {
-    pub use foo::reexported_a as e;
-    pub use foo::reexported_b as f;
-    pub use foo::reexported_c as g;
-    pub use foo::reexported_d as h;
-    pub use foo::reexported_e as i;
+    pub use crate::foo::reexported_a as e;
+    pub use crate::foo::reexported_b as f;
+    pub use crate::foo::reexported_c as g;
+    pub use crate::foo::reexported_d as h;
+    pub use crate::foo::reexported_e as i;
 }
 
 pub static a: isize = 0;
diff --git a/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs b/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs
index 9525ff2e5ef..9a7a10529fa 100644
--- a/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs
+++ b/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs
@@ -15,7 +15,7 @@ pub trait Foo: Sized {
 }
 
 mod x {
-    use Foo;
+    use crate::Foo;
 
     #[rustc_if_this_changed]
     impl Foo for char { type T = char; }
@@ -24,7 +24,7 @@ mod x {
 }
 
 mod y {
-    use Foo;
+    use crate::Foo;
 
     #[rustc_then_this_would_need(typeck)] //~ ERROR OK
     pub fn use_char_assoc() {
diff --git a/tests/ui/dep-graph/dep-graph-caller-callee.rs b/tests/ui/dep-graph/dep-graph-caller-callee.rs
index e56cd5202e5..b1318a169d9 100644
--- a/tests/ui/dep-graph/dep-graph-caller-callee.rs
+++ b/tests/ui/dep-graph/dep-graph-caller-callee.rs
@@ -15,7 +15,7 @@ mod x {
 }
 
 mod y {
-    use x;
+    use crate::x;
 
     // These dependencies SHOULD exist:
     #[rustc_then_this_would_need(typeck)] //~ ERROR OK
@@ -25,7 +25,7 @@ mod y {
 }
 
 mod z {
-    use y;
+    use crate::y;
 
     // These are expected to yield errors, because changes to `x`
     // affect the BODY of `y`, but not its signature.
diff --git a/tests/ui/dep-graph/dep-graph-struct-signature.rs b/tests/ui/dep-graph/dep-graph-struct-signature.rs
index 5303c6d2e53..eea81b26f9f 100644
--- a/tests/ui/dep-graph/dep-graph-struct-signature.rs
+++ b/tests/ui/dep-graph/dep-graph-struct-signature.rs
@@ -23,7 +23,7 @@ struct WontChange {
 
 // these are valid dependencies
 mod signatures {
-    use WillChange;
+    use crate::WillChange;
 
     #[rustc_then_this_would_need(type_of)] //~ ERROR no path
     #[rustc_then_this_would_need(associated_item)] //~ ERROR no path
@@ -70,7 +70,7 @@ mod signatures {
 }
 
 mod invalid_signatures {
-    use WontChange;
+    use crate::WontChange;
 
     #[rustc_then_this_would_need(type_of)] //~ ERROR no path
     trait A {
diff --git a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs
index b3e8e9a512e..eab4c792105 100644
--- a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs
+++ b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs
@@ -19,7 +19,7 @@ pub trait Bar: Sized {
 }
 
 mod x {
-    use {Foo, Bar};
+    use crate::{Foo, Bar};
 
     #[rustc_if_this_changed]
     impl Foo for u32 { }
@@ -28,7 +28,7 @@ mod x {
 }
 
 mod y {
-    use {Foo, Bar};
+    use crate::{Foo, Bar};
 
     #[rustc_then_this_would_need(typeck)] //~ ERROR OK
     pub fn with_char() {
@@ -37,7 +37,7 @@ mod y {
 }
 
 mod z {
-    use y;
+    use crate::y;
 
     #[rustc_then_this_would_need(typeck)] //~ ERROR no path
     pub fn z() {
diff --git a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs
index 7c612158bf0..859505a4a7a 100644
--- a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs
+++ b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs
@@ -18,7 +18,7 @@ pub trait Bar: Sized {
 }
 
 mod x {
-    use {Foo, Bar};
+    use crate::{Foo, Bar};
 
     #[rustc_if_this_changed]
     impl Foo for char { }
@@ -27,7 +27,7 @@ mod x {
 }
 
 mod y {
-    use {Foo, Bar};
+    use crate::{Foo, Bar};
 
     #[rustc_then_this_would_need(typeck)] //~ ERROR no path
     pub fn call_bar() {
@@ -36,7 +36,7 @@ mod y {
 }
 
 mod z {
-    use y;
+    use crate::y;
 
     #[rustc_then_this_would_need(typeck)] //~ ERROR no path
     pub fn z() {
diff --git a/tests/ui/dep-graph/dep-graph-trait-impl.rs b/tests/ui/dep-graph/dep-graph-trait-impl.rs
index 38cc88e567d..5cf0d34e007 100644
--- a/tests/ui/dep-graph/dep-graph-trait-impl.rs
+++ b/tests/ui/dep-graph/dep-graph-trait-impl.rs
@@ -14,7 +14,7 @@ pub trait Foo: Sized {
 }
 
 mod x {
-    use Foo;
+    use crate::Foo;
 
     #[rustc_if_this_changed]
     impl Foo for char { }
@@ -23,7 +23,7 @@ mod x {
 }
 
 mod y {
-    use Foo;
+    use crate::Foo;
 
     #[rustc_then_this_would_need(typeck)] //~ ERROR OK
     pub fn with_char() {
@@ -49,7 +49,7 @@ mod y {
 }
 
 mod z {
-    use y;
+    use crate::y;
 
     // These are expected to yield errors, because changes to `x`
     // affect the BODY of `y`, but not its signature.
diff --git a/tests/ui/derived-errors/issue-31997.rs b/tests/ui/derived-errors/issue-31997.rs
index ff619313afb..59f19e4fde2 100644
--- a/tests/ui/derived-errors/issue-31997.rs
+++ b/tests/ui/derived-errors/issue-31997.rs
@@ -11,7 +11,7 @@ fn closure<F, T>(x: F) -> Result<T, ()>
 }
 
 fn foo() -> Result<(), ()> {
-    try!(closure(|| bar(core::ptr::null_mut()))); //~ ERROR cannot find function `bar` in this scope
+    closure(|| bar(core::ptr::null_mut()))?; //~ ERROR cannot find function `bar` in this scope
     Ok(())
 }
 
diff --git a/tests/ui/derived-errors/issue-31997.stderr b/tests/ui/derived-errors/issue-31997.stderr
index 7d6415fef83..f5afb94fbd6 100644
--- a/tests/ui/derived-errors/issue-31997.stderr
+++ b/tests/ui/derived-errors/issue-31997.stderr
@@ -1,8 +1,8 @@
 error[E0425]: cannot find function `bar` in this scope
-  --> $DIR/issue-31997.rs:14:21
+  --> $DIR/issue-31997.rs:14:16
    |
-LL |     try!(closure(|| bar(core::ptr::null_mut())));
-   |                     ^^^ not found in this scope
+LL |     closure(|| bar(core::ptr::null_mut()))?;
+   |                ^^^ not found in this scope
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/drop/issue-23338-ensure-param-drop-order.rs b/tests/ui/drop/issue-23338-ensure-param-drop-order.rs
index 6fee4520cbc..54a9d3324b9 100644
--- a/tests/ui/drop/issue-23338-ensure-param-drop-order.rs
+++ b/tests/ui/drop/issue-23338-ensure-param-drop-order.rs
@@ -163,7 +163,7 @@ pub mod d {
             };
             self.log.borrow_mut().push(self.uid);
             indent_println(self.trail, &format!("+-- Drop {}", self));
-            indent_println(::PREF_INDENT, "");
+            indent_println(super::PREF_INDENT, "");
         }
     }
 }
diff --git a/tests/ui/drop/issue-23611-enum-swap-in-drop.rs b/tests/ui/drop/issue-23611-enum-swap-in-drop.rs
index 410b07b16fc..208c6e2ada3 100644
--- a/tests/ui/drop/issue-23611-enum-swap-in-drop.rs
+++ b/tests/ui/drop/issue-23611-enum-swap-in-drop.rs
@@ -256,7 +256,7 @@ pub mod d {
             };
             self.log.borrow_mut().push(self.uid);
             indent_println(self.trail, &format!("+-- Drop {}", self));
-            indent_println(::PREF_INDENT, "");
+            indent_println(super::PREF_INDENT, "");
         }
     }
 }
diff --git a/tests/ui/dropck/dropck_trait_cycle_checked.rs b/tests/ui/dropck/dropck_trait_cycle_checked.rs
index be6ec3e4ed1..ffe43480b12 100644
--- a/tests/ui/dropck/dropck_trait_cycle_checked.rs
+++ b/tests/ui/dropck/dropck_trait_cycle_checked.rs
@@ -17,7 +17,7 @@ mod s {
 }
 
 mod id {
-    use s;
+    use crate::s;
     #[derive(Debug)]
     pub struct Id {
         orig_count: usize,
diff --git a/tests/ui/error-codes/E0659.rs b/tests/ui/error-codes/E0659.rs
index c00026bb7a7..d056f1d96dd 100644
--- a/tests/ui/error-codes/E0659.rs
+++ b/tests/ui/error-codes/E0659.rs
@@ -7,8 +7,8 @@ mod earth {
 }
 
 mod collider {
-    pub use moon::*;
-    pub use earth::*;
+    pub use crate::moon::*;
+    pub use crate::earth::*;
 }
 
 fn main() {
diff --git a/tests/ui/error-codes/E0659.stderr b/tests/ui/error-codes/E0659.stderr
index dbb72bb6759..371250b811b 100644
--- a/tests/ui/error-codes/E0659.stderr
+++ b/tests/ui/error-codes/E0659.stderr
@@ -8,14 +8,14 @@ LL |     collider::foo();
 note: `foo` could refer to the function imported here
   --> $DIR/E0659.rs:10:13
    |
-LL |     pub use moon::*;
-   |             ^^^^^^^
+LL |     pub use crate::moon::*;
+   |             ^^^^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 note: `foo` could also refer to the function imported here
   --> $DIR/E0659.rs:11:13
    |
-LL |     pub use earth::*;
-   |             ^^^^^^^^
+LL |     pub use crate::earth::*;
+   |             ^^^^^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/explore-issue-38412.stderr b/tests/ui/explore-issue-38412.stderr
index 884184ec16e..fca5c738d27 100644
--- a/tests/ui/explore-issue-38412.stderr
+++ b/tests/ui/explore-issue-38412.stderr
@@ -103,8 +103,8 @@ LL |     r.pub_mod();
    |
   ::: $DIR/auxiliary/pub-and-stability.rs:116:9
    |
-LL |         pub(in m) fn pub_mod(&self) -> i32 { self.d_priv }
-   |         ---------------------------------- private method defined here
+LL |         pub(in crate::m) fn pub_mod(&self) -> i32 { self.d_priv }
+   |         ----------------------------------------- private method defined here
 
 error[E0624]: method `private` is private
   --> $DIR/explore-issue-38412.rs:50:7
@@ -156,8 +156,8 @@ LL |     t.pub_mod();
    |
   ::: $DIR/auxiliary/pub-and-stability.rs:130:9
    |
-LL |         pub(in m) fn pub_mod(&self) -> i32 { self.0 }
-   |         ---------------------------------- private method defined here
+LL |         pub(in crate::m) fn pub_mod(&self) -> i32 { self.0 }
+   |         ----------------------------------------- private method defined here
 
 error[E0624]: method `private` is private
   --> $DIR/explore-issue-38412.rs:63:7
diff --git a/tests/ui/imports/duplicate.rs b/tests/ui/imports/duplicate.rs
index 0c5a376da38..69ec82aafbd 100644
--- a/tests/ui/imports/duplicate.rs
+++ b/tests/ui/imports/duplicate.rs
@@ -7,27 +7,27 @@ mod b {
 }
 
 mod c {
-    pub use a::foo;
+    pub use crate::a::foo;
 }
 
 mod d {
-    use a::foo;
-    use a::foo; //~ ERROR the name `foo` is defined multiple times
+    use crate::a::foo;
+    use crate::a::foo; //~ ERROR the name `foo` is defined multiple times
 }
 
 mod e {
-    pub use a::*;
-    pub use c::*; // ok
+    pub use crate::a::*;
+    pub use crate::c::*; // ok
 }
 
 mod f {
-    pub use a::*;
-    pub use b::*;
+    pub use crate::a::*;
+    pub use crate::b::*;
 }
 
 mod g {
-    pub use a::*;
-    pub use f::*;
+    pub use crate::a::*;
+    pub use crate::f::*;
 }
 
 fn main() {
diff --git a/tests/ui/imports/duplicate.stderr b/tests/ui/imports/duplicate.stderr
index d7a7dfce921..f7dc7312b9d 100644
--- a/tests/ui/imports/duplicate.stderr
+++ b/tests/ui/imports/duplicate.stderr
@@ -1,10 +1,10 @@
 error[E0252]: the name `foo` is defined multiple times
   --> $DIR/duplicate.rs:15:9
    |
-LL |     use a::foo;
-   |         ------ previous import of the value `foo` here
-LL |     use a::foo;
-   |         ^^^^^^ `foo` reimported here
+LL |     use crate::a::foo;
+   |         ------------- previous import of the value `foo` here
+LL |     use crate::a::foo;
+   |         ^^^^^^^^^^^^^ `foo` reimported here
    |
    = note: `foo` must be defined only once in the value namespace of this module
 
@@ -38,14 +38,14 @@ LL |     f::foo();
 note: `foo` could refer to the function imported here
   --> $DIR/duplicate.rs:24:13
    |
-LL |     pub use a::*;
-   |             ^^^^
+LL |     pub use crate::a::*;
+   |             ^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 note: `foo` could also refer to the function imported here
   --> $DIR/duplicate.rs:25:13
    |
-LL |     pub use b::*;
-   |             ^^^^
+LL |     pub use crate::b::*;
+   |             ^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 
 error[E0659]: `foo` is ambiguous
@@ -80,14 +80,14 @@ LL |     g::foo();
 note: `foo` could refer to the function imported here
   --> $DIR/duplicate.rs:24:13
    |
-LL |     pub use a::*;
-   |             ^^^^
+LL |     pub use crate::a::*;
+   |             ^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
 note: `foo` could also refer to the function imported here
   --> $DIR/duplicate.rs:25:13
    |
-LL |     pub use b::*;
-   |             ^^^^
+LL |     pub use crate::b::*;
+   |             ^^^^^^^^^^^
    = help: consider adding an explicit import of `foo` to disambiguate
    = note: `#[warn(ambiguous_glob_imports)]` on by default
 
diff --git a/tests/ui/imports/export-glob-imports-target.rs b/tests/ui/imports/export-glob-imports-target.rs
index 6fde9fef0b6..84b9ffa83ff 100644
--- a/tests/ui/imports/export-glob-imports-target.rs
+++ b/tests/ui/imports/export-glob-imports-target.rs
@@ -9,7 +9,7 @@
 
 
 mod foo {
-    use foo::bar::*;
+    use crate::foo::bar::*;
     pub mod bar {
         pub static a : isize = 10;
     }
diff --git a/tests/ui/imports/glob-cycles.rs b/tests/ui/imports/glob-cycles.rs
index 066aa3b53ea..d9850bec4ca 100644
--- a/tests/ui/imports/glob-cycles.rs
+++ b/tests/ui/imports/glob-cycles.rs
@@ -1,12 +1,12 @@
 //@ check-pass
 
 mod foo {
-    pub use bar::*;
-    pub use main as f;
+    pub use crate::bar::*;
+    pub use crate::main as f;
 }
 
 mod bar {
-    pub use foo::*;
+    pub use crate::foo::*;
 }
 
 pub use foo::*;
diff --git a/tests/ui/imports/glob-shadowing.rs b/tests/ui/imports/glob-shadowing.rs
index 3a33b592b00..72848aac511 100644
--- a/tests/ui/imports/glob-shadowing.rs
+++ b/tests/ui/imports/glob-shadowing.rs
@@ -6,7 +6,7 @@ mod m {
 }
 
 mod glob_in_normal_module {
-    use m::*;
+    use crate::m::*;
     fn check() {
         let x = env!("PATH"); //~ ERROR `env` is ambiguous
     }
@@ -14,7 +14,7 @@ mod glob_in_normal_module {
 
 mod glob_in_block_module {
     fn block() {
-        use m::*;
+        use crate::m::*;
         fn check() {
             let x = env!("PATH"); //~ ERROR `env` is ambiguous
         }
@@ -24,7 +24,7 @@ mod glob_in_block_module {
 mod glob_shadows_item {
     pub macro fenv($e: expr) { $e }
     fn block() {
-        use m::*;
+        use crate::m::*;
         fn check() {
             let x = fenv!(); //~ ERROR `fenv` is ambiguous
         }
diff --git a/tests/ui/imports/glob-shadowing.stderr b/tests/ui/imports/glob-shadowing.stderr
index aff2eff68ac..0ce8d4f54f8 100644
--- a/tests/ui/imports/glob-shadowing.stderr
+++ b/tests/ui/imports/glob-shadowing.stderr
@@ -9,8 +9,8 @@ LL |         let x = env!("PATH");
 note: `env` could also refer to the macro imported here
   --> $DIR/glob-shadowing.rs:9:9
    |
-LL |     use m::*;
-   |         ^^^^
+LL |     use crate::m::*;
+   |         ^^^^^^^^^^^
    = help: consider adding an explicit import of `env` to disambiguate
    = help: or use `self::env` to refer to this macro unambiguously
 
@@ -25,8 +25,8 @@ LL |             let x = env!("PATH");
 note: `env` could also refer to the macro imported here
   --> $DIR/glob-shadowing.rs:17:13
    |
-LL |         use m::*;
-   |             ^^^^
+LL |         use crate::m::*;
+   |             ^^^^^^^^^^^
    = help: consider adding an explicit import of `env` to disambiguate
 
 error[E0659]: `fenv` is ambiguous
@@ -39,8 +39,8 @@ LL |             let x = fenv!();
 note: `fenv` could refer to the macro imported here
   --> $DIR/glob-shadowing.rs:27:13
    |
-LL |         use m::*;
-   |             ^^^^
+LL |         use crate::m::*;
+   |             ^^^^^^^^^^^
    = help: consider adding an explicit import of `fenv` to disambiguate
 note: `fenv` could also refer to the macro defined here
   --> $DIR/glob-shadowing.rs:25:5
diff --git a/tests/ui/imports/import-glob-1.rs b/tests/ui/imports/import-glob-1.rs
index 510f3814567..8beec4ce469 100644
--- a/tests/ui/imports/import-glob-1.rs
+++ b/tests/ui/imports/import-glob-1.rs
@@ -21,7 +21,7 @@ mod bar {
 }
 
 mod foo {
-    use bar::Baz::{Baz1, Baz2};
+    use crate::bar::Baz::{Baz1, Baz2};
 }
 
 fn main() {}
diff --git a/tests/ui/imports/import-glob-circular.rs b/tests/ui/imports/import-glob-circular.rs
index e47fa870c06..2dcfc7721fa 100644
--- a/tests/ui/imports/import-glob-circular.rs
+++ b/tests/ui/imports/import-glob-circular.rs
@@ -1,17 +1,17 @@
 mod circ1 {
-    pub use circ2::f2;
+    pub use crate::circ2::f2;
     pub fn f1() { println!("f1"); }
     pub fn common() -> usize { return 0; }
 }
 
 mod circ2 {
-    pub use circ1::f1;
+    pub use crate::circ1::f1;
     pub fn f2() { println!("f2"); }
     pub fn common() -> usize { return 1; }
 }
 
 mod test {
-    use circ1::*;
+    use crate::circ1::*;
 
     fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope
 }
diff --git a/tests/ui/imports/import-loop-2.rs b/tests/ui/imports/import-loop-2.rs
index 1bd0f06c671..42f9a07fff3 100644
--- a/tests/ui/imports/import-loop-2.rs
+++ b/tests/ui/imports/import-loop-2.rs
@@ -1,9 +1,9 @@
 mod a {
-    pub use b::x;
+    pub use crate::b::x;
 }
 
 mod b {
-    pub use a::x; //~ ERROR unresolved import `a::x`
+    pub use crate::a::x; //~ ERROR unresolved import `crate::a::x`
 
     fn main() { let y = x; }
 }
diff --git a/tests/ui/imports/import-loop-2.stderr b/tests/ui/imports/import-loop-2.stderr
index 2521b6e7c04..2ef40c4e218 100644
--- a/tests/ui/imports/import-loop-2.stderr
+++ b/tests/ui/imports/import-loop-2.stderr
@@ -1,8 +1,8 @@
-error[E0432]: unresolved import `a::x`
+error[E0432]: unresolved import `crate::a::x`
   --> $DIR/import-loop-2.rs:6:13
    |
-LL |     pub use a::x;
-   |             ^^^^ no `x` in `a`
+LL |     pub use crate::a::x;
+   |             ^^^^^^^^^^^ no `x` in `a`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/import-loop.rs b/tests/ui/imports/import-loop.rs
index fc5bd32adee..92483770711 100644
--- a/tests/ui/imports/import-loop.rs
+++ b/tests/ui/imports/import-loop.rs
@@ -1,7 +1,7 @@
 use y::x;
 
 mod y {
-    pub use y::x; //~ ERROR unresolved import `y::x`
+    pub use crate::y::x; //~ ERROR unresolved import `crate::y::x`
 }
 
 fn main() { }
diff --git a/tests/ui/imports/import-loop.stderr b/tests/ui/imports/import-loop.stderr
index 801fc2552b6..888ca11293c 100644
--- a/tests/ui/imports/import-loop.stderr
+++ b/tests/ui/imports/import-loop.stderr
@@ -1,8 +1,8 @@
-error[E0432]: unresolved import `y::x`
+error[E0432]: unresolved import `crate::y::x`
   --> $DIR/import-loop.rs:4:13
    |
-LL |     pub use y::x;
-   |             ^^^^ no `x` in `y`
+LL |     pub use crate::y::x;
+   |             ^^^^^^^^^^^ no `x` in `y`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/import-rpass.rs b/tests/ui/imports/import-rpass.rs
index 97c64fd9c63..f03f974d573 100644
--- a/tests/ui/imports/import-rpass.rs
+++ b/tests/ui/imports/import-rpass.rs
@@ -4,8 +4,8 @@ mod foo {
 }
 
 mod bar {
-    use foo::x;
-    use foo::x as z;
+    use crate::foo::x;
+    use crate::foo::x as z;
     pub fn thing() { x(10); z(10); }
 }
 
diff --git a/tests/ui/imports/import4.rs b/tests/ui/imports/import4.rs
index 01535fc6f45..f670cc06201 100644
--- a/tests/ui/imports/import4.rs
+++ b/tests/ui/imports/import4.rs
@@ -1,4 +1,4 @@
-mod a { pub use b::foo; }
-mod b { pub use a::foo; } //~ ERROR unresolved import `a::foo`
+mod a { pub use crate::b::foo; }
+mod b { pub use crate::a::foo; } //~ ERROR unresolved import `crate::a::foo`
 
 fn main() { println!("loop"); }
diff --git a/tests/ui/imports/import4.stderr b/tests/ui/imports/import4.stderr
index c979d6c9ae2..4faa5f0520a 100644
--- a/tests/ui/imports/import4.stderr
+++ b/tests/ui/imports/import4.stderr
@@ -1,8 +1,8 @@
-error[E0432]: unresolved import `a::foo`
+error[E0432]: unresolved import `crate::a::foo`
   --> $DIR/import4.rs:2:17
    |
-LL | mod b { pub use a::foo; }
-   |                 ^^^^^^ no `foo` in `a`
+LL | mod b { pub use crate::a::foo; }
+   |                 ^^^^^^^^^^^^^ no `foo` in `a`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/import5.rs b/tests/ui/imports/import5.rs
index 96d6c62d48a..7c7d99d7175 100644
--- a/tests/ui/imports/import5.rs
+++ b/tests/ui/imports/import5.rs
@@ -1,7 +1,7 @@
 //@ run-pass
 use foo::bar;
 mod foo {
-    pub use foo::zed::bar;
+    pub use crate::foo::zed::bar;
     pub mod zed {
         pub fn bar() { println!("foo"); }
     }
diff --git a/tests/ui/imports/import6.rs b/tests/ui/imports/import6.rs
index 8632c21e5f7..1677003c0ec 100644
--- a/tests/ui/imports/import6.rs
+++ b/tests/ui/imports/import6.rs
@@ -10,6 +10,6 @@ mod foo {
     }
 }
 mod bar {
-    pub use foo::zed::baz;
+    pub use crate::foo::zed::baz;
 }
 pub fn main() { baz(); }
diff --git a/tests/ui/imports/imports.rs b/tests/ui/imports/imports.rs
index a770103c212..b5c25eb0447 100644
--- a/tests/ui/imports/imports.rs
+++ b/tests/ui/imports/imports.rs
@@ -3,7 +3,7 @@
 
 // Like other items, private imports can be imported and used non-lexically in paths.
 mod a {
-    use a as foo;
+    use crate::a as foo;
     use self::foo::foo as bar;
 
     mod b {
@@ -18,22 +18,22 @@ pub fn f() -> bool { true }
 
 // Items and explicit imports shadow globs.
 fn g() {
-    use foo::*;
-    use bar::*;
+    use crate::foo::*;
+    use crate::bar::*;
     fn f() -> bool { true }
     let _: bool = f();
 }
 
 fn h() {
-    use foo::*;
-    use bar::*;
-    use f;
+    use crate::foo::*;
+    use crate::bar::*;
+    use crate::f;
     let _: bool = f();
 }
 
 // Here, there appears to be shadowing but isn't because of namespaces.
 mod b {
-    use foo::*; // This imports `f` in the value namespace.
+    use crate::foo::*; // This imports `f` in the value namespace.
     use super::b as f; // This imports `f` only in the type namespace,
     fn test() { self::f(); } // so the glob isn't shadowed.
 }
@@ -55,12 +55,13 @@ mod c {
 
 // Unused names can be ambiguous.
 mod d {
-    pub use foo::*; // This imports `f` in the value namespace.
-    pub use bar::*; // This also imports `f` in the value namespace.
+    pub use crate::foo::*; // This imports `f` in the value namespace.
+    pub use crate::bar::*; // This also imports `f` in the value namespace.
 }
 
 mod e {
-    pub use d::*; // n.b. Since `e::f` is not used, this is not considered to be a use of `d::f`.
+    pub use crate::d::*; // n.b. Since `e::f` is not used,
+                         // this is not considered to be a use of `d::f`.
 }
 
 fn main() {}
diff --git a/tests/ui/imports/issue-18083.rs b/tests/ui/imports/issue-18083.rs
index 97c0bc83ad5..c111c9b5aa8 100644
--- a/tests/ui/imports/issue-18083.rs
+++ b/tests/ui/imports/issue-18083.rs
@@ -5,7 +5,7 @@
 // each other and be reported as unresolved.
 
 mod a {
-    use b::{B};
+    use crate::b::{B};
     pub use self::inner::A;
 
     mod inner {
@@ -14,7 +14,7 @@ mod a {
 }
 
 mod b {
-    use a::{A};
+    use crate::a::{A};
     pub use self::inner::B;
 
     mod inner {
diff --git a/tests/ui/imports/issue-19498.rs b/tests/ui/imports/issue-19498.rs
index 5b9ce85fd8b..ae4e5fd35e5 100644
--- a/tests/ui/imports/issue-19498.rs
+++ b/tests/ui/imports/issue-19498.rs
@@ -7,7 +7,7 @@ mod A {} //~ ERROR the name `A` is defined multiple times
 pub mod B {} //~ ERROR the name `B` is defined multiple times
 //~| NOTE `B` redefined here
 mod C {
-    use C::D;
+    use crate::C::D;
     mod D {} //~ ERROR the name `D` is defined multiple times
     //~| NOTE `D` redefined here
 }
diff --git a/tests/ui/imports/issue-19498.stderr b/tests/ui/imports/issue-19498.stderr
index eb0d68a24c9..a4ddff3ed99 100644
--- a/tests/ui/imports/issue-19498.stderr
+++ b/tests/ui/imports/issue-19498.stderr
@@ -31,16 +31,16 @@ LL | use self::B as OtherB;
 error[E0255]: the name `D` is defined multiple times
   --> $DIR/issue-19498.rs:11:5
    |
-LL |     use C::D;
-   |         ---- previous import of the module `D` here
+LL |     use crate::C::D;
+   |         ----------- previous import of the module `D` here
 LL |     mod D {}
    |     ^^^^^ `D` redefined here
    |
    = note: `D` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL |     use C::D as OtherD;
-   |              +++++++++
+LL |     use crate::C::D as OtherD;
+   |                     +++++++++
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/imports/issue-32222.rs b/tests/ui/imports/issue-32222.rs
index 8c528bc0a1e..6f5530a065c 100644
--- a/tests/ui/imports/issue-32222.rs
+++ b/tests/ui/imports/issue-32222.rs
@@ -16,7 +16,7 @@ mod a {
 }
 
 mod b {
-    pub use a::bar;
+    pub use crate::a::bar;
 }
 
 fn main() {}
diff --git a/tests/ui/imports/issue-4366-2.rs b/tests/ui/imports/issue-4366-2.rs
index c777b750252..e92d964f889 100644
--- a/tests/ui/imports/issue-4366-2.rs
+++ b/tests/ui/imports/issue-4366-2.rs
@@ -7,11 +7,11 @@ mod foo {
 }
 mod a {
     pub mod b {
-        use foo::foo;
+        use crate::foo::foo;
         type Bar = isize;
     }
     pub mod sub {
-        use a::b::*;
+        use crate::a::b::*;
         fn sub() -> Bar { 1 }
         //~^ ERROR cannot find type `Bar` in this scope
     }
diff --git a/tests/ui/imports/issue-4366.rs b/tests/ui/imports/issue-4366.rs
index 9ec2e58ecad..e2d89fdaff3 100644
--- a/tests/ui/imports/issue-4366.rs
+++ b/tests/ui/imports/issue-4366.rs
@@ -10,11 +10,11 @@ mod foo {
 }
 mod a {
     pub mod b {
-        use foo::foo;
+        use crate::foo::foo;
         type Bar = isize;
     }
     pub mod sub {
-        use a::b::*;
+        use crate::a::b::*;
         fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope
     }
 }
diff --git a/tests/ui/imports/issue-4865-1.rs b/tests/ui/imports/issue-4865-1.rs
index 1a72b1b5e3f..7c34d105550 100644
--- a/tests/ui/imports/issue-4865-1.rs
+++ b/tests/ui/imports/issue-4865-1.rs
@@ -6,16 +6,16 @@
 // because these previous imports were not resolved.
 
 pub mod a {
-    use b::fn_b;
-    use c::*;
+    use crate::b::fn_b;
+    use crate::c::*;
 
     pub fn fn_a(){
     }
 }
 
 pub mod b {
-    use a::fn_a;
-    use c::*;
+    use crate::a::fn_a;
+    use crate::c::*;
 
     pub fn fn_b(){
     }
diff --git a/tests/ui/imports/issue-4865-2.rs b/tests/ui/imports/issue-4865-2.rs
index 746a74658dd..60ce2a468d9 100644
--- a/tests/ui/imports/issue-4865-2.rs
+++ b/tests/ui/imports/issue-4865-2.rs
@@ -12,7 +12,7 @@ pub mod say {
 }
 
 pub mod hello {
-    use say;
+    use crate::say;
 
     pub fn hello() {
         say::hello();
diff --git a/tests/ui/imports/issue-4865-3.rs b/tests/ui/imports/issue-4865-3.rs
index 130223558cb..d9d17f4dd47 100644
--- a/tests/ui/imports/issue-4865-3.rs
+++ b/tests/ui/imports/issue-4865-3.rs
@@ -4,11 +4,11 @@
 // they are not `pub`.
 
 pub mod a {
-    use b::*;
+    use crate::b::*;
 }
 
 pub mod b {
-    use a::*;
+    use crate::a::*;
 }
 
 use a::*;
diff --git a/tests/ui/imports/issue-8208.rs b/tests/ui/imports/issue-8208.rs
index 997d4d227b3..f6d88f830f2 100644
--- a/tests/ui/imports/issue-8208.rs
+++ b/tests/ui/imports/issue-8208.rs
@@ -2,7 +2,7 @@ use self::*; //~ ERROR: unresolved import `self::*` [E0432]
              //~^ NOTE cannot glob-import a module into itself
 
 mod foo {
-    use foo::*; //~ ERROR: unresolved import `foo::*` [E0432]
+    use crate::foo::*; //~ ERROR: unresolved import `crate::foo::*` [E0432]
                 //~^ NOTE cannot glob-import a module into itself
 
     mod bar {
diff --git a/tests/ui/imports/issue-8208.stderr b/tests/ui/imports/issue-8208.stderr
index e59aea12cda..0fbe4d35fab 100644
--- a/tests/ui/imports/issue-8208.stderr
+++ b/tests/ui/imports/issue-8208.stderr
@@ -4,11 +4,11 @@ error[E0432]: unresolved import `self::*`
 LL | use self::*;
    |     ^^^^^^^ cannot glob-import a module into itself
 
-error[E0432]: unresolved import `foo::*`
+error[E0432]: unresolved import `crate::foo::*`
   --> $DIR/issue-8208.rs:5:9
    |
-LL |     use foo::*;
-   |         ^^^^^^ cannot glob-import a module into itself
+LL |     use crate::foo::*;
+   |         ^^^^^^^^^^^^^ cannot glob-import a module into itself
 
 error[E0432]: unresolved import `super::bar::*`
   --> $DIR/issue-8208.rs:9:13
diff --git a/tests/ui/imports/issue-8640.rs b/tests/ui/imports/issue-8640.rs
index 51a02a32ec8..7cf73d0e93e 100644
--- a/tests/ui/imports/issue-8640.rs
+++ b/tests/ui/imports/issue-8640.rs
@@ -1,7 +1,7 @@
 #[allow(unused_imports)]
 
 mod foo {
-    use baz::bar;
+    use crate::baz::bar;
     mod bar {}
     //~^ ERROR the name `bar` is defined multiple times
 }
diff --git a/tests/ui/imports/issue-8640.stderr b/tests/ui/imports/issue-8640.stderr
index d22fddb1a69..3ce57e3a44a 100644
--- a/tests/ui/imports/issue-8640.stderr
+++ b/tests/ui/imports/issue-8640.stderr
@@ -1,16 +1,16 @@
 error[E0255]: the name `bar` is defined multiple times
   --> $DIR/issue-8640.rs:5:5
    |
-LL |     use baz::bar;
-   |         -------- previous import of the module `bar` here
+LL |     use crate::baz::bar;
+   |         --------------- previous import of the module `bar` here
 LL |     mod bar {}
    |     ^^^^^^^ `bar` redefined here
    |
    = note: `bar` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL |     use baz::bar as other_bar;
-   |                  ++++++++++++
+LL |     use crate::baz::bar as other_bar;
+   |                         ++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/local-modularized-tricky-fail-2.rs b/tests/ui/imports/local-modularized-tricky-fail-2.rs
index 386de88bc3d..80b242b456c 100644
--- a/tests/ui/imports/local-modularized-tricky-fail-2.rs
+++ b/tests/ui/imports/local-modularized-tricky-fail-2.rs
@@ -10,13 +10,13 @@ macro_rules! define_exported { () => {
 define_exported!();
 
 mod m {
-    use exported;
+    use crate::exported;
     //~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
     //~| WARN this was previously accepted
 }
 
 fn main() {
-    ::exported!();
+    crate::exported!();
     //~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
     //~| WARN this was previously accepted
 }
diff --git a/tests/ui/imports/local-modularized-tricky-fail-2.stderr b/tests/ui/imports/local-modularized-tricky-fail-2.stderr
index 2c1965ac0a4..49f5c72947f 100644
--- a/tests/ui/imports/local-modularized-tricky-fail-2.stderr
+++ b/tests/ui/imports/local-modularized-tricky-fail-2.stderr
@@ -1,8 +1,8 @@
 error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
   --> $DIR/local-modularized-tricky-fail-2.rs:13:9
    |
-LL |     use exported;
-   |         ^^^^^^^^
+LL |     use crate::exported;
+   |         ^^^^^^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>
@@ -22,8 +22,8 @@ LL |   define_exported!();
 error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
   --> $DIR/local-modularized-tricky-fail-2.rs:19:5
    |
-LL |     ::exported!();
-   |     ^^^^^^^^^^
+LL |     crate::exported!();
+   |     ^^^^^^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>
diff --git a/tests/ui/imports/macros.rs b/tests/ui/imports/macros.rs
index 7f479571e5e..cf67e08c87a 100644
--- a/tests/ui/imports/macros.rs
+++ b/tests/ui/imports/macros.rs
@@ -8,13 +8,13 @@ mod foo {
 
 mod m1 {
     m!(use two_macros::*;);
-    use foo::m; // This shadows the glob import
+    use crate::foo::m; // This shadows the glob import
 }
 
 mod m2 {
     use two_macros::*;
     m! { //~ ERROR ambiguous
-        use foo::m;
+        use crate::foo::m;
     }
 }
 
diff --git a/tests/ui/imports/macros.stderr b/tests/ui/imports/macros.stderr
index e34e5359b48..25a678c6b37 100644
--- a/tests/ui/imports/macros.stderr
+++ b/tests/ui/imports/macros.stderr
@@ -8,8 +8,8 @@ LL |     m! {
 note: `m` could refer to the macro imported here
   --> $DIR/macros.rs:17:13
    |
-LL |         use foo::m;
-   |             ^^^^^^
+LL |         use crate::foo::m;
+   |             ^^^^^^^^^^^^^
 note: `m` could also refer to the macro imported here
   --> $DIR/macros.rs:15:9
    |
diff --git a/tests/ui/imports/reexport-star.rs b/tests/ui/imports/reexport-star.rs
index 461dc23b4dc..9bf4a6ce0c4 100644
--- a/tests/ui/imports/reexport-star.rs
+++ b/tests/ui/imports/reexport-star.rs
@@ -6,7 +6,7 @@ mod a {
 }
 
 mod b {
-    pub use a::*;
+    pub use crate::a::*;
 }
 
 pub fn main() {
diff --git a/tests/ui/imports/reexports.rs b/tests/ui/imports/reexports.rs
index 2a1a62834ce..6ad704b53fc 100644
--- a/tests/ui/imports/reexports.rs
+++ b/tests/ui/imports/reexports.rs
@@ -33,8 +33,8 @@ mod b {
 
 mod c {
     // Test that `foo` is not re-exported.
-    use b::a::foo::S; //~ ERROR `foo`
-    use b::b::foo::S as T; //~ ERROR `foo`
+    use crate::b::a::foo::S; //~ ERROR `foo`
+    use crate::b::b::foo::S as T; //~ ERROR `foo`
 }
 
 fn main() {}
diff --git a/tests/ui/imports/reexports.stderr b/tests/ui/imports/reexports.stderr
index fa05c0c0f8e..0ebcf8e58d6 100644
--- a/tests/ui/imports/reexports.stderr
+++ b/tests/ui/imports/reexports.stderr
@@ -11,10 +11,10 @@ LL |         pub use super::foo;
    |                 ^^^^^^^^^^
 
 error[E0603]: module import `foo` is private
-  --> $DIR/reexports.rs:36:15
+  --> $DIR/reexports.rs:36:22
    |
-LL |     use b::a::foo::S;
-   |               ^^^ private module import
+LL |     use crate::b::a::foo::S;
+   |                      ^^^ private module import
    |
 note: the module import `foo` is defined here...
   --> $DIR/reexports.rs:24:17
@@ -28,10 +28,10 @@ LL |     mod foo {
    |     ^^^^^^^
 
 error[E0603]: module import `foo` is private
-  --> $DIR/reexports.rs:37:15
+  --> $DIR/reexports.rs:37:22
    |
-LL |     use b::b::foo::S as T;
-   |               ^^^ private module import
+LL |     use crate::b::b::foo::S as T;
+   |                      ^^^ private module import
    |
 note: the module import `foo` is defined here...
   --> $DIR/reexports.rs:29:17
diff --git a/tests/ui/imports/shadow_builtin_macros.rs b/tests/ui/imports/shadow_builtin_macros.rs
index 5a149067408..7d318dfdb43 100644
--- a/tests/ui/imports/shadow_builtin_macros.rs
+++ b/tests/ui/imports/shadow_builtin_macros.rs
@@ -6,17 +6,17 @@ mod foo {
 }
 
 mod m1 {
-    use foo::panic; // ok
+    use crate::foo::panic; // ok
     fn f() { panic!(); }
 }
 
 mod m2 {
-    use foo::*;
+    use crate::foo::*;
     fn f() { panic!(); } //~ ERROR ambiguous
 }
 
 mod m3 {
-    ::two_macros::m!(use foo::panic;);
+    ::two_macros::m!(use crate::foo::panic;);
     fn f() { panic!(); } //~ ERROR ambiguous
 }
 
@@ -40,12 +40,12 @@ mod bar {
 }
 
 mod m6 {
-    use bar::n; // ok
+    use crate::bar::n; // ok
     n!();
 }
 
 mod m7 {
-    use bar::*;
+    use crate::bar::*;
     n!(); //~ ERROR ambiguous
 }
 
diff --git a/tests/ui/imports/shadow_builtin_macros.stderr b/tests/ui/imports/shadow_builtin_macros.stderr
index 6ffb31c20e6..c828b1193d8 100644
--- a/tests/ui/imports/shadow_builtin_macros.stderr
+++ b/tests/ui/imports/shadow_builtin_macros.stderr
@@ -9,8 +9,8 @@ LL |     fn f() { panic!(); }
 note: `panic` could also refer to the macro imported here
   --> $DIR/shadow_builtin_macros.rs:14:9
    |
-LL |     use foo::*;
-   |         ^^^^^^
+LL |     use crate::foo::*;
+   |         ^^^^^^^^^^^^^
    = help: consider adding an explicit import of `panic` to disambiguate
    = help: or use `self::panic` to refer to this macro unambiguously
 
@@ -42,8 +42,8 @@ LL |     n!();
 note: `n` could refer to the macro imported here
   --> $DIR/shadow_builtin_macros.rs:48:9
    |
-LL |     use bar::*;
-   |         ^^^^^^
+LL |     use crate::bar::*;
+   |         ^^^^^^^^^^^^^
    = help: consider adding an explicit import of `n` to disambiguate
    = help: or use `self::n` to refer to this macro unambiguously
 note: `n` could also refer to the macro imported here
@@ -63,8 +63,8 @@ LL |     fn f() { panic!(); }
 note: `panic` could also refer to the macro imported here
   --> $DIR/shadow_builtin_macros.rs:19:26
    |
-LL |     ::two_macros::m!(use foo::panic;);
-   |                          ^^^^^^^^^^
+LL |     ::two_macros::m!(use crate::foo::panic;);
+   |                          ^^^^^^^^^^^^^^^^^
    = help: use `self::panic` to refer to this macro unambiguously
 
 error: aborting due to 4 previous errors
diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs
index c42a4b94e29..a467c445d61 100644
--- a/tests/ui/intrinsics/intrinsic-alignment.rs
+++ b/tests/ui/intrinsics/intrinsic-alignment.rs
@@ -24,16 +24,16 @@ mod m {
     #[cfg(target_arch = "x86")]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
-            assert_eq!(::rusti::min_align_of::<u64>(), 4);
+            assert_eq!(crate::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::min_align_of::<u64>(), 4);
         }
     }
 
     #[cfg(not(target_arch = "x86"))]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
@@ -43,8 +43,8 @@ mod m {
     #[cfg(target_arch = "x86_64")]
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
@@ -53,8 +53,8 @@ mod m {
 mod m {
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
@@ -63,8 +63,8 @@ mod m {
 mod m {
     pub fn main() {
         unsafe {
-            assert_eq!(::rusti::pref_align_of::<u64>(), 8);
-            assert_eq!(::rusti::min_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::pref_align_of::<u64>(), 8);
+            assert_eq!(crate::rusti::min_align_of::<u64>(), 8);
         }
     }
 }
diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs
index 612da86c956..f900f998d06 100644
--- a/tests/ui/lint/lint-ctypes-enum.rs
+++ b/tests/ui/lint/lint-ctypes-enum.rs
@@ -85,8 +85,8 @@ extern "C" {
     fn repr_c(x: ReprC);
     fn repr_u8(x: U8);
     fn repr_isize(x: Isize);
-    fn repr_u128(x: U128); //~ ERROR `extern` block uses type `U128`
-    fn repr_i128(x: I128); //~ ERROR `extern` block uses type `I128`
+    fn repr_u128(x: U128);
+    fn repr_i128(x: I128);
     fn option_ref(x: Option<&'static u8>);
     fn option_fn(x: Option<extern "C" fn()>);
     fn option_nonnull(x: Option<std::ptr::NonNull<u8>>);
@@ -96,14 +96,12 @@ extern "C" {
     fn option_nonzero_u32(x: Option<num::NonZero<u32>>);
     fn option_nonzero_u64(x: Option<num::NonZero<u64>>);
     fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
-    //~^ ERROR `extern` block uses type `u128`
     fn option_nonzero_usize(x: Option<num::NonZero<usize>>);
     fn option_nonzero_i8(x: Option<num::NonZero<i8>>);
     fn option_nonzero_i16(x: Option<num::NonZero<i16>>);
     fn option_nonzero_i32(x: Option<num::NonZero<i32>>);
     fn option_nonzero_i64(x: Option<num::NonZero<i64>>);
     fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
-    //~^ ERROR `extern` block uses type `i128`
     fn option_nonzero_isize(x: Option<num::NonZero<isize>>);
     fn option_transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>);
     fn option_transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>);
@@ -121,14 +119,12 @@ extern "C" {
     fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>);
     fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>);
     fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
-    //~^ ERROR `extern` block uses type `u128`
     fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>);
     fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>);
     fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>);
     fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>);
     fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>);
     fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
-    //~^ ERROR `extern` block uses type `i128`
     fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>);
     fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>);
     fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>);
@@ -159,14 +155,12 @@ extern "C" {
     fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>);
     fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>);
     fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
-    //~^ ERROR `extern` block uses type `u128`
     fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>);
     fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>);
     fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>);
     fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>);
     fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>);
     fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
-    //~^ ERROR `extern` block uses type `i128`
     fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>);
     fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>);
     fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>);
diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr
index 50a6f526f26..40d22723309 100644
--- a/tests/ui/lint/lint-ctypes-enum.stderr
+++ b/tests/ui/lint/lint-ctypes-enum.stderr
@@ -45,50 +45,8 @@ note: the type is defined here
 LL | enum T {
    | ^^^^^^
 
-error: `extern` block uses type `U128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:88:21
-   |
-LL |     fn repr_u128(x: U128);
-   |                     ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-note: the type is defined here
-  --> $DIR/lint-ctypes-enum.rs:44:1
-   |
-LL | enum U128 {
-   | ^^^^^^^^^
-
-error: `extern` block uses type `I128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:89:21
-   |
-LL |     fn repr_i128(x: I128);
-   |                     ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-note: the type is defined here
-  --> $DIR/lint-ctypes-enum.rs:51:1
-   |
-LL | enum I128 {
-   | ^^^^^^^^^
-
-error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:98:31
-   |
-LL |     fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
-   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-error: `extern` block uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:105:31
-   |
-LL |     fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
-   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
 error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:110:36
+  --> $DIR/lint-ctypes-enum.rs:108:36
    |
 LL |     fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -97,7 +55,7 @@ LL |     fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>
    = note: enum has no representation hint
 
 error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:112:28
+  --> $DIR/lint-ctypes-enum.rs:110:28
    |
 LL |     fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>);
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -106,7 +64,7 @@ LL |     fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `Option<u8>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:113:21
+  --> $DIR/lint-ctypes-enum.rs:111:21
    |
 LL |     fn option_u8(x: Option<u8>);
    |                     ^^^^^^^^^^ not FFI-safe
@@ -114,24 +72,8 @@ LL |     fn option_u8(x: Option<u8>);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
-error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:123:33
-   |
-LL |     fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
-   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-error: `extern` block uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:130:33
-   |
-LL |     fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
-   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
 error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:135:38
+  --> $DIR/lint-ctypes-enum.rs:131:38
    |
 LL |     fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>);
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -140,7 +82,7 @@ LL |     fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:137:30
+  --> $DIR/lint-ctypes-enum.rs:133:30
    |
 LL |     fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -149,7 +91,7 @@ LL |     fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<NonZero<u8>, U>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:141:51
+  --> $DIR/lint-ctypes-enum.rs:137:51
    |
 LL |     fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>);
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -158,7 +100,7 @@ LL |     fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>,
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:143:53
+  --> $DIR/lint-ctypes-enum.rs:139:53
    |
 LL |     fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>);
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -167,7 +109,7 @@ LL |     fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:145:51
+  --> $DIR/lint-ctypes-enum.rs:141:51
    |
 LL |     fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>);
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -176,7 +118,7 @@ LL |     fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>,
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:148:49
+  --> $DIR/lint-ctypes-enum.rs:144:49
    |
 LL |     fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>);
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -185,7 +127,7 @@ LL |     fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Fi
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:150:30
+  --> $DIR/lint-ctypes-enum.rs:146:30
    |
 LL |     fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>);
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -193,24 +135,8 @@ LL |     fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
-error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:161:33
-   |
-LL |     fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
-   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-error: `extern` block uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:168:33
-   |
-LL |     fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
-   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
 error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:173:38
+  --> $DIR/lint-ctypes-enum.rs:167:38
    |
 LL |     fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>);
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -219,7 +145,7 @@ LL |     fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZe
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:175:30
+  --> $DIR/lint-ctypes-enum.rs:169:30
    |
 LL |     fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -228,7 +154,7 @@ LL |     fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<U, NonZero<u8>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:179:51
+  --> $DIR/lint-ctypes-enum.rs:173:51
    |
 LL |     fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>);
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -237,7 +163,7 @@ LL |     fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:181:53
+  --> $DIR/lint-ctypes-enum.rs:175:53
    |
 LL |     fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>);
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -246,7 +172,7 @@ LL |     fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:183:51
+  --> $DIR/lint-ctypes-enum.rs:177:51
    |
 LL |     fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>);
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -255,7 +181,7 @@ LL |     fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:186:49
+  --> $DIR/lint-ctypes-enum.rs:180:49
    |
 LL |     fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>);
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -264,7 +190,7 @@ LL |     fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:188:30
+  --> $DIR/lint-ctypes-enum.rs:182:30
    |
 LL |     fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -273,7 +199,7 @@ LL |     fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:190:27
+  --> $DIR/lint-ctypes-enum.rs:184:27
    |
 LL |     fn result_unit_t_e(x: Result<(), ()>);
    |                           ^^^^^^^^^^^^^^ not FFI-safe
@@ -281,5 +207,5 @@ LL |     fn result_unit_t_e(x: Result<(), ()>);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
-error: aborting due to 29 previous errors
+error: aborting due to 21 previous errors
 
diff --git a/tests/ui/lint/lint-ctypes-fn.rs b/tests/ui/lint/lint-ctypes-fn.rs
index 73820c86d1a..0b84098e390 100644
--- a/tests/ui/lint/lint-ctypes-fn.rs
+++ b/tests/ui/lint/lint-ctypes-fn.rs
@@ -89,12 +89,6 @@ pub extern "C" fn boxed_trait(p: Box<dyn Trait>) { }
 pub extern "C" fn char_type(p: char) { }
 //~^ ERROR uses type `char`
 
-pub extern "C" fn i128_type(p: i128) { }
-//~^ ERROR uses type `i128`
-
-pub extern "C" fn u128_type(p: u128) { }
-//~^ ERROR uses type `u128`
-
 pub extern "C" fn tuple_type(p: (i32, i32)) { }
 //~^ ERROR uses type `(i32, i32)`
 
@@ -120,9 +114,6 @@ pub extern "C" fn fn_type2(p: fn()) { }
 
 pub extern "C" fn fn_contained(p: RustBadRet) { }
 
-pub extern "C" fn transparent_i128(p: TransparentI128) { }
-//~^ ERROR: uses type `i128`
-
 pub extern "C" fn transparent_str(p: TransparentStr) { }
 //~^ ERROR: uses type `str`
 
@@ -161,6 +152,12 @@ pub extern "C" fn good17(p: TransparentCustomZst) { }
 #[allow(improper_ctypes_definitions)]
 pub extern "C" fn good18(_: &String) { }
 
+pub extern "C" fn good_i128_type(p: i128) { }
+
+pub extern "C" fn good_u128_type(p: u128) { }
+
+pub extern "C" fn good_transparent_i128(p: TransparentI128) { }
+
 #[cfg(not(target_arch = "wasm32"))]
 pub extern "C" fn good1(size: *const c_int) { }
 
diff --git a/tests/ui/lint/lint-ctypes-fn.stderr b/tests/ui/lint/lint-ctypes-fn.stderr
index a62533a4be1..a19c04a63b5 100644
--- a/tests/ui/lint/lint-ctypes-fn.stderr
+++ b/tests/ui/lint/lint-ctypes-fn.stderr
@@ -54,24 +54,8 @@ LL | pub extern "C" fn char_type(p: char) { }
    = help: consider using `u32` or `libc::wchar_t` instead
    = note: the `char` type has no C equivalent
 
-error: `extern` fn uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:92:32
-   |
-LL | pub extern "C" fn i128_type(p: i128) { }
-   |                                ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-error: `extern` fn uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:95:32
-   |
-LL | pub extern "C" fn u128_type(p: u128) { }
-   |                                ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
 error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:98:33
+  --> $DIR/lint-ctypes-fn.rs:92:33
    |
 LL | pub extern "C" fn tuple_type(p: (i32, i32)) { }
    |                                 ^^^^^^^^^^ not FFI-safe
@@ -80,7 +64,7 @@ LL | pub extern "C" fn tuple_type(p: (i32, i32)) { }
    = note: tuples have unspecified layout
 
 error: `extern` fn uses type `(i32, i32)`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:101:34
+  --> $DIR/lint-ctypes-fn.rs:95:34
    |
 LL | pub extern "C" fn tuple_type2(p: I32Pair) { }
    |                                  ^^^^^^^ not FFI-safe
@@ -89,7 +73,7 @@ LL | pub extern "C" fn tuple_type2(p: I32Pair) { }
    = note: tuples have unspecified layout
 
 error: `extern` fn uses type `ZeroSize`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:104:32
+  --> $DIR/lint-ctypes-fn.rs:98:32
    |
 LL | pub extern "C" fn zero_size(p: ZeroSize) { }
    |                                ^^^^^^^^ not FFI-safe
@@ -103,7 +87,7 @@ LL | pub struct ZeroSize;
    | ^^^^^^^^^^^^^^^^^^^
 
 error: `extern` fn uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:107:40
+  --> $DIR/lint-ctypes-fn.rs:101:40
    |
 LL | pub extern "C" fn zero_size_phantom(p: ZeroSizeWithPhantomData) { }
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -116,7 +100,7 @@ LL | pub struct ZeroSizeWithPhantomData(PhantomData<i32>);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:110:51
+  --> $DIR/lint-ctypes-fn.rs:104:51
    |
 LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> {
    |                                                   ^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -124,7 +108,7 @@ LL | pub extern "C" fn zero_size_phantom_toplevel() -> PhantomData<bool> {
    = note: composed only of `PhantomData`
 
 error: `extern` fn uses type `fn()`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:115:30
+  --> $DIR/lint-ctypes-fn.rs:109:30
    |
 LL | pub extern "C" fn fn_type(p: RustFn) { }
    |                              ^^^^^^ not FFI-safe
@@ -133,7 +117,7 @@ LL | pub extern "C" fn fn_type(p: RustFn) { }
    = note: this function pointer has Rust-specific calling convention
 
 error: `extern` fn uses type `fn()`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:118:31
+  --> $DIR/lint-ctypes-fn.rs:112:31
    |
 LL | pub extern "C" fn fn_type2(p: fn()) { }
    |                               ^^^^ not FFI-safe
@@ -141,16 +125,8 @@ LL | pub extern "C" fn fn_type2(p: fn()) { }
    = help: consider using an `extern fn(...) -> ...` function pointer instead
    = note: this function pointer has Rust-specific calling convention
 
-error: `extern` fn uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:123:39
-   |
-LL | pub extern "C" fn transparent_i128(p: TransparentI128) { }
-   |                                       ^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
 error: `extern` fn uses type `str`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:126:38
+  --> $DIR/lint-ctypes-fn.rs:117:38
    |
 LL | pub extern "C" fn transparent_str(p: TransparentStr) { }
    |                                      ^^^^^^^^^^^^^^ not FFI-safe
@@ -159,7 +135,7 @@ LL | pub extern "C" fn transparent_str(p: TransparentStr) { }
    = note: string slices have no C equivalent
 
 error: `extern` fn uses type `PhantomData<bool>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:172:43
+  --> $DIR/lint-ctypes-fn.rs:169:43
    |
 LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> {
    |                                           ^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -167,7 +143,7 @@ LL | pub extern "C" fn unused_generic2<T>() -> PhantomData<bool> {
    = note: composed only of `PhantomData`
 
 error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:185:39
+  --> $DIR/lint-ctypes-fn.rs:182:39
    |
 LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { }
    |                                       ^^^^^^ not FFI-safe
@@ -176,7 +152,7 @@ LL | pub extern "C" fn used_generic4<T>(x: Vec<T>) { }
    = note: this struct has unspecified layout
 
 error: `extern` fn uses type `Vec<T>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-fn.rs:188:41
+  --> $DIR/lint-ctypes-fn.rs:185:41
    |
 LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
    |                                         ^^^^^^ not FFI-safe
@@ -184,5 +160,5 @@ LL | pub extern "C" fn used_generic5<T>() -> Vec<T> {
    = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
    = note: this struct has unspecified layout
 
-error: aborting due to 20 previous errors
+error: aborting due to 17 previous errors
 
diff --git a/tests/ui/lint/lint-ctypes.rs b/tests/ui/lint/lint-ctypes.rs
index 6dd9be10a48..47586c826ab 100644
--- a/tests/ui/lint/lint-ctypes.rs
+++ b/tests/ui/lint/lint-ctypes.rs
@@ -54,8 +54,6 @@ extern "C" {
     pub fn opt_box_type(p: Option<Box<u32>>);
     //~^ ERROR uses type `Option<Box<u32>>`
     pub fn char_type(p: char); //~ ERROR uses type `char`
-    pub fn i128_type(p: i128); //~ ERROR uses type `i128`
-    pub fn u128_type(p: u128); //~ ERROR uses type `u128`
     pub fn trait_type(p: &dyn Bar); //~ ERROR uses type `dyn Bar`
     pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)`
     pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)`
@@ -67,7 +65,6 @@ extern "C" {
     pub fn fn_type(p: RustFn); //~ ERROR uses type `fn()`
     pub fn fn_type2(p: fn()); //~ ERROR uses type `fn()`
     pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `Box<u32>`
-    pub fn transparent_i128(p: TransparentI128); //~ ERROR: uses type `i128`
     pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str`
     pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `Box<u32>`
     pub fn raw_array(arr: [u8; 8]); //~ ERROR: uses type `[u8; 8]`
@@ -77,9 +74,6 @@ extern "C" {
     pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
     //~^ ERROR: uses type `Option<UnsafeCell<&i32>>`
 
-    pub static static_u128_type: u128; //~ ERROR: uses type `u128`
-    pub static static_u128_array_type: [u128; 16]; //~ ERROR: uses type `u128`
-
     pub fn good3(fptr: Option<extern "C" fn()>);
     pub fn good4(aptr: &[u8; 4 as usize]);
     pub fn good5(s: StructWithProjection);
@@ -99,7 +93,11 @@ extern "C" {
     pub fn good18(_: &String);
     pub fn good20(arr: *const [u8; 8]);
     pub static good21: [u8; 8];
-
+    pub fn good_i128_type(p: i128);
+    pub fn good_u128_type(p: u128);
+    pub fn good_transparent_i128(p: TransparentI128);
+    pub static good_static_u128_type: u128;
+    pub static good_static_u128_array_type: [u128; 16];
 }
 
 #[allow(improper_ctypes)]
diff --git a/tests/ui/lint/lint-ctypes.stderr b/tests/ui/lint/lint-ctypes.stderr
index 8137ae868d3..3fb36647d4f 100644
--- a/tests/ui/lint/lint-ctypes.stderr
+++ b/tests/ui/lint/lint-ctypes.stderr
@@ -85,24 +85,8 @@ LL |     pub fn char_type(p: char);
    = help: consider using `u32` or `libc::wchar_t` instead
    = note: the `char` type has no C equivalent
 
-error: `extern` block uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:57:25
-   |
-LL |     pub fn i128_type(p: i128);
-   |                         ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:58:25
-   |
-LL |     pub fn u128_type(p: u128);
-   |                         ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
 error: `extern` block uses type `dyn Bar`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:59:26
+  --> $DIR/lint-ctypes.rs:57:26
    |
 LL |     pub fn trait_type(p: &dyn Bar);
    |                          ^^^^^^^^ not FFI-safe
@@ -110,7 +94,7 @@ LL |     pub fn trait_type(p: &dyn Bar);
    = note: trait objects have no C equivalent
 
 error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:60:26
+  --> $DIR/lint-ctypes.rs:58:26
    |
 LL |     pub fn tuple_type(p: (i32, i32));
    |                          ^^^^^^^^^^ not FFI-safe
@@ -119,7 +103,7 @@ LL |     pub fn tuple_type(p: (i32, i32));
    = note: tuples have unspecified layout
 
 error: `extern` block uses type `(i32, i32)`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:61:27
+  --> $DIR/lint-ctypes.rs:59:27
    |
 LL |     pub fn tuple_type2(p: I32Pair);
    |                           ^^^^^^^ not FFI-safe
@@ -128,7 +112,7 @@ LL |     pub fn tuple_type2(p: I32Pair);
    = note: tuples have unspecified layout
 
 error: `extern` block uses type `ZeroSize`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:62:25
+  --> $DIR/lint-ctypes.rs:60:25
    |
 LL |     pub fn zero_size(p: ZeroSize);
    |                         ^^^^^^^^ not FFI-safe
@@ -142,7 +126,7 @@ LL | pub struct ZeroSize;
    | ^^^^^^^^^^^^^^^^^^^
 
 error: `extern` block uses type `ZeroSizeWithPhantomData`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:63:33
+  --> $DIR/lint-ctypes.rs:61:33
    |
 LL |     pub fn zero_size_phantom(p: ZeroSizeWithPhantomData);
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -155,7 +139,7 @@ LL | pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `extern` block uses type `PhantomData<bool>`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:66:12
+  --> $DIR/lint-ctypes.rs:64:12
    |
 LL |         -> ::std::marker::PhantomData<bool>;
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -163,7 +147,7 @@ LL |         -> ::std::marker::PhantomData<bool>;
    = note: composed only of `PhantomData`
 
 error: `extern` block uses type `fn()`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:67:23
+  --> $DIR/lint-ctypes.rs:65:23
    |
 LL |     pub fn fn_type(p: RustFn);
    |                       ^^^^^^ not FFI-safe
@@ -172,7 +156,7 @@ LL |     pub fn fn_type(p: RustFn);
    = note: this function pointer has Rust-specific calling convention
 
 error: `extern` block uses type `fn()`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:68:24
+  --> $DIR/lint-ctypes.rs:66:24
    |
 LL |     pub fn fn_type2(p: fn());
    |                        ^^^^ not FFI-safe
@@ -181,7 +165,7 @@ LL |     pub fn fn_type2(p: fn());
    = note: this function pointer has Rust-specific calling convention
 
 error: `extern` block uses type `Box<u32>`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:69:28
+  --> $DIR/lint-ctypes.rs:67:28
    |
 LL |     pub fn fn_contained(p: RustBadRet);
    |                            ^^^^^^^^^^ not FFI-safe
@@ -189,16 +173,8 @@ LL |     pub fn fn_contained(p: RustBadRet);
    = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
    = note: this struct has unspecified layout
 
-error: `extern` block uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:70:32
-   |
-LL |     pub fn transparent_i128(p: TransparentI128);
-   |                                ^^^^^^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
 error: `extern` block uses type `str`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:71:31
+  --> $DIR/lint-ctypes.rs:68:31
    |
 LL |     pub fn transparent_str(p: TransparentStr);
    |                               ^^^^^^^^^^^^^^ not FFI-safe
@@ -207,7 +183,7 @@ LL |     pub fn transparent_str(p: TransparentStr);
    = note: string slices have no C equivalent
 
 error: `extern` block uses type `Box<u32>`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:72:30
+  --> $DIR/lint-ctypes.rs:69:30
    |
 LL |     pub fn transparent_fn(p: TransparentBadFn);
    |                              ^^^^^^^^^^^^^^^^ not FFI-safe
@@ -216,7 +192,7 @@ LL |     pub fn transparent_fn(p: TransparentBadFn);
    = note: this struct has unspecified layout
 
 error: `extern` block uses type `[u8; 8]`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:73:27
+  --> $DIR/lint-ctypes.rs:70:27
    |
 LL |     pub fn raw_array(arr: [u8; 8]);
    |                           ^^^^^^^ not FFI-safe
@@ -225,7 +201,7 @@ LL |     pub fn raw_array(arr: [u8; 8]);
    = note: passing raw arrays by value is not FFI-safe
 
 error: `extern` block uses type `Option<UnsafeCell<extern "C" fn()>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:75:26
+  --> $DIR/lint-ctypes.rs:72:26
    |
 LL |     pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -234,7 +210,7 @@ LL |     pub fn no_niche_a(a: Option<UnsafeCell<extern "C" fn()>>);
    = note: enum has no representation hint
 
 error: `extern` block uses type `Option<UnsafeCell<&i32>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:77:26
+  --> $DIR/lint-ctypes.rs:74:26
    |
 LL |     pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -242,21 +218,5 @@ LL |     pub fn no_niche_b(b: Option<UnsafeCell<&i32>>);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
-error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:80:34
-   |
-LL |     pub static static_u128_type: u128;
-   |                                  ^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes.rs:81:40
-   |
-LL |     pub static static_u128_array_type: [u128; 16];
-   |                                        ^^^^^^^^^^ not FFI-safe
-   |
-   = note: 128-bit integers don't currently have a known stable ABI
-
-error: aborting due to 27 previous errors
+error: aborting due to 22 previous errors