about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs28
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs4
-rw-r--r--compiler/rustc_ty_utils/src/ty.rs6
-rw-r--r--tests/crashes/124350.rs17
-rw-r--r--tests/crashes/125758.rs26
-rw-r--r--tests/crashes/127351.rs17
-rw-r--r--tests/crashes/127353.rs18
-rw-r--r--tests/crashes/127742.rs11
-rw-r--r--tests/crashes/130521.rs2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/bad-multiply.rs18
-rw-r--r--tests/ui/const-generics/generic_const_exprs/bad-multiply.stderr18
-rw-r--r--tests/ui/const-generics/kind_mismatch.rs1
-rw-r--r--tests/ui/const-generics/kind_mismatch.stderr24
-rw-r--r--tests/ui/generic-associated-types/issue-71176.rs4
-rw-r--r--tests/ui/generic-associated-types/issue-71176.stderr19
-rw-r--r--tests/ui/layout/ice-type-error-in-tail-124031.rs3
-rw-r--r--tests/ui/layout/ice-type-error-in-tail-124031.stderr16
-rw-r--r--tests/ui/lazy-type-alias/bad-lazy-type-alias.rs18
-rw-r--r--tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr28
-rw-r--r--tests/ui/nll/user-annotations/region-error-ice-109072.rs1
-rw-r--r--tests/ui/nll/user-annotations/region-error-ice-109072.stderr11
-rw-r--r--tests/ui/specialization/issue-68830-spurious-diagnostics.rs1
-rw-r--r--tests/ui/specialization/issue-68830-spurious-diagnostics.stderr14
-rw-r--r--tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.rs1
-rw-r--r--tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.stderr16
-rw-r--r--tests/ui/traits/issue-78372.rs1
-rw-r--r--tests/ui/traits/issue-78372.stderr24
-rw-r--r--tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.rs1
-rw-r--r--tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr25
-rw-r--r--tests/ui/traits/span-bug-issue-121414.rs3
-rw-r--r--tests/ui/traits/span-bug-issue-121414.stderr20
-rw-r--r--tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs21
-rw-r--r--tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr86
-rw-r--r--tests/ui/type-alias-impl-trait/bad-transmute-itiat.rs22
-rw-r--r--tests/ui/type-alias-impl-trait/bad-transmute-itiat.stderr10
-rw-r--r--tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs (renamed from tests/crashes/130956.rs)5
-rw-r--r--tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr10
-rw-r--r--tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs1
-rw-r--r--tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr17
39 files changed, 328 insertions, 240 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
index 345e1cc31f3..41d430f06df 100644
--- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
@@ -91,14 +91,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             } else if tcx.is_lang_item(def_id, LangItem::Sized) {
                 // Sized is never implementable by end-users, it is
                 // always automatically computed.
-
-                // FIXME: Consider moving this check to the top level as it
-                // may also be useful for predicates other than `Sized`
-                // Error type cannot possibly implement `Sized` (fixes #123154)
-                if let Err(e) = obligation.predicate.skip_binder().self_ty().error_reported() {
-                    return Err(SelectionError::Overflow(e.into()));
-                }
-
                 let sized_conditions = self.sized_conditions(obligation);
                 self.assemble_builtin_bound_candidates(sized_conditions, &mut candidates);
             } else if tcx.is_lang_item(def_id, LangItem::Unsize) {
@@ -230,13 +222,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
     ) -> Result<(), SelectionError<'tcx>> {
         debug!(?stack.obligation);
 
-        // An error type will unify with anything. So, avoid
-        // matching an error type with `ParamCandidate`.
-        // This helps us avoid spurious errors like issue #121941.
-        if stack.obligation.predicate.references_error() {
-            return Ok(());
-        }
-
         let bounds = stack
             .obligation
             .param_env
@@ -563,19 +548,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         obligation: &PolyTraitObligation<'tcx>,
         candidates: &mut SelectionCandidateSet<'tcx>,
     ) {
-        // Essentially any user-written impl will match with an error type,
-        // so creating `ImplCandidates` isn't useful. However, we might
-        // end up finding a candidate elsewhere (e.g. a `BuiltinCandidate` for `Sized`)
-        // This helps us avoid overflow: see issue #72839
-        // Since compilation is already guaranteed to fail, this is just
-        // to try to show the 'nicest' possible errors to the user.
-        // We don't check for errors in the `ParamEnv` - in practice,
-        // it seems to cause us to be overly aggressive in deciding
-        // to give up searching for candidates, leading to spurious errors.
-        if obligation.predicate.references_error() {
-            return;
-        }
-
         let drcx = DeepRejectCtxt::relate_rigid_infer(self.tcx());
         let obligation_args = obligation.predicate.skip_binder().trait_ref.args;
         self.tcx().for_each_relevant_impl(
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 5b4e895189b..e0c862a81f3 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -2487,10 +2487,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
         let impl_args = self.infcx.fresh_args_for_item(obligation.cause.span, impl_def_id);
 
         let trait_ref = impl_trait_header.trait_ref.instantiate(self.tcx(), impl_args);
-        if trait_ref.references_error() {
-            return Err(());
-        }
-
         debug!(?impl_trait_header);
 
         let Normalized { value: impl_trait_ref, obligations: mut nested_obligations } =
diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs
index 2127ba8a423..292e777f288 100644
--- a/compiler/rustc_ty_utils/src/ty.rs
+++ b/compiler/rustc_ty_utils/src/ty.rs
@@ -6,8 +6,7 @@ use rustc_index::bit_set::BitSet;
 use rustc_middle::bug;
 use rustc_middle::query::Providers;
 use rustc_middle::ty::{
-    self, EarlyBinder, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
-    TypeVisitor, Upcast,
+    self, EarlyBinder, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, Upcast,
 };
 use rustc_span::DUMMY_SP;
 use rustc_span::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
@@ -95,9 +94,6 @@ fn adt_sized_constraint<'tcx>(
     let tail_ty = tcx.type_of(tail_def.did).instantiate_identity();
 
     let constraint_ty = sized_constraint_for_ty(tcx, tail_ty)?;
-    if let Err(guar) = constraint_ty.error_reported() {
-        return Some(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)));
-    }
 
     // perf hack: if there is a `constraint_ty: Sized` bound, then we know
     // that the type is sized and do not need to check it on the impl.
diff --git a/tests/crashes/124350.rs b/tests/crashes/124350.rs
deleted file mode 100644
index d6038f280cf..00000000000
--- a/tests/crashes/124350.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//@ known-bug: #124350
-
-struct Node<const D: usize> {}
-
-impl Node<D>
-where
-    SmallVec<{ D * 2 }>:,
-{
-    fn new() -> Self {
-        let mut node = Node::new();
-        (&a, 0)();
-
-        node
-    }
-}
-
-struct SmallVec<T1, T2> {}
diff --git a/tests/crashes/125758.rs b/tests/crashes/125758.rs
deleted file mode 100644
index 86c3b80abab..00000000000
--- a/tests/crashes/125758.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-//@ known-bug: rust-lang/rust#125758
-#![feature(impl_trait_in_assoc_type)]
-
-trait Trait: Sized {
-    type Assoc2;
-}
-
-impl Trait for Bar {
-    type Assoc2 = impl std::fmt::Debug;
-}
-
-struct Foo {
-    field: <Bar as Trait>::Assoc2,
-}
-
-enum Bar {
-    C = 42,
-    D = 99,
-}
-
-static BAR: u8 = 42;
-
-static FOO2: (&Foo, &<Bar as Trait>::Assoc2) =
-    unsafe { (std::mem::transmute(&BAR), std::mem::transmute(&BAR)) };
-
-fn main() {}
diff --git a/tests/crashes/127351.rs b/tests/crashes/127351.rs
deleted file mode 100644
index e3f41594885..00000000000
--- a/tests/crashes/127351.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//@ known-bug: #127351
-#![feature(lazy_type_alias)]
-#![allow(incomplete_features)]
-
-struct Outer0<'a, T>(ExplicitTypeOutlives<'a, T>);
-type ExplicitTypeOutlives<'a, T: 'a> = (&'a (), T);
-
-pub struct Warns {
-    _significant_drop: ExplicitTypeOutlives,
-    field: String,
-}
-
-pub fn test(w: Warns) {
-    _ = || drop(w.field);
-}
-
-fn main() {}
diff --git a/tests/crashes/127353.rs b/tests/crashes/127353.rs
deleted file mode 100644
index 9bcb90b5c57..00000000000
--- a/tests/crashes/127353.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-//@ known-bug: #127353
-#![feature(type_alias_impl_trait)]
-trait Trait<T> {}
-type Alias<'a, U> = impl Trait<U>;
-
-fn f<'a>() -> Alias<'a, ()> {}
-
-pub enum UninhabitedVariants {
-    Tuple(Alias),
-}
-
-struct A;
-
-fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A {
-    match x {}
-}
-
-fn main() {}
diff --git a/tests/crashes/127742.rs b/tests/crashes/127742.rs
deleted file mode 100644
index 24add454135..00000000000
--- a/tests/crashes/127742.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ known-bug: #127742
-struct Vtable(dyn Cap);  // missing lifetime
-
-trait Cap<'a> {}
-
-union Transmute {
-    t: u64,  // ICEs with u64, u128, or usize. Correctly errors with u32.
-    u: &'static Vtable,
-}
-
-const G: &'static Vtable = unsafe { Transmute { t: 1 }.u };
diff --git a/tests/crashes/130521.rs b/tests/crashes/130521.rs
index 7c078ab5790..ccc2b444b82 100644
--- a/tests/crashes/130521.rs
+++ b/tests/crashes/130521.rs
@@ -6,7 +6,7 @@ struct Vtable(dyn Cap);
 trait Cap<'a> {}
 
 union Transmute {
-    t: u64,
+    t: u128,
     u: &'static Vtable,
 }
 
diff --git a/tests/ui/const-generics/generic_const_exprs/bad-multiply.rs b/tests/ui/const-generics/generic_const_exprs/bad-multiply.rs
new file mode 100644
index 00000000000..1af6d5742b1
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/bad-multiply.rs
@@ -0,0 +1,18 @@
+// regression test for #124350
+
+struct Node<const D: usize> {}
+
+impl<const D: usize> Node<D>
+where
+    SmallVec<{ D * 2 }>:,
+    //~^ ERROR generic parameters may not be used in const operations
+    //~| ERROR constant provided when a type was expected
+{
+    fn new() -> Self {
+        Node::new()
+    }
+}
+
+struct SmallVec<T1>(T1);
+
+fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/bad-multiply.stderr b/tests/ui/const-generics/generic_const_exprs/bad-multiply.stderr
new file mode 100644
index 00000000000..a8d6cebabe7
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/bad-multiply.stderr
@@ -0,0 +1,18 @@
+error: generic parameters may not be used in const operations
+  --> $DIR/bad-multiply.rs:7:16
+   |
+LL |     SmallVec<{ D * 2 }>:,
+   |                ^ cannot perform const operation using `D`
+   |
+   = help: const parameters may only be used as standalone arguments, i.e. `D`
+   = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
+
+error[E0747]: constant provided when a type was expected
+  --> $DIR/bad-multiply.rs:7:14
+   |
+LL |     SmallVec<{ D * 2 }>:,
+   |              ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0747`.
diff --git a/tests/ui/const-generics/kind_mismatch.rs b/tests/ui/const-generics/kind_mismatch.rs
index bab58d5952a..ecdc01a5ef9 100644
--- a/tests/ui/const-generics/kind_mismatch.rs
+++ b/tests/ui/const-generics/kind_mismatch.rs
@@ -20,5 +20,4 @@ pub fn remove_key<K, S: SubsetExcept<K>>() -> S {
 
 fn main() {
     let map: KeyHolder<0> = remove_key::<_, _>();
-    //~^ ERROR: the trait bound `KeyHolder<0>: SubsetExcept<_>` is not satisfied
 }
diff --git a/tests/ui/const-generics/kind_mismatch.stderr b/tests/ui/const-generics/kind_mismatch.stderr
index e13bc6ee058..1487b189619 100644
--- a/tests/ui/const-generics/kind_mismatch.stderr
+++ b/tests/ui/const-generics/kind_mismatch.stderr
@@ -14,26 +14,6 @@ LL | impl<K> ContainsKey<K> for KeyHolder<K> {}
    |      |
    |      help: consider changing this type parameter to a const parameter: `const K: u8`
 
-error[E0277]: the trait bound `KeyHolder<0>: SubsetExcept<_>` is not satisfied
-  --> $DIR/kind_mismatch.rs:22:45
-   |
-LL |     let map: KeyHolder<0> = remove_key::<_, _>();
-   |                                             ^ the trait `ContainsKey<0>` is not implemented for `KeyHolder<0>`
-   |
-note: required for `KeyHolder<0>` to implement `SubsetExcept<_>`
-  --> $DIR/kind_mismatch.rs:15:28
-   |
-LL | impl<P, T: ContainsKey<0>> SubsetExcept<P> for T {}
-   |            --------------  ^^^^^^^^^^^^^^^     ^
-   |            |
-   |            unsatisfied trait bound introduced here
-note: required by a bound in `remove_key`
-  --> $DIR/kind_mismatch.rs:17:25
-   |
-LL | pub fn remove_key<K, S: SubsetExcept<K>>() -> S {
-   |                         ^^^^^^^^^^^^^^^ required by this bound in `remove_key`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0277, E0747.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0747`.
diff --git a/tests/ui/generic-associated-types/issue-71176.rs b/tests/ui/generic-associated-types/issue-71176.rs
index b33fda8e154..7fffe312f4b 100644
--- a/tests/ui/generic-associated-types/issue-71176.rs
+++ b/tests/ui/generic-associated-types/issue-71176.rs
@@ -16,6 +16,8 @@ struct Holder<B> {
 
 fn main() {
     Holder {
-        inner: Box::new(()), //~ ERROR: the trait `Provider` cannot be made into an object
+        inner: Box::new(()),
+        //~^ ERROR: the trait `Provider` cannot be made into an object
+        //~| ERROR: the trait `Provider` cannot be made into an object
     };
 }
diff --git a/tests/ui/generic-associated-types/issue-71176.stderr b/tests/ui/generic-associated-types/issue-71176.stderr
index 15d5a3df6f2..1cd2ed0d313 100644
--- a/tests/ui/generic-associated-types/issue-71176.stderr
+++ b/tests/ui/generic-associated-types/issue-71176.stderr
@@ -80,7 +80,24 @@ LL |     type A<'a>;
    = help: consider moving `A` to another trait
    = help: only type `()` implements the trait, consider using it directly instead
 
-error: aborting due to 5 previous errors
+error[E0038]: the trait `Provider` cannot be made into an object
+  --> $DIR/issue-71176.rs:19:16
+   |
+LL |         inner: Box::new(()),
+   |                ^^^^^^^^^^^^ `Provider` cannot be made into an object
+   |
+note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+  --> $DIR/issue-71176.rs:2:10
+   |
+LL | trait Provider {
+   |       -------- this trait cannot be made into an object...
+LL |     type A<'a>;
+   |          ^ ...because it contains the generic associated type `A`
+   = help: consider moving `A` to another trait
+   = help: only type `()` implements the trait, consider using it directly instead
+   = note: required for the cast from `Box<()>` to `Box<(dyn Provider<A<'_> = _> + 'static), {type error}>`
+
+error: aborting due to 6 previous errors
 
 Some errors have detailed explanations: E0038, E0107.
 For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/ui/layout/ice-type-error-in-tail-124031.rs b/tests/ui/layout/ice-type-error-in-tail-124031.rs
index 0a2be117403..ecd6f3d56f3 100644
--- a/tests/ui/layout/ice-type-error-in-tail-124031.rs
+++ b/tests/ui/layout/ice-type-error-in-tail-124031.rs
@@ -1,3 +1,5 @@
+//@ normalize-stderr-test: "\d+ bits" -> "$$BITS bits"
+
 // Regression test for issue #124031
 // Checks that we don't ICE when the tail
 // of an ADT has a type error
@@ -16,5 +18,6 @@ struct Other {
 fn main() {
     unsafe {
         std::mem::transmute::<Option<()>, Option<&Other>>(None);
+        //~^ ERROR cannot transmute between types of different sizes
     }
 }
diff --git a/tests/ui/layout/ice-type-error-in-tail-124031.stderr b/tests/ui/layout/ice-type-error-in-tail-124031.stderr
index 57dc83f92df..a066e8574dc 100644
--- a/tests/ui/layout/ice-type-error-in-tail-124031.stderr
+++ b/tests/ui/layout/ice-type-error-in-tail-124031.stderr
@@ -1,5 +1,5 @@
 error[E0046]: not all trait items implemented, missing: `RefTarget`
-  --> $DIR/ice-type-error-in-tail-124031.rs:9:1
+  --> $DIR/ice-type-error-in-tail-124031.rs:11:1
    |
 LL |     type RefTarget;
    |     -------------- `RefTarget` from trait
@@ -7,6 +7,16 @@ LL |     type RefTarget;
 LL | impl Trait for () {}
    | ^^^^^^^^^^^^^^^^^ missing `RefTarget` in implementation
 
-error: aborting due to 1 previous error
+error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
+  --> $DIR/ice-type-error-in-tail-124031.rs:20:9
+   |
+LL |         std::mem::transmute::<Option<()>, Option<&Other>>(None);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: source type: `Option<()>` ($BITS bits)
+   = note: target type: `Option<&Other>` ($BITS bits)
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0046`.
+Some errors have detailed explanations: E0046, E0512.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/lazy-type-alias/bad-lazy-type-alias.rs b/tests/ui/lazy-type-alias/bad-lazy-type-alias.rs
new file mode 100644
index 00000000000..6ded9118700
--- /dev/null
+++ b/tests/ui/lazy-type-alias/bad-lazy-type-alias.rs
@@ -0,0 +1,18 @@
+// regression test for #127351
+
+#![feature(lazy_type_alias)]
+//~^ WARN the feature `lazy_type_alias` is incomplete
+
+type ExplicitTypeOutlives<T> = T;
+
+pub struct Warns {
+    _significant_drop: ExplicitTypeOutlives,
+    //~^ ERROR missing generics for type alias `ExplicitTypeOutlives`
+    field: String,
+}
+
+pub fn test(w: Warns) {
+    let _ = || drop(w.field);
+}
+
+fn main() {}
diff --git a/tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr b/tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr
new file mode 100644
index 00000000000..3a5ded60241
--- /dev/null
+++ b/tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr
@@ -0,0 +1,28 @@
+warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/bad-lazy-type-alias.rs:3:12
+   |
+LL | #![feature(lazy_type_alias)]
+   |            ^^^^^^^^^^^^^^^
+   |
+   = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0107]: missing generics for type alias `ExplicitTypeOutlives`
+  --> $DIR/bad-lazy-type-alias.rs:9:24
+   |
+LL |     _significant_drop: ExplicitTypeOutlives,
+   |                        ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
+   |
+note: type alias defined here, with 1 generic parameter: `T`
+  --> $DIR/bad-lazy-type-alias.rs:6:6
+   |
+LL | type ExplicitTypeOutlives<T> = T;
+   |      ^^^^^^^^^^^^^^^^^^^^ -
+help: add missing generic argument
+   |
+LL |     _significant_drop: ExplicitTypeOutlives<T>,
+   |                                            +++
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/nll/user-annotations/region-error-ice-109072.rs b/tests/ui/nll/user-annotations/region-error-ice-109072.rs
index bcdc6651cf5..3f2ad3ccbf5 100644
--- a/tests/ui/nll/user-annotations/region-error-ice-109072.rs
+++ b/tests/ui/nll/user-annotations/region-error-ice-109072.rs
@@ -11,5 +11,4 @@ impl Lt<'missing> for () { //~ ERROR undeclared lifetime
 
 fn main() {
     let _: <() as Lt<'_>>::T = &();
-    //~^ ERROR the trait bound `(): Lt<'_>` is not satisfied
 }
diff --git a/tests/ui/nll/user-annotations/region-error-ice-109072.stderr b/tests/ui/nll/user-annotations/region-error-ice-109072.stderr
index c187c17d98c..d90971bed25 100644
--- a/tests/ui/nll/user-annotations/region-error-ice-109072.stderr
+++ b/tests/ui/nll/user-annotations/region-error-ice-109072.stderr
@@ -21,13 +21,6 @@ help: consider introducing lifetime `'missing` here
 LL | impl<'missing> Lt<'missing> for () {
    |     ++++++++++
 
-error[E0277]: the trait bound `(): Lt<'_>` is not satisfied
-  --> $DIR/region-error-ice-109072.rs:13:13
-   |
-LL |     let _: <() as Lt<'_>>::T = &();
-   |             ^^ the trait `Lt<'_>` is not implemented for `()`
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0261, E0277.
-For more information about an error, try `rustc --explain E0261`.
+For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/specialization/issue-68830-spurious-diagnostics.rs b/tests/ui/specialization/issue-68830-spurious-diagnostics.rs
index a7487b8aecb..d11ec798332 100644
--- a/tests/ui/specialization/issue-68830-spurious-diagnostics.rs
+++ b/tests/ui/specialization/issue-68830-spurious-diagnostics.rs
@@ -17,7 +17,6 @@ impl<T, D> MyTrait<T> for D {
 }
 
 impl<T> MyTrait<T> for BadStruct {
-//~^ ERROR: conflicting implementations of trait `MyTrait<_>` for type `BadStruct`
     fn foo() {}
 }
 
diff --git a/tests/ui/specialization/issue-68830-spurious-diagnostics.stderr b/tests/ui/specialization/issue-68830-spurious-diagnostics.stderr
index 13f6ae0805d..0ecec03a023 100644
--- a/tests/ui/specialization/issue-68830-spurious-diagnostics.stderr
+++ b/tests/ui/specialization/issue-68830-spurious-diagnostics.stderr
@@ -4,16 +4,6 @@ error[E0412]: cannot find type `MissingType` in this scope
 LL |     err: MissingType
    |          ^^^^^^^^^^^ not found in this scope
 
-error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `BadStruct`
-  --> $DIR/issue-68830-spurious-diagnostics.rs:19:1
-   |
-LL | impl<T, D> MyTrait<T> for D {
-   | --------------------------- first implementation here
-...
-LL | impl<T> MyTrait<T> for BadStruct {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `BadStruct`
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0119, E0412.
-For more information about an error, try `rustc --explain E0119`.
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.rs b/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.rs
index a08407683d8..85c70a21f68 100644
--- a/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.rs
+++ b/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.rs
@@ -1,5 +1,6 @@
 fn function<T: PartialEq>() {
     foo == 2; //~ ERROR cannot find value `foo` in this scope [E0425]
+    //~^ ERROR mismatched types
 }
 
 fn main() {}
diff --git a/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.stderr b/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.stderr
index 2da731dcc4b..8010c0842ba 100644
--- a/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.stderr
+++ b/tests/ui/traits/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.stderr
@@ -4,6 +4,18 @@ error[E0425]: cannot find value `foo` in this scope
 LL |     foo == 2;
    |     ^^^ not found in this scope
 
-error: aborting due to 1 previous error
+error[E0308]: mismatched types
+  --> $DIR/dont-match-error-ty-with-calller-supplied-obligation-issue-121941.rs:2:12
+   |
+LL | fn function<T: PartialEq>() {
+   |             - expected this type parameter
+LL |     foo == 2;
+   |            ^ expected type parameter `T`, found integer
+   |
+   = note: expected type parameter `T`
+                        found type `{integer}`
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0425`.
+Some errors have detailed explanations: E0308, E0425.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/issue-78372.rs b/tests/ui/traits/issue-78372.rs
index 82b13cc0b62..f03baf2ceca 100644
--- a/tests/ui/traits/issue-78372.rs
+++ b/tests/ui/traits/issue-78372.rs
@@ -10,5 +10,4 @@ trait X<T> {
 }
 trait Marker {}
 impl Marker for dyn Foo {}
-//~^ ERROR cannot be made into an object
 fn main() {}
diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr
index 4cc2c59fd8d..86234d15a5d 100644
--- a/tests/ui/traits/issue-78372.stderr
+++ b/tests/ui/traits/issue-78372.stderr
@@ -55,24 +55,6 @@ LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
    = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error[E0038]: the trait `Foo` cannot be made into an object
-  --> $DIR/issue-78372.rs:12:17
-   |
-LL |     fn foo(self: Smaht<Self, T>);
-   |                  -------------- help: consider changing method `foo`'s `self` parameter to be `&self`: `&Self`
-...
-LL | impl Marker for dyn Foo {}
-   |                 ^^^^^^^ `Foo` cannot be made into an object
-   |
-note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/issue-78372.rs:9:18
-   |
-LL | trait Foo: X<u32> {}
-   |       --- this trait cannot be made into an object...
-LL | trait X<T> {
-LL |     fn foo(self: Smaht<Self, T>);
-   |                  ^^^^^^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
-
 error[E0307]: invalid `self` parameter type: `Smaht<Self, T>`
   --> $DIR/issue-78372.rs:9:18
    |
@@ -88,7 +70,7 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion
 LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 8 previous errors
+error: aborting due to 7 previous errors
 
-Some errors have detailed explanations: E0038, E0307, E0378, E0412, E0658.
-For more information about an error, try `rustc --explain E0038`.
+Some errors have detailed explanations: E0307, E0378, E0412, E0658.
+For more information about an error, try `rustc --explain E0307`.
diff --git a/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.rs b/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.rs
index 3af299e5b11..4aadd45c49c 100644
--- a/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.rs
+++ b/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.rs
@@ -10,6 +10,7 @@ fn w<'a, T: 'a, F: Fn(&'a T)>() {
     let b: &dyn FromResidual = &();
     //~^ ERROR: the trait `FromResidual` cannot be made into an object
     //~| ERROR: the trait `FromResidual` cannot be made into an object
+    //~| ERROR: the trait `FromResidual` cannot be made into an object
 }
 
 fn main() {}
diff --git a/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr b/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr
index 960802e2f8f..c67a8c05379 100644
--- a/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr
+++ b/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr
@@ -7,6 +7,29 @@ LL |     let b: &dyn FromResidual = &();
    = note: it cannot use `Self` as a type parameter in a supertrait or `where`-clause
 
 error[E0038]: the trait `FromResidual` cannot be made into an object
+  --> $DIR/canonicalize-fresh-infer-vars-issue-103626.rs:10:32
+   |
+LL |     let b: &dyn FromResidual = &();
+   |                                ^^^ `FromResidual` cannot be made into an object
+   |
+note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+  --> $DIR/canonicalize-fresh-infer-vars-issue-103626.rs:2:8
+   |
+LL | trait FromResidual<R = <Self as Try>::Residual> {
+   |       ------------ this trait cannot be made into an object...
+LL |     fn from_residual(residual: R) -> Self;
+   |        ^^^^^^^^^^^^^ ...because associated function `from_residual` has no `self` parameter
+   = note: required for the cast from `&()` to `&dyn FromResidual<{type error}>`
+help: consider turning `from_residual` into a method by giving it a `&self` argument
+   |
+LL |     fn from_residual(&self, residual: R) -> Self;
+   |                      ++++++
+help: alternatively, consider constraining `from_residual` so it does not apply to trait objects
+   |
+LL |     fn from_residual(residual: R) -> Self where Self: Sized;
+   |                                           +++++++++++++++++
+
+error[E0038]: the trait `FromResidual` cannot be made into an object
   --> $DIR/canonicalize-fresh-infer-vars-issue-103626.rs:10:12
    |
 LL |     let b: &dyn FromResidual = &();
@@ -28,6 +51,6 @@ help: alternatively, consider constraining `from_residual` so it does not apply
 LL |     fn from_residual(residual: R) -> Self where Self: Sized;
    |                                           +++++++++++++++++
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/traits/span-bug-issue-121414.rs b/tests/ui/traits/span-bug-issue-121414.rs
index ec38d8c2de6..2f4ad34f0c8 100644
--- a/tests/ui/traits/span-bug-issue-121414.rs
+++ b/tests/ui/traits/span-bug-issue-121414.rs
@@ -6,8 +6,7 @@ impl<'a> Bar for Foo<'f> { //~ ERROR undeclared lifetime
     type Type = u32;
 }
 
-fn test() //~ ERROR the trait bound `for<'a> Foo<'a>: Bar` is not satisfied
-          //~| ERROR the trait bound `for<'a> Foo<'a>: Bar` is not satisfied
+fn test()
 where
     for<'a> <Foo<'a> as Bar>::Type: Sized,
 {
diff --git a/tests/ui/traits/span-bug-issue-121414.stderr b/tests/ui/traits/span-bug-issue-121414.stderr
index e2ef6672cd5..744806a3415 100644
--- a/tests/ui/traits/span-bug-issue-121414.stderr
+++ b/tests/ui/traits/span-bug-issue-121414.stderr
@@ -6,22 +6,6 @@ LL | impl<'a> Bar for Foo<'f> {
    |      |
    |      help: consider introducing lifetime `'f` here: `'f,`
 
-error[E0277]: the trait bound `for<'a> Foo<'a>: Bar` is not satisfied
-  --> $DIR/span-bug-issue-121414.rs:9:1
-   |
-LL | / fn test()
-LL | |
-LL | | where
-LL | |     for<'a> <Foo<'a> as Bar>::Type: Sized,
-   | |__________________________________________^ the trait `for<'a> Bar` is not implemented for `Foo<'a>`
-
-error[E0277]: the trait bound `for<'a> Foo<'a>: Bar` is not satisfied
-  --> $DIR/span-bug-issue-121414.rs:9:4
-   |
-LL | fn test()
-   |    ^^^^ the trait `for<'a> Bar` is not implemented for `Foo<'a>`
-
-error: aborting due to 3 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0261, E0277.
-For more information about an error, try `rustc --explain E0261`.
+For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
new file mode 100644
index 00000000000..18cfb1c1f93
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.rs
@@ -0,0 +1,21 @@
+// regression test for #127353
+
+#![feature(type_alias_impl_trait)]
+trait Trait<T> {}
+type Alias<'a, U> = impl Trait<U>;
+//~^ ERROR unconstrained opaque type
+
+pub enum UninhabitedVariants {
+    Tuple(Alias),
+    //~^ ERROR missing lifetime specifier
+    //~| ERROR missing generics
+    //~| ERROR non-defining opaque type use in defining scope
+}
+
+fn uwu(x: UninhabitedVariants) {
+    //~^ ERROR item does not constrain
+    match x {}
+    //~^ ERROR non-exhaustive patterns
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
new file mode 100644
index 00000000000..cf366c55ea8
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/bad-tait-no-substs.stderr
@@ -0,0 +1,86 @@
+error[E0106]: missing lifetime specifier
+  --> $DIR/bad-tait-no-substs.rs:9:11
+   |
+LL |     Tuple(Alias),
+   |           ^^^^^ expected named lifetime parameter
+   |
+help: consider introducing a named lifetime parameter
+   |
+LL ~ pub enum UninhabitedVariants<'a> {
+LL ~     Tuple(Alias<'a>),
+   |
+
+error[E0107]: missing generics for type alias `Alias`
+  --> $DIR/bad-tait-no-substs.rs:9:11
+   |
+LL |     Tuple(Alias),
+   |           ^^^^^ expected 1 generic argument
+   |
+note: type alias defined here, with 1 generic parameter: `U`
+  --> $DIR/bad-tait-no-substs.rs:5:6
+   |
+LL | type Alias<'a, U> = impl Trait<U>;
+   |      ^^^^^     -
+help: add missing generic argument
+   |
+LL |     Tuple(Alias<U>),
+   |                +++
+
+error[E0792]: non-defining opaque type use in defining scope
+  --> $DIR/bad-tait-no-substs.rs:9:11
+   |
+LL |     Tuple(Alias),
+   |           ^^^^^ argument `'_` is not a generic parameter
+   |
+note: for this opaque type
+  --> $DIR/bad-tait-no-substs.rs:5:21
+   |
+LL | type Alias<'a, U> = impl Trait<U>;
+   |                     ^^^^^^^^^^^^^
+
+error: item does not constrain `Alias::{opaque#0}`, but has it in its signature
+  --> $DIR/bad-tait-no-substs.rs:15:4
+   |
+LL | fn uwu(x: UninhabitedVariants) {
+   |    ^^^
+   |
+   = note: consider moving the opaque type's declaration and defining uses into a separate module
+note: this opaque type is in the signature
+  --> $DIR/bad-tait-no-substs.rs:5:21
+   |
+LL | type Alias<'a, U> = impl Trait<U>;
+   |                     ^^^^^^^^^^^^^
+
+error: unconstrained opaque type
+  --> $DIR/bad-tait-no-substs.rs:5:21
+   |
+LL | type Alias<'a, U> = impl Trait<U>;
+   |                     ^^^^^^^^^^^^^
+   |
+   = note: `Alias` must be used in combination with a concrete type within the same module
+
+error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` not covered
+  --> $DIR/bad-tait-no-substs.rs:17:11
+   |
+LL |     match x {}
+   |           ^ pattern `UninhabitedVariants::Tuple(_)` not covered
+   |
+note: `UninhabitedVariants` defined here
+  --> $DIR/bad-tait-no-substs.rs:8:10
+   |
+LL | pub enum UninhabitedVariants {
+   |          ^^^^^^^^^^^^^^^^^^^
+LL |     Tuple(Alias),
+   |     ----- not covered
+   = note: the matched value is of type `UninhabitedVariants`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+   |
+LL ~     match x {
+LL +         UninhabitedVariants::Tuple(_) => todo!(),
+LL +     }
+   |
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0004, E0106, E0107, E0792.
+For more information about an error, try `rustc --explain E0004`.
diff --git a/tests/ui/type-alias-impl-trait/bad-transmute-itiat.rs b/tests/ui/type-alias-impl-trait/bad-transmute-itiat.rs
new file mode 100644
index 00000000000..8314b28eeac
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/bad-transmute-itiat.rs
@@ -0,0 +1,22 @@
+// regression test for rust-lang/rust#125758
+
+#![feature(impl_trait_in_assoc_type)]
+
+trait Trait {
+    type Assoc2;
+}
+
+struct Bar;
+impl Trait for Bar {
+    type Assoc2 = impl std::fmt::Debug;
+    //~^ ERROR unconstrained opaque type
+}
+
+struct Foo {
+    field: <Bar as Trait>::Assoc2,
+}
+
+static BAR: u8 = 42;
+static FOO2: &Foo = unsafe { std::mem::transmute(&BAR) };
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/bad-transmute-itiat.stderr b/tests/ui/type-alias-impl-trait/bad-transmute-itiat.stderr
new file mode 100644
index 00000000000..6cbf6c83ff4
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/bad-transmute-itiat.stderr
@@ -0,0 +1,10 @@
+error: unconstrained opaque type
+  --> $DIR/bad-transmute-itiat.rs:11:19
+   |
+LL |     type Assoc2 = impl std::fmt::Debug;
+   |                   ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `Assoc2` must be used in combination with a concrete type within the same impl
+
+error: aborting due to 1 previous error
+
diff --git a/tests/crashes/130956.rs b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs
index ebb986d123f..4332f1264a8 100644
--- a/tests/crashes/130956.rs
+++ b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.rs
@@ -1,8 +1,11 @@
-//@ known-bug: #130956
+// Regression test for #130956
+
+#![feature(type_alias_impl_trait)]
 
 mod impl_trait_mod {
     use super::*;
     pub type OpaqueBlock = impl Trait;
+    //~^ ERROR unconstrained opaque type
     pub type OpaqueIf = impl Trait;
 
     pub struct BlockWrapper(OpaqueBlock);
diff --git a/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr
new file mode 100644
index 00000000000..8e5838d5ddf
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/drop-analysis-on-unconstrained-tait.stderr
@@ -0,0 +1,10 @@
+error: unconstrained opaque type
+  --> $DIR/drop-analysis-on-unconstrained-tait.rs:7:28
+   |
+LL |     pub type OpaqueBlock = impl Trait;
+   |                            ^^^^^^^^^^
+   |
+   = note: `OpaqueBlock` must be used in combination with a concrete type within the same module
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs
index e6d4e2ee01a..0be5127dcc4 100644
--- a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs
+++ b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.rs
@@ -14,5 +14,4 @@ impl Trait for Ref {} //~ ERROR:  implicit elided lifetime not allowed here
 
 extern "C" {
     pub fn repro(_: Wrapper<Ref>);
-    //~^ ERROR the trait bound `Ref<'_>: Trait` is not satisfied
 }
diff --git a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr
index 59b55b2732d..0af4ab022e1 100644
--- a/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr
+++ b/tests/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr
@@ -9,19 +9,6 @@ help: indicate the anonymous lifetime
 LL | impl Trait for Ref<'_> {}
    |                   ++++
 
-error[E0277]: the trait bound `Ref<'_>: Trait` is not satisfied
-  --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:16:21
-   |
-LL |     pub fn repro(_: Wrapper<Ref>);
-   |                     ^^^^^^^^^^^^ the trait `Trait` is not implemented for `Ref<'_>`
-   |
-note: required by a bound in `Wrapper`
-  --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:8:23
-   |
-LL | pub struct Wrapper<T: Trait>(T);
-   |                       ^^^^^ required by this bound in `Wrapper`
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0277, E0726.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0726`.