about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_codegen_cranelift/Readme.md26
-rw-r--r--compiler/rustc_hir_analysis/src/check/compare_impl_item.rs2
-rw-r--r--compiler/rustc_hir_typeck/src/coercion.rs19
-rw-r--r--compiler/rustc_middle/src/ty/context.rs10
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs2
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs62
-rw-r--r--compiler/rustc_middle/src/ty/structural_impls.rs59
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs3
-rw-r--r--compiler/rustc_type_ir/src/lib.rs23
-rw-r--r--compiler/rustc_type_ir/src/structural_impls.rs21
-rw-r--r--compiler/rustc_type_ir/src/sty.rs72
-rw-r--r--src/tools/tidy/src/ui_tests.rs4
-rw-r--r--tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs90
-rw-r--r--tests/incremental/issue-110457-same-span-closures/main.rs47
-rw-r--r--tests/ui/async-await/issue-78115.rs (renamed from tests/ui/issues/issue-78115.rs)0
-rw-r--r--tests/ui/coercion/issue-3794.rs (renamed from tests/ui/issues/issue-3794.rs)0
-rw-r--r--tests/ui/consts/issue-16538.mir.stderr (renamed from tests/ui/issues/issue-16538.mir.stderr)0
-rw-r--r--tests/ui/consts/issue-16538.rs (renamed from tests/ui/issues/issue-16538.rs)0
-rw-r--r--tests/ui/consts/issue-16538.thir.stderr (renamed from tests/ui/issues/issue-16538.thir.stderr)0
-rw-r--r--tests/ui/consts/issue-28822.rs (renamed from tests/ui/issues/issue-28822.rs)0
-rw-r--r--tests/ui/consts/issue-29798.rs (renamed from tests/ui/issues/issue-29798.rs)0
-rw-r--r--tests/ui/enum-discriminant/issue-50689.rs (renamed from tests/ui/issues/issue-50689.rs)0
-rw-r--r--tests/ui/extern/issue-1251.rs (renamed from tests/ui/issues/issue-1251.rs)0
-rw-r--r--tests/ui/for-loop-while/issue-1257.rs (renamed from tests/ui/issues/issue-1257.rs)0
-rw-r--r--tests/ui/impl-trait/autoderef.rs2
-rw-r--r--tests/ui/mismatched_types/E0053.stderr2
-rw-r--r--tests/ui/mismatched_types/issue-112036.rs7
-rw-r--r--tests/ui/mismatched_types/issue-112036.stderr15
-rw-r--r--tests/ui/pattern/issue-94866.rs (renamed from tests/ui/issue-94866.rs)0
-rw-r--r--tests/ui/pattern/issue-94866.stderr (renamed from tests/ui/issue-94866.stderr)0
-rw-r--r--tests/ui/structs-enums/issue-3008-1.rs (renamed from tests/ui/issues/issue-3008-1.rs)0
-rw-r--r--tests/ui/structs-enums/issue-3008-1.stderr (renamed from tests/ui/issues/issue-3008-1.stderr)0
-rw-r--r--tests/ui/structs-enums/issue-3008-2.rs (renamed from tests/ui/issues/issue-3008-2.rs)0
-rw-r--r--tests/ui/structs-enums/issue-3008-2.stderr (renamed from tests/ui/issues/issue-3008-2.stderr)0
-rw-r--r--tests/ui/structs-enums/issue-3008-3.rs (renamed from tests/ui/issues/issue-3008-3.rs)0
-rw-r--r--tests/ui/structs-enums/issue-3008-3.stderr (renamed from tests/ui/issues/issue-3008-3.stderr)0
-rw-r--r--tests/ui/thir-print/thir-flat.stdout2
-rw-r--r--tests/ui/typeck/issue-1871.rs (renamed from tests/ui/issues/issue-1871.rs)0
-rw-r--r--tests/ui/typeck/issue-1871.stderr (renamed from tests/ui/issues/issue-1871.stderr)0
-rw-r--r--tests/ui/typeck/issue-2063-resource.rs (renamed from tests/ui/issues/issue-2063-resource.rs)0
-rw-r--r--tests/ui/typeck/issue-2063.rs (renamed from tests/ui/issues/issue-2063.rs)0
-rw-r--r--tests/ui/where-clauses/issue-50825-1.rs (renamed from tests/ui/issues/issue-50825-1.rs)0
-rw-r--r--tests/ui/where-clauses/issue-50825.rs (renamed from tests/ui/issues/issue-50825.rs)0
43 files changed, 385 insertions, 83 deletions
diff --git a/compiler/rustc_codegen_cranelift/Readme.md b/compiler/rustc_codegen_cranelift/Readme.md
index c5222982aa7..26dccf309e1 100644
--- a/compiler/rustc_codegen_cranelift/Readme.md
+++ b/compiler/rustc_codegen_cranelift/Readme.md
@@ -42,6 +42,32 @@ This will build your project with rustc_codegen_cranelift instead of the usual L
 
 For additional ways to use rustc_codegen_cranelift like the JIT mode see [usage.md](docs/usage.md).
 
+## Building and testing with changes in rustc code
+
+This is useful when changing code in `rustc_codegen_cranelift` as part of changing [main Rust repository](https://github.com/rust-lang/rust/).
+This can happen, for example, when you are implementing a new compiler intrinsic.
+
+Instruction below uses `$RustCheckoutDir` as substitute for any folder where you cloned Rust repository.
+
+You need to do this steps to successfully compile and use the cranelift backend with your changes in rustc code:
+
+1. `cd $RustCheckoutDir`
+2. Run `python x.py setup` and choose option for compiler (`b`).
+3. Build compiler and necessary tools: `python x.py build --stage=2 compiler library/std src/tools/rustdoc src/tools/rustfmt`
+   * (Optional) You can also build cargo by adding `src/tools/cargo` to previous command.
+4. Copy exectutable files from `./build/host/stage2-tools/<your hostname triple>/release`
+to `./build/host/stage2/bin/`. Note that you would need to do this every time you rebuilt `rust` repository.
+5. Copy cargo from another toolchain: `cp $(rustup which cargo) .build/<your hostname triple>/stage2/bin/cargo`
+   * Another option is to build it at step 3 and copy with other executables at step 4.
+6. Link your new `rustc` to toolchain: `rustup toolchain link stage2 ./build/host/stage2/`.
+7. (Windows only) compile y.rs: `rustc +stage2 -O y.rs`.
+8. You need to prefix every `./y.rs` (or `y` if you built `y.rs`) command by `rustup run stage2` to make cg_clif use your local changes in rustc.
+
+  * `rustup run stage2 ./y.rs prepare`
+  * `rustup run stage2 ./y.rs build`
+  * (Optional) run tests: `rustup run stage2 ./y.rs test`
+9. Now you can use your cg_clif build to compile other Rust programs, e.g. you can open any Rust crate and run commands like `$RustCheckoutDir/compiler/rustc_codegen_cranelift/dist/cargo-clif build --release`.
+
 ## Configuration
 
 See the documentation on the `BackendConfig` struct in [config.rs](src/config.rs) for all
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
index e33330e259c..18b6537a8e9 100644
--- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
+++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
@@ -902,7 +902,7 @@ fn report_trait_method_mismatch<'tcx>(
             if trait_m.fn_has_self_parameter =>
         {
             let ty = trait_sig.inputs()[0];
-            let sugg = match ExplicitSelf::determine(ty, |_| ty == impl_trait_ref.self_ty()) {
+            let sugg = match ExplicitSelf::determine(ty, |ty| ty == impl_trait_ref.self_ty()) {
                 ExplicitSelf::ByValue => "self".to_owned(),
                 ExplicitSelf::ByReference(_, hir::Mutability::Not) => "&self".to_owned(),
                 ExplicitSelf::ByReference(_, hir::Mutability::Mut) => "&mut self".to_owned(),
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index 08c4082e885..369dd4ae595 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -62,6 +62,7 @@ use rustc_span::{self, BytePos, DesugaringKind, Span};
 use rustc_target::spec::abi::Abi;
 use rustc_trait_selection::infer::InferCtxtExt as _;
 use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
+use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
 use rustc_trait_selection::traits::{
     self, NormalizeExt, ObligationCause, ObligationCauseCode, ObligationCtxt,
 };
@@ -144,12 +145,28 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
         debug!("unify(a: {:?}, b: {:?}, use_lub: {})", a, b, self.use_lub);
         self.commit_if_ok(|_| {
             let at = self.at(&self.cause, self.fcx.param_env);
-            if self.use_lub {
+
+            let res = if self.use_lub {
                 at.lub(DefineOpaqueTypes::Yes, b, a)
             } else {
                 at.sup(DefineOpaqueTypes::Yes, b, a)
                     .map(|InferOk { value: (), obligations }| InferOk { value: a, obligations })
+            };
+
+            // In the new solver, lazy norm may allow us to shallowly equate
+            // more types, but we emit possibly impossible-to-satisfy obligations.
+            // Filter these cases out to make sure our coercion is more accurate.
+            if self.tcx.trait_solver_next() {
+                if let Ok(res) = &res {
+                    for obligation in &res.obligations {
+                        if !self.predicate_may_hold(&obligation) {
+                            return Err(TypeError::Mismatch);
+                        }
+                    }
+                }
             }
+
+            res
         })
     }
 
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 0464336627f..4fdd3f26316 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -115,6 +115,16 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
     type FreeRegion = ty::FreeRegion;
     type RegionVid = ty::RegionVid;
     type PlaceholderRegion = ty::PlaceholderRegion;
+
+    fn ty_and_mut_to_parts(
+        TypeAndMut { ty, mutbl }: TypeAndMut<'tcx>,
+    ) -> (Self::Ty, Self::Mutability) {
+        (ty, mutbl)
+    }
+
+    fn mutability_is_mut(mutbl: Self::Mutability) -> bool {
+        mutbl.is_mut()
+    }
 }
 
 type InternedSet<'tcx, T> = ShardedHashMap<InternedInSet<'tcx, T>, ()>;
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 4b2c7e8ef31..ac2144529b5 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -1496,7 +1496,7 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
 /// identified by both a universe, as well as a name residing within that universe. Distinct bound
 /// regions/types/consts within the same universe simply have an unknown relationship to one
 /// another.
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
+#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
 #[derive(HashStable, TyEncodable, TyDecodable)]
 pub struct Placeholder<T> {
     pub universe: UniverseIndex,
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index d6c88ea96ca..94915923c31 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -685,29 +685,30 @@ pub trait PrettyPrinter<'tcx>:
             }
             ty::FnPtr(ref bare_fn) => p!(print(bare_fn)),
             ty::Infer(infer_ty) => {
-                let verbose = self.should_print_verbose();
+                if self.should_print_verbose() {
+                    p!(write("{:?}", ty.kind()));
+                    return Ok(self);
+                }
+
                 if let ty::TyVar(ty_vid) = infer_ty {
                     if let Some(name) = self.ty_infer_name(ty_vid) {
                         p!(write("{}", name))
                     } else {
-                        if verbose {
-                            p!(write("{:?}", infer_ty))
-                        } else {
-                            p!(write("{}", infer_ty))
-                        }
+                        p!(write("{}", infer_ty))
                     }
                 } else {
-                    if verbose { p!(write("{:?}", infer_ty)) } else { p!(write("{}", infer_ty)) }
+                    p!(write("{}", infer_ty))
                 }
             }
             ty::Error(_) => p!("{{type error}}"),
             ty::Param(ref param_ty) => p!(print(param_ty)),
             ty::Bound(debruijn, bound_ty) => match bound_ty.kind {
-                ty::BoundTyKind::Anon => debug_bound_var(&mut self, debruijn, bound_ty.var)?,
+                ty::BoundTyKind::Anon => {
+                    rustc_type_ir::debug_bound_var(&mut self, debruijn, bound_ty.var)?
+                }
                 ty::BoundTyKind::Param(_, s) => match self.should_print_verbose() {
-                    true if debruijn == ty::INNERMOST => p!(write("^{}", s)),
-                    true => p!(write("^{}_{}", debruijn.index(), s)),
-                    false => p!(write("{}", s)),
+                    true => p!(write("{:?}", ty.kind())),
+                    false => p!(write("{s}")),
                 },
             },
             ty::Adt(def, substs) => {
@@ -740,10 +741,11 @@ pub trait PrettyPrinter<'tcx>:
                 }
             }
             ty::Placeholder(placeholder) => match placeholder.bound.kind {
-                ty::BoundTyKind::Anon => {
-                    debug_placeholder_var(&mut self, placeholder.universe, placeholder.bound.var)?;
-                }
-                ty::BoundTyKind::Param(_, name) => p!(write("{}", name)),
+                ty::BoundTyKind::Anon => p!(write("{placeholder:?}")),
+                ty::BoundTyKind::Param(_, name) => match self.should_print_verbose() {
+                    true => p!(write("{:?}", ty.kind())),
+                    false => p!(write("{name}")),
+                },
             },
             ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => {
                 // We use verbose printing in 'NO_QUERIES' mode, to
@@ -1372,11 +1374,9 @@ pub trait PrettyPrinter<'tcx>:
             }
 
             ty::ConstKind::Bound(debruijn, bound_var) => {
-                debug_bound_var(&mut self, debruijn, bound_var)?
+                rustc_type_ir::debug_bound_var(&mut self, debruijn, bound_var)?
             }
-            ty::ConstKind::Placeholder(placeholder) => {
-                debug_placeholder_var(&mut self, placeholder.universe, placeholder.bound)?;
-            },
+            ty::ConstKind::Placeholder(placeholder) => p!(write("{placeholder:?}")),
             // FIXME(generic_const_exprs):
             // write out some legible representation of an abstract const?
             ty::ConstKind::Expr(_) => p!("{{const expr}}"),
@@ -3065,27 +3065,3 @@ pub struct OpaqueFnEntry<'tcx> {
     fn_trait_ref: Option<ty::PolyTraitRef<'tcx>>,
     return_ty: Option<ty::Binder<'tcx, Term<'tcx>>>,
 }
-
-pub fn debug_bound_var<T: std::fmt::Write>(
-    fmt: &mut T,
-    debruijn: ty::DebruijnIndex,
-    var: ty::BoundVar,
-) -> Result<(), std::fmt::Error> {
-    if debruijn == ty::INNERMOST {
-        write!(fmt, "^{}", var.index())
-    } else {
-        write!(fmt, "^{}_{}", debruijn.index(), var.index())
-    }
-}
-
-pub fn debug_placeholder_var<T: std::fmt::Write>(
-    fmt: &mut T,
-    universe: ty::UniverseIndex,
-    bound: ty::BoundVar,
-) -> Result<(), std::fmt::Error> {
-    if universe == ty::UniverseIndex::ROOT {
-        write!(fmt, "!{}", bound.index())
-    } else {
-        write!(fmt, "!{}_{}", universe.index(), bound.index())
-    }
-}
diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs
index 16cb6c91046..a965450d27d 100644
--- a/compiler/rustc_middle/src/ty/structural_impls.rs
+++ b/compiler/rustc_middle/src/ty/structural_impls.rs
@@ -88,7 +88,35 @@ impl fmt::Debug for ty::FreeRegion {
 
 impl<'tcx> fmt::Debug for ty::FnSig<'tcx> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "({:?}; c_variadic: {})->{:?}", self.inputs(), self.c_variadic, self.output())
+        let ty::FnSig { inputs_and_output: _, c_variadic, unsafety, abi } = self;
+
+        write!(f, "{}", unsafety.prefix_str())?;
+        match abi {
+            rustc_target::spec::abi::Abi::Rust => (),
+            abi => write!(f, "extern \"{abi:?}\" ")?,
+        };
+
+        write!(f, "fn(")?;
+        let inputs = self.inputs();
+        match inputs.len() {
+            0 if *c_variadic => write!(f, "...)")?,
+            0 => write!(f, ")")?,
+            _ => {
+                for ty in &self.inputs()[0..(self.inputs().len() - 1)] {
+                    write!(f, "{ty:?}, ")?;
+                }
+                write!(f, "{:?}", self.inputs().last().unwrap())?;
+                if *c_variadic {
+                    write!(f, "...")?;
+                }
+                write!(f, ")")?;
+            }
+        }
+
+        match self.output().kind() {
+            ty::Tuple(list) if list.is_empty() => Ok(()),
+            _ => write!(f, " -> {:?}", self.output()),
+        }
     }
 }
 
@@ -216,20 +244,37 @@ impl<'tcx> fmt::Debug for ty::ConstKind<'tcx> {
         match self {
             Param(param) => write!(f, "{param:?}"),
             Infer(var) => write!(f, "{var:?}"),
-            Bound(debruijn, var) => ty::print::debug_bound_var(f, *debruijn, *var),
-            Placeholder(placeholder) => {
-                ty::print::debug_placeholder_var(f, placeholder.universe, placeholder.bound)
-            }
+            Bound(debruijn, var) => rustc_type_ir::debug_bound_var(f, *debruijn, *var),
+            Placeholder(placeholder) => write!(f, "{placeholder:?}"),
             Unevaluated(uv) => {
                 f.debug_tuple("Unevaluated").field(&uv.substs).field(&uv.def).finish()
             }
             Value(valtree) => write!(f, "{valtree:?}"),
-            Error(_) => write!(f, "[const error]"),
+            Error(_) => write!(f, "{{const error}}"),
             Expr(expr) => write!(f, "{expr:?}"),
         }
     }
 }
 
+impl fmt::Debug for ty::BoundTy {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self.kind {
+            ty::BoundTyKind::Anon => write!(f, "{:?}", self.var),
+            ty::BoundTyKind::Param(_, sym) => write!(f, "{sym:?}"),
+        }
+    }
+}
+
+impl<T: fmt::Debug> fmt::Debug for ty::Placeholder<T> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        if self.universe == ty::UniverseIndex::ROOT {
+            write!(f, "!{:?}", self.bound)
+        } else {
+            write!(f, "!{}_{:?}", self.universe.index(), self.bound)
+        }
+    }
+}
+
 ///////////////////////////////////////////////////////////////////////////
 // Atomic structs
 //
@@ -294,6 +339,7 @@ TrivialTypeTraversalAndLiftImpls! {
     crate::ty::AliasRelationDirection,
     crate::ty::Placeholder<crate::ty::BoundRegion>,
     crate::ty::Placeholder<crate::ty::BoundTy>,
+    crate::ty::Placeholder<ty::BoundVar>,
     crate::ty::ClosureKind,
     crate::ty::FreeRegion,
     crate::ty::InferTy,
@@ -310,7 +356,6 @@ TrivialTypeTraversalAndLiftImpls! {
     interpret::Scalar,
     rustc_target::abi::Size,
     ty::BoundVar,
-    ty::Placeholder<ty::BoundVar>,
 }
 
 TrivialTypeTraversalAndLiftImpls! {
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index 82f79a0c088..6a9686c017b 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -1511,10 +1511,11 @@ impl Atom for RegionVid {
 
 rustc_index::newtype_index! {
     #[derive(HashStable)]
+    #[debug_format = "{}"]
     pub struct BoundVar {}
 }
 
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
 #[derive(HashStable)]
 pub struct BoundTy {
     pub var: BoundVar,
diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs
index f6b44bdf27e..ae16fbb162e 100644
--- a/compiler/rustc_type_ir/src/lib.rs
+++ b/compiler/rustc_type_ir/src/lib.rs
@@ -52,7 +52,7 @@ pub trait Interner: Sized {
     type PolyFnSig: Clone + Debug + Hash + Ord;
     type ListBinderExistentialPredicate: Clone + Debug + Hash + Ord;
     type BinderListTy: Clone + Debug + Hash + Ord;
-    type ListTy: Clone + Debug + Hash + Ord;
+    type ListTy: Clone + Debug + Hash + Ord + IntoIterator<Item = Self::Ty>;
     type AliasTy: Clone + Debug + Hash + Ord;
     type ParamTy: Clone + Debug + Hash + Ord;
     type BoundTy: Clone + Debug + Hash + Ord;
@@ -67,6 +67,9 @@ pub trait Interner: Sized {
     type FreeRegion: Clone + Debug + Hash + Ord;
     type RegionVid: Clone + Debug + Hash + Ord;
     type PlaceholderRegion: Clone + Debug + Hash + Ord;
+
+    fn ty_and_mut_to_parts(ty_and_mut: Self::TypeAndMut) -> (Self::Ty, Self::Mutability);
+    fn mutability_is_mut(mutbl: Self::Mutability) -> bool;
 }
 
 /// Imagine you have a function `F: FnOnce(&[T]) -> R`, plus an iterator `iter`
@@ -390,7 +393,19 @@ impl DebruijnIndex {
     }
 }
 
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
+pub fn debug_bound_var<T: std::fmt::Write>(
+    fmt: &mut T,
+    debruijn: DebruijnIndex,
+    var: impl std::fmt::Debug,
+) -> Result<(), std::fmt::Error> {
+    if debruijn == INNERMOST {
+        write!(fmt, "^{:?}", var)
+    } else {
+        write!(fmt, "^{}_{:?}", debruijn.index(), var)
+    }
+}
+
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
 #[derive(Encodable, Decodable, HashStable_Generic)]
 pub enum IntTy {
     Isize,
@@ -448,7 +463,7 @@ impl IntTy {
     }
 }
 
-#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Debug)]
+#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
 #[derive(Encodable, Decodable, HashStable_Generic)]
 pub enum UintTy {
     Usize,
@@ -506,7 +521,7 @@ impl UintTy {
     }
 }
 
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
 #[derive(Encodable, Decodable, HashStable_Generic)]
 pub enum FloatTy {
     F32,
diff --git a/compiler/rustc_type_ir/src/structural_impls.rs b/compiler/rustc_type_ir/src/structural_impls.rs
index 45a2e9023c9..553d7f31b2d 100644
--- a/compiler/rustc_type_ir/src/structural_impls.rs
+++ b/compiler/rustc_type_ir/src/structural_impls.rs
@@ -4,11 +4,12 @@
 
 use crate::fold::{FallibleTypeFolder, TypeFoldable};
 use crate::visit::{TypeVisitable, TypeVisitor};
-use crate::Interner;
+use crate::{FloatTy, IntTy, Interner, UintTy};
 use rustc_data_structures::functor::IdFunctor;
 use rustc_data_structures::sync::Lrc;
 use rustc_index::{Idx, IndexVec};
 
+use core::fmt;
 use std::ops::ControlFlow;
 
 ///////////////////////////////////////////////////////////////////////////
@@ -163,3 +164,21 @@ impl<I: Interner, T: TypeVisitable<I>, Ix: Idx> TypeVisitable<I> for IndexVec<Ix
         self.iter().try_for_each(|t| t.visit_with(visitor))
     }
 }
+
+impl fmt::Debug for IntTy {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{}", self.name_str())
+    }
+}
+
+impl fmt::Debug for UintTy {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{}", self.name_str())
+    }
+}
+
+impl fmt::Debug for FloatTy {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{}", self.name_str())
+    }
+}
diff --git a/compiler/rustc_type_ir/src/sty.rs b/compiler/rustc_type_ir/src/sty.rs
index f7344bacc02..fa18f921ee4 100644
--- a/compiler/rustc_type_ir/src/sty.rs
+++ b/compiler/rustc_type_ir/src/sty.rs
@@ -294,7 +294,7 @@ impl<I: Interner> Clone for TyKind<I> {
             Str => Str,
             Array(t, c) => Array(t.clone(), c.clone()),
             Slice(t) => Slice(t.clone()),
-            RawPtr(t) => RawPtr(t.clone()),
+            RawPtr(p) => RawPtr(p.clone()),
             Ref(r, t, m) => Ref(r.clone(), t.clone(), m.clone()),
             FnDef(d, s) => FnDef(d.clone(), s.clone()),
             FnPtr(s) => FnPtr(s.clone()),
@@ -499,33 +499,65 @@ impl<I: Interner> hash::Hash for TyKind<I> {
 impl<I: Interner> fmt::Debug for TyKind<I> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
-            Bool => f.write_str("Bool"),
-            Char => f.write_str("Char"),
-            Int(i) => f.debug_tuple_field1_finish("Int", i),
-            Uint(u) => f.debug_tuple_field1_finish("Uint", u),
-            Float(float) => f.debug_tuple_field1_finish("Float", float),
+            Bool => write!(f, "bool"),
+            Char => write!(f, "char"),
+            Int(i) => write!(f, "{i:?}"),
+            Uint(u) => write!(f, "{u:?}"),
+            Float(float) => write!(f, "{float:?}"),
             Adt(d, s) => f.debug_tuple_field2_finish("Adt", d, s),
             Foreign(d) => f.debug_tuple_field1_finish("Foreign", d),
-            Str => f.write_str("Str"),
-            Array(t, c) => f.debug_tuple_field2_finish("Array", t, c),
-            Slice(t) => f.debug_tuple_field1_finish("Slice", t),
-            RawPtr(t) => f.debug_tuple_field1_finish("RawPtr", t),
-            Ref(r, t, m) => f.debug_tuple_field3_finish("Ref", r, t, m),
+            Str => write!(f, "str"),
+            Array(t, c) => write!(f, "[{t:?}; {c:?}]"),
+            Slice(t) => write!(f, "[{t:?}]"),
+            RawPtr(p) => {
+                let (ty, mutbl) = I::ty_and_mut_to_parts(p.clone());
+                match I::mutability_is_mut(mutbl) {
+                    true => write!(f, "*mut "),
+                    false => write!(f, "*const "),
+                }?;
+                write!(f, "{ty:?}")
+            }
+            Ref(r, t, m) => match I::mutability_is_mut(m.clone()) {
+                true => write!(f, "&{r:?} mut {t:?}"),
+                false => write!(f, "&{r:?} {t:?}"),
+            },
             FnDef(d, s) => f.debug_tuple_field2_finish("FnDef", d, s),
-            FnPtr(s) => f.debug_tuple_field1_finish("FnPtr", s),
-            Dynamic(p, r, repr) => f.debug_tuple_field3_finish("Dynamic", p, r, repr),
+            FnPtr(s) => write!(f, "{s:?}"),
+            Dynamic(p, r, repr) => match repr {
+                DynKind::Dyn => write!(f, "dyn {p:?} + {r:?}"),
+                DynKind::DynStar => write!(f, "dyn* {p:?} + {r:?}"),
+            },
             Closure(d, s) => f.debug_tuple_field2_finish("Closure", d, s),
             Generator(d, s, m) => f.debug_tuple_field3_finish("Generator", d, s, m),
             GeneratorWitness(g) => f.debug_tuple_field1_finish("GeneratorWitness", g),
             GeneratorWitnessMIR(d, s) => f.debug_tuple_field2_finish("GeneratorWitnessMIR", d, s),
-            Never => f.write_str("Never"),
-            Tuple(t) => f.debug_tuple_field1_finish("Tuple", t),
+            Never => write!(f, "!"),
+            Tuple(t) => {
+                let mut iter = t.clone().into_iter();
+
+                write!(f, "(")?;
+
+                match iter.next() {
+                    None => return write!(f, ")"),
+                    Some(ty) => write!(f, "{ty:?}")?,
+                };
+
+                match iter.next() {
+                    None => return write!(f, ",)"),
+                    Some(ty) => write!(f, "{ty:?})")?,
+                }
+
+                for ty in iter {
+                    write!(f, ", {ty:?}")?;
+                }
+                write!(f, ")")
+            }
             Alias(i, a) => f.debug_tuple_field2_finish("Alias", i, a),
-            Param(p) => f.debug_tuple_field1_finish("Param", p),
-            Bound(d, b) => f.debug_tuple_field2_finish("Bound", d, b),
-            Placeholder(p) => f.debug_tuple_field1_finish("Placeholder", p),
-            Infer(t) => f.debug_tuple_field1_finish("Infer", t),
-            TyKind::Error(e) => f.debug_tuple_field1_finish("Error", e),
+            Param(p) => write!(f, "{p:?}"),
+            Bound(d, b) => crate::debug_bound_var(f, *d, b),
+            Placeholder(p) => write!(f, "{p:?}"),
+            Infer(t) => write!(f, "{t:?}"),
+            TyKind::Error(_) => write!(f, "{{type error}}"),
         }
     }
 }
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index be3a5d3aa0f..3e9bf18a287 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -10,8 +10,8 @@ use std::path::{Path, PathBuf};
 
 const ENTRY_LIMIT: usize = 900;
 // FIXME: The following limits should be reduced eventually.
-const ISSUES_ENTRY_LIMIT: usize = 1920;
-const ROOT_ENTRY_LIMIT: usize = 896;
+const ISSUES_ENTRY_LIMIT: usize = 1898;
+const ROOT_ENTRY_LIMIT: usize = 894;
 
 const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
     "rs",     // test source files
diff --git a/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs b/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs
new file mode 100644
index 00000000000..e7d91235e73
--- /dev/null
+++ b/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs
@@ -0,0 +1,90 @@
+// force-host
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
+
+#[proc_macro]
+pub fn expand(_: TokenStream) -> TokenStream {
+    // Hand expansion/rewriting of
+    // ```
+    // quote! {
+    //     output_mut(|o| o.copied_text = "".into());
+    //     output_mut(|o| o.copied_text = format!("{:?}", self.tile_db));
+    // }.into()
+    // ```
+    stream([
+        ident("output_mut"),
+        group(
+            Delimiter::Parenthesis,
+            [
+                or(),
+                ident("o"),
+                or(),
+                ident("o"),
+                dot(),
+                ident("copied_text"),
+                eq(),
+                string(""),
+                dot(),
+                ident("into"),
+                group(Delimiter::Parenthesis, []),
+            ],
+        ),
+        semi(),
+        ident("output_mut"),
+        group(
+            Delimiter::Parenthesis,
+            [
+                or(),
+                ident("o"),
+                or(),
+                ident("o"),
+                dot(),
+                ident("copied_text"),
+                eq(),
+                ident("format"),
+                bang(),
+                group(
+                    Delimiter::Parenthesis,
+                    [string("{:?}"), comma(), ident("self"), dot(), ident("tile_db")],
+                ),
+            ],
+        ),
+        semi(),
+    ])
+}
+
+fn stream(s: impl IntoIterator<Item = TokenTree>) -> TokenStream {
+    s.into_iter().collect()
+}
+
+fn ident(i: &str) -> TokenTree {
+    TokenTree::Ident(Ident::new(i, Span::call_site()))
+}
+fn group(d: Delimiter, s: impl IntoIterator<Item = TokenTree>) -> TokenTree {
+    TokenTree::Group(Group::new(d, s.into_iter().collect()))
+}
+fn semi() -> TokenTree {
+    TokenTree::Punct(Punct::new(';', Spacing::Alone))
+}
+fn or() -> TokenTree {
+    TokenTree::Punct(Punct::new('|', Spacing::Alone))
+}
+fn dot() -> TokenTree {
+    TokenTree::Punct(Punct::new('.', Spacing::Alone))
+}
+fn eq() -> TokenTree {
+    TokenTree::Punct(Punct::new('=', Spacing::Alone))
+}
+fn bang() -> TokenTree {
+    TokenTree::Punct(Punct::new('!', Spacing::Alone))
+}
+fn comma() -> TokenTree {
+    TokenTree::Punct(Punct::new(',', Spacing::Alone))
+}
+fn string(s: &str) -> TokenTree {
+    TokenTree::Literal(Literal::string(s))
+}
diff --git a/tests/incremental/issue-110457-same-span-closures/main.rs b/tests/incremental/issue-110457-same-span-closures/main.rs
new file mode 100644
index 00000000000..b44fda3d36a
--- /dev/null
+++ b/tests/incremental/issue-110457-same-span-closures/main.rs
@@ -0,0 +1,47 @@
+// aux-build: egui_inspect_derive.rs
+// revisions: cpass1 cpass2
+
+extern crate egui_inspect_derive;
+
+pub struct TileDef {
+    pub layer: (),
+    #[cfg(cpass2)]
+    pub blend_graphic: String,
+}
+
+pub(crate) struct GameState {
+    pub(crate) tile_db: TileDb,
+}
+
+impl GameState {
+    fn inspect_mut(&mut self) {
+        egui_inspect_derive::expand! {}
+    }
+}
+
+fn new() -> GameState {
+    loop {}
+}
+
+fn main() {
+    let mut app = new();
+    app.inspect_mut();
+}
+// this is actually used
+pub struct TileDb {
+    unknown_bg: TileDef,
+}
+
+impl std::fmt::Debug for TileDb {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        loop {}
+    }
+}
+
+pub struct PlatformOutput {
+    pub copied_text: String,
+}
+
+pub fn output_mut<R>(writer: impl FnOnce(&mut PlatformOutput) -> R) -> R {
+    loop {}
+}
diff --git a/tests/ui/issues/issue-78115.rs b/tests/ui/async-await/issue-78115.rs
index ac18470c621..ac18470c621 100644
--- a/tests/ui/issues/issue-78115.rs
+++ b/tests/ui/async-await/issue-78115.rs
diff --git a/tests/ui/issues/issue-3794.rs b/tests/ui/coercion/issue-3794.rs
index b1f028fbccb..b1f028fbccb 100644
--- a/tests/ui/issues/issue-3794.rs
+++ b/tests/ui/coercion/issue-3794.rs
diff --git a/tests/ui/issues/issue-16538.mir.stderr b/tests/ui/consts/issue-16538.mir.stderr
index e320df4b7ad..e320df4b7ad 100644
--- a/tests/ui/issues/issue-16538.mir.stderr
+++ b/tests/ui/consts/issue-16538.mir.stderr
diff --git a/tests/ui/issues/issue-16538.rs b/tests/ui/consts/issue-16538.rs
index 270fa301414..270fa301414 100644
--- a/tests/ui/issues/issue-16538.rs
+++ b/tests/ui/consts/issue-16538.rs
diff --git a/tests/ui/issues/issue-16538.thir.stderr b/tests/ui/consts/issue-16538.thir.stderr
index 4a862869274..4a862869274 100644
--- a/tests/ui/issues/issue-16538.thir.stderr
+++ b/tests/ui/consts/issue-16538.thir.stderr
diff --git a/tests/ui/issues/issue-28822.rs b/tests/ui/consts/issue-28822.rs
index 10e5d1dd0ac..10e5d1dd0ac 100644
--- a/tests/ui/issues/issue-28822.rs
+++ b/tests/ui/consts/issue-28822.rs
diff --git a/tests/ui/issues/issue-29798.rs b/tests/ui/consts/issue-29798.rs
index 5eff5d1915b..5eff5d1915b 100644
--- a/tests/ui/issues/issue-29798.rs
+++ b/tests/ui/consts/issue-29798.rs
diff --git a/tests/ui/issues/issue-50689.rs b/tests/ui/enum-discriminant/issue-50689.rs
index b49f2950020..b49f2950020 100644
--- a/tests/ui/issues/issue-50689.rs
+++ b/tests/ui/enum-discriminant/issue-50689.rs
diff --git a/tests/ui/issues/issue-1251.rs b/tests/ui/extern/issue-1251.rs
index c2c047c7961..c2c047c7961 100644
--- a/tests/ui/issues/issue-1251.rs
+++ b/tests/ui/extern/issue-1251.rs
diff --git a/tests/ui/issues/issue-1257.rs b/tests/ui/for-loop-while/issue-1257.rs
index de5a6d35925..de5a6d35925 100644
--- a/tests/ui/issues/issue-1257.rs
+++ b/tests/ui/for-loop-while/issue-1257.rs
diff --git a/tests/ui/impl-trait/autoderef.rs b/tests/ui/impl-trait/autoderef.rs
index 5e4f4995447..0d07a549640 100644
--- a/tests/ui/impl-trait/autoderef.rs
+++ b/tests/ui/impl-trait/autoderef.rs
@@ -1,3 +1,5 @@
+// revisions: current next
+//[next] compile-flag: -Ztrait-solver=next
 // check-pass
 
 use std::path::Path;
diff --git a/tests/ui/mismatched_types/E0053.stderr b/tests/ui/mismatched_types/E0053.stderr
index 154f2fcbee0..d0bd5b46cf5 100644
--- a/tests/ui/mismatched_types/E0053.stderr
+++ b/tests/ui/mismatched_types/E0053.stderr
@@ -22,7 +22,7 @@ LL |     fn bar(&mut self) { }
    |            ^^^^^^^^^
    |            |
    |            types differ in mutability
-   |            help: change the self-receiver type to match the trait: `self: &Bar`
+   |            help: change the self-receiver type to match the trait: `&self`
    |
 note: type in trait
   --> $DIR/E0053.rs:3:12
diff --git a/tests/ui/mismatched_types/issue-112036.rs b/tests/ui/mismatched_types/issue-112036.rs
new file mode 100644
index 00000000000..e63471e9747
--- /dev/null
+++ b/tests/ui/mismatched_types/issue-112036.rs
@@ -0,0 +1,7 @@
+struct Foo;
+
+impl Drop for Foo {
+    fn drop(self) {} //~ ERROR method `drop` has an incompatible type for trait
+}
+
+fn main() {}
diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr
new file mode 100644
index 00000000000..a883aba35bf
--- /dev/null
+++ b/tests/ui/mismatched_types/issue-112036.stderr
@@ -0,0 +1,15 @@
+error[E0053]: method `drop` has an incompatible type for trait
+  --> $DIR/issue-112036.rs:4:13
+   |
+LL |     fn drop(self) {}
+   |             ^^^^
+   |             |
+   |             expected `&mut Foo`, found `Foo`
+   |             help: change the self-receiver type to match the trait: `&mut self`
+   |
+   = note: expected signature `fn(&mut Foo)`
+              found signature `fn(Foo)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/tests/ui/issue-94866.rs b/tests/ui/pattern/issue-94866.rs
index c4203487936..c4203487936 100644
--- a/tests/ui/issue-94866.rs
+++ b/tests/ui/pattern/issue-94866.rs
diff --git a/tests/ui/issue-94866.stderr b/tests/ui/pattern/issue-94866.stderr
index b3c17ce8974..b3c17ce8974 100644
--- a/tests/ui/issue-94866.stderr
+++ b/tests/ui/pattern/issue-94866.stderr
diff --git a/tests/ui/issues/issue-3008-1.rs b/tests/ui/structs-enums/issue-3008-1.rs
index 1124969e6d0..1124969e6d0 100644
--- a/tests/ui/issues/issue-3008-1.rs
+++ b/tests/ui/structs-enums/issue-3008-1.rs
diff --git a/tests/ui/issues/issue-3008-1.stderr b/tests/ui/structs-enums/issue-3008-1.stderr
index be25b9091d5..be25b9091d5 100644
--- a/tests/ui/issues/issue-3008-1.stderr
+++ b/tests/ui/structs-enums/issue-3008-1.stderr
diff --git a/tests/ui/issues/issue-3008-2.rs b/tests/ui/structs-enums/issue-3008-2.rs
index 5846c69da41..5846c69da41 100644
--- a/tests/ui/issues/issue-3008-2.rs
+++ b/tests/ui/structs-enums/issue-3008-2.rs
diff --git a/tests/ui/issues/issue-3008-2.stderr b/tests/ui/structs-enums/issue-3008-2.stderr
index 858a8fd6af8..858a8fd6af8 100644
--- a/tests/ui/issues/issue-3008-2.stderr
+++ b/tests/ui/structs-enums/issue-3008-2.stderr
diff --git a/tests/ui/issues/issue-3008-3.rs b/tests/ui/structs-enums/issue-3008-3.rs
index 212eb2eb8e0..212eb2eb8e0 100644
--- a/tests/ui/issues/issue-3008-3.rs
+++ b/tests/ui/structs-enums/issue-3008-3.rs
diff --git a/tests/ui/issues/issue-3008-3.stderr b/tests/ui/structs-enums/issue-3008-3.stderr
index a1a81e29367..a1a81e29367 100644
--- a/tests/ui/issues/issue-3008-3.stderr
+++ b/tests/ui/structs-enums/issue-3008-3.stderr
diff --git a/tests/ui/thir-print/thir-flat.stdout b/tests/ui/thir-print/thir-flat.stdout
index 9d467f73d09..b0aa44b56aa 100644
--- a/tests/ui/thir-print/thir-flat.stdout
+++ b/tests/ui/thir-print/thir-flat.stdout
@@ -1,7 +1,7 @@
 DefId(0:3 ~ thir_flat[7b97]::main):
 Thir {
     body_type: Fn(
-        ([]; c_variadic: false)->(),
+        fn(),
     ),
     arms: [],
     blocks: [
diff --git a/tests/ui/issues/issue-1871.rs b/tests/ui/typeck/issue-1871.rs
index f7a2bdd5659..f7a2bdd5659 100644
--- a/tests/ui/issues/issue-1871.rs
+++ b/tests/ui/typeck/issue-1871.rs
diff --git a/tests/ui/issues/issue-1871.stderr b/tests/ui/typeck/issue-1871.stderr
index b774ca22dd7..b774ca22dd7 100644
--- a/tests/ui/issues/issue-1871.stderr
+++ b/tests/ui/typeck/issue-1871.stderr
diff --git a/tests/ui/issues/issue-2063-resource.rs b/tests/ui/typeck/issue-2063-resource.rs
index 1d0527447ba..1d0527447ba 100644
--- a/tests/ui/issues/issue-2063-resource.rs
+++ b/tests/ui/typeck/issue-2063-resource.rs
diff --git a/tests/ui/issues/issue-2063.rs b/tests/ui/typeck/issue-2063.rs
index f08f9d4cfe4..f08f9d4cfe4 100644
--- a/tests/ui/issues/issue-2063.rs
+++ b/tests/ui/typeck/issue-2063.rs
diff --git a/tests/ui/issues/issue-50825-1.rs b/tests/ui/where-clauses/issue-50825-1.rs
index ee4316029a8..ee4316029a8 100644
--- a/tests/ui/issues/issue-50825-1.rs
+++ b/tests/ui/where-clauses/issue-50825-1.rs
diff --git a/tests/ui/issues/issue-50825.rs b/tests/ui/where-clauses/issue-50825.rs
index 1ece2e9fc84..1ece2e9fc84 100644
--- a/tests/ui/issues/issue-50825.rs
+++ b/tests/ui/where-clauses/issue-50825.rs