about summary refs log tree commit diff
path: root/tests/ui/dyn-compatibility
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-02-04 02:37:13 +0000
committerMichael Goulet <michael@errs.io>2025-02-24 18:48:40 +0000
commitf3d31f77e4754d5547606d95db97fd6b2335a8ce (patch)
tree3e80529e1c79449fe992421259617915d9d48cc4 /tests/ui/dyn-compatibility
parent617aad8c2e8783f6df8e5d1f8bb1e4bcdc70aa7b (diff)
downloadrust-f3d31f77e4754d5547606d95db97fd6b2335a8ce.tar.gz
rust-f3d31f77e4754d5547606d95db97fd6b2335a8ce.zip
Remove dyn_compatible_for_dispatch
Diffstat (limited to 'tests/ui/dyn-compatibility')
-rw-r--r--tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr20
-rw-r--r--tests/ui/dyn-compatibility/associated-consts.rs6
-rw-r--r--tests/ui/dyn-compatibility/associated-consts.stderr (renamed from tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr)27
-rw-r--r--tests/ui/dyn-compatibility/generics.rs15
-rw-r--r--tests/ui/dyn-compatibility/generics.stderr85
-rw-r--r--tests/ui/dyn-compatibility/mentions-Self.curr.stderr16
-rw-r--r--tests/ui/dyn-compatibility/mentions-Self.rs8
-rw-r--r--tests/ui/dyn-compatibility/mentions-Self.stderr69
-rw-r--r--tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr28
-rw-r--r--tests/ui/dyn-compatibility/no-static.rs8
-rw-r--r--tests/ui/dyn-compatibility/no-static.stderr76
-rw-r--r--tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr19
-rw-r--r--tests/ui/dyn-compatibility/sized-2.rs6
-rw-r--r--tests/ui/dyn-compatibility/sized-2.stderr (renamed from tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr)33
-rw-r--r--tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr19
-rw-r--r--tests/ui/dyn-compatibility/sized.rs6
-rw-r--r--tests/ui/dyn-compatibility/sized.stderr34
-rw-r--r--tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr27
-rw-r--r--tests/ui/dyn-compatibility/taint-const-eval.rs8
-rw-r--r--tests/ui/dyn-compatibility/taint-const-eval.stderr74
20 files changed, 388 insertions, 196 deletions
diff --git a/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr
deleted file mode 100644
index 704d833f00b..00000000000
--- a/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/associated-consts.rs:14:5
-   |
-LL |     t
-   |     ^ `Bar` is not dyn compatible
-   |
-note: for a trait to be dyn compatible it needs to allow building a vtable
-      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/associated-consts.rs:9:11
-   |
-LL | trait Bar {
-   |       --- this trait is not dyn compatible...
-LL |     const X: usize;
-   |           ^ ...because it contains this associated `const`
-   = help: consider moving `X` to another trait
-   = note: required for the cast from `&T` to `&dyn Bar`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/associated-consts.rs b/tests/ui/dyn-compatibility/associated-consts.rs
index fc7b372b782..10d151d9a8b 100644
--- a/tests/ui/dyn-compatibility/associated-consts.rs
+++ b/tests/ui/dyn-compatibility/associated-consts.rs
@@ -1,16 +1,12 @@
 // Check that we correctly prevent users from making trait objects
 // from traits with associated consts.
-//
-//@ revisions: curr dyn_compatible_for_dispatch
-
-#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))]
 
 trait Bar {
     const X: usize;
 }
 
 fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     t
     //~^ ERROR E0038
 }
diff --git a/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/associated-consts.stderr
index b3565a766fe..beaf263af07 100644
--- a/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr
+++ b/tests/ui/dyn-compatibility/associated-consts.stderr
@@ -1,35 +1,34 @@
 error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/generics.rs:20:5
+  --> $DIR/associated-consts.rs:8:31
    |
-LL |     t
-   |     ^ `Bar` is not dyn compatible
+LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
+   |                               ^^^^^^^ `Bar` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/generics.rs:10:8
+  --> $DIR/associated-consts.rs:5:11
    |
 LL | trait Bar {
    |       --- this trait is not dyn compatible...
-LL |     fn bar<T>(&self, t: T);
-   |        ^^^ ...because method `bar` has generic type parameters
-   = help: consider moving `bar` to another trait
-   = note: required for the cast from `&T` to `&dyn Bar`
+LL |     const X: usize;
+   |           ^ ...because it contains this associated `const`
+   = help: consider moving `X` to another trait
 
 error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/generics.rs:27:5
+  --> $DIR/associated-consts.rs:10:5
    |
-LL |     t as &dyn Bar
+LL |     t
    |     ^ `Bar` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/generics.rs:10:8
+  --> $DIR/associated-consts.rs:5:11
    |
 LL | trait Bar {
    |       --- this trait is not dyn compatible...
-LL |     fn bar<T>(&self, t: T);
-   |        ^^^ ...because method `bar` has generic type parameters
-   = help: consider moving `bar` to another trait
+LL |     const X: usize;
+   |           ^ ...because it contains this associated `const`
+   = help: consider moving `X` to another trait
    = note: required for the cast from `&T` to `&dyn Bar`
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/dyn-compatibility/generics.rs b/tests/ui/dyn-compatibility/generics.rs
index b51555aa500..dcce17f925b 100644
--- a/tests/ui/dyn-compatibility/generics.rs
+++ b/tests/ui/dyn-compatibility/generics.rs
@@ -1,9 +1,6 @@
 // Check that we correctly prevent users from making trait objects
 // from traits with generic methods, unless `where Self : Sized` is
 // present.
-//@ revisions: curr dyn_compatible_for_dispatch
-
-#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))]
 
 
 trait Bar {
@@ -16,18 +13,16 @@ trait Quux {
 }
 
 fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     t
-    //[dyn_compatible_for_dispatch]~^ ERROR E0038
-    //[curr]~^^ ERROR E0038
+    //~^ ERROR E0038
 }
 
 fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     t as &dyn Bar
-    //[dyn_compatible_for_dispatch]~^ ERROR E0038
-    //[curr]~^^ ERROR E0038
-    //[curr]~| ERROR E0038
+    //~^ ERROR E0038
+    //~| ERROR E0038
 }
 
 fn make_quux<T:Quux>(t: &T) -> &dyn Quux {
diff --git a/tests/ui/dyn-compatibility/generics.stderr b/tests/ui/dyn-compatibility/generics.stderr
new file mode 100644
index 00000000000..c0193010541
--- /dev/null
+++ b/tests/ui/dyn-compatibility/generics.stderr
@@ -0,0 +1,85 @@
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/generics.rs:15:31
+   |
+LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
+   |                               ^^^^^^^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/generics.rs:7:8
+   |
+LL | trait Bar {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar<T>(&self, t: T);
+   |        ^^^ ...because method `bar` has generic type parameters
+   = help: consider moving `bar` to another trait
+
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/generics.rs:21:40
+   |
+LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar {
+   |                                        ^^^^^^^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/generics.rs:7:8
+   |
+LL | trait Bar {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar<T>(&self, t: T);
+   |        ^^^ ...because method `bar` has generic type parameters
+   = help: consider moving `bar` to another trait
+
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/generics.rs:17:5
+   |
+LL |     t
+   |     ^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/generics.rs:7:8
+   |
+LL | trait Bar {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar<T>(&self, t: T);
+   |        ^^^ ...because method `bar` has generic type parameters
+   = help: consider moving `bar` to another trait
+   = note: required for the cast from `&T` to `&dyn Bar`
+
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/generics.rs:23:10
+   |
+LL |     t as &dyn Bar
+   |          ^^^^^^^^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/generics.rs:7:8
+   |
+LL | trait Bar {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar<T>(&self, t: T);
+   |        ^^^ ...because method `bar` has generic type parameters
+   = help: consider moving `bar` to another trait
+
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/generics.rs:23:5
+   |
+LL |     t as &dyn Bar
+   |     ^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/generics.rs:7:8
+   |
+LL | trait Bar {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar<T>(&self, t: T);
+   |        ^^^ ...because method `bar` has generic type parameters
+   = help: consider moving `bar` to another trait
+   = note: required for the cast from `&T` to `&dyn Bar`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/mentions-Self.curr.stderr b/tests/ui/dyn-compatibility/mentions-Self.curr.stderr
index 2d3fe5ce636..6d1ae90152e 100644
--- a/tests/ui/dyn-compatibility/mentions-Self.curr.stderr
+++ b/tests/ui/dyn-compatibility/mentions-Self.curr.stderr
@@ -1,12 +1,12 @@
 error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/mentions-Self.rs:22:31
+  --> $DIR/mentions-Self.rs:18:31
    |
 LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
    |                               ^^^^^^^ `Bar` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/mentions-Self.rs:11:22
+  --> $DIR/mentions-Self.rs:7:22
    |
 LL | trait Bar {
    |       --- this trait is not dyn compatible...
@@ -15,14 +15,14 @@ LL |     fn bar(&self, x: &Self);
    = help: consider moving `bar` to another trait
 
 error[E0038]: the trait `Baz` is not dyn compatible
-  --> $DIR/mentions-Self.rs:28:31
+  --> $DIR/mentions-Self.rs:24:31
    |
 LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
    |                               ^^^^^^^ `Baz` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/mentions-Self.rs:15:22
+  --> $DIR/mentions-Self.rs:11:22
    |
 LL | trait Baz {
    |       --- this trait is not dyn compatible...
@@ -31,14 +31,14 @@ LL |     fn baz(&self) -> Self;
    = help: consider moving `baz` to another trait
 
 error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/mentions-Self.rs:24:5
+  --> $DIR/mentions-Self.rs:20:5
    |
 LL |     t
    |     ^ `Bar` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/mentions-Self.rs:11:22
+  --> $DIR/mentions-Self.rs:7:22
    |
 LL | trait Bar {
    |       --- this trait is not dyn compatible...
@@ -48,14 +48,14 @@ LL |     fn bar(&self, x: &Self);
    = note: required for the cast from `&T` to `&dyn Bar`
 
 error[E0038]: the trait `Baz` is not dyn compatible
-  --> $DIR/mentions-Self.rs:30:5
+  --> $DIR/mentions-Self.rs:26:5
    |
 LL |     t
    |     ^ `Baz` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/mentions-Self.rs:15:22
+  --> $DIR/mentions-Self.rs:11:22
    |
 LL | trait Baz {
    |       --- this trait is not dyn compatible...
diff --git a/tests/ui/dyn-compatibility/mentions-Self.rs b/tests/ui/dyn-compatibility/mentions-Self.rs
index 84c229e252d..ce210f4776f 100644
--- a/tests/ui/dyn-compatibility/mentions-Self.rs
+++ b/tests/ui/dyn-compatibility/mentions-Self.rs
@@ -1,10 +1,6 @@
 // Check that we correctly prevent users from making trait objects
 // form traits that make use of `Self` in an argument or return
 // position, unless `where Self : Sized` is present..
-//
-//@ revisions: curr dyn_compatible_for_dispatch
-
-#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))]
 
 
 trait Bar {
@@ -20,13 +16,13 @@ trait Quux {
 }
 
 fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     t
     //~^ ERROR E0038
 }
 
 fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     t
     //~^ ERROR E0038
 }
diff --git a/tests/ui/dyn-compatibility/mentions-Self.stderr b/tests/ui/dyn-compatibility/mentions-Self.stderr
new file mode 100644
index 00000000000..6d1ae90152e
--- /dev/null
+++ b/tests/ui/dyn-compatibility/mentions-Self.stderr
@@ -0,0 +1,69 @@
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/mentions-Self.rs:18:31
+   |
+LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
+   |                               ^^^^^^^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/mentions-Self.rs:7:22
+   |
+LL | trait Bar {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar(&self, x: &Self);
+   |                      ^^^^^ ...because method `bar` references the `Self` type in this parameter
+   = help: consider moving `bar` to another trait
+
+error[E0038]: the trait `Baz` is not dyn compatible
+  --> $DIR/mentions-Self.rs:24:31
+   |
+LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
+   |                               ^^^^^^^ `Baz` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/mentions-Self.rs:11:22
+   |
+LL | trait Baz {
+   |       --- this trait is not dyn compatible...
+LL |     fn baz(&self) -> Self;
+   |                      ^^^^ ...because method `baz` references the `Self` type in its return type
+   = help: consider moving `baz` to another trait
+
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/mentions-Self.rs:20:5
+   |
+LL |     t
+   |     ^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/mentions-Self.rs:7:22
+   |
+LL | trait Bar {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar(&self, x: &Self);
+   |                      ^^^^^ ...because method `bar` references the `Self` type in this parameter
+   = help: consider moving `bar` to another trait
+   = note: required for the cast from `&T` to `&dyn Bar`
+
+error[E0038]: the trait `Baz` is not dyn compatible
+  --> $DIR/mentions-Self.rs:26:5
+   |
+LL |     t
+   |     ^ `Baz` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/mentions-Self.rs:11:22
+   |
+LL | trait Baz {
+   |       --- this trait is not dyn compatible...
+LL |     fn baz(&self) -> Self;
+   |                      ^^^^ ...because method `baz` references the `Self` type in its return type
+   = help: consider moving `baz` to another trait
+   = note: required for the cast from `&T` to `&dyn Baz`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr
deleted file mode 100644
index d5ad4510334..00000000000
--- a/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0038]: the trait `Foo` is not dyn compatible
-  --> $DIR/no-static.rs:22:27
-   |
-LL |     let b: Box<dyn Foo> = Box::new(Bar);
-   |                           ^^^^^^^^^^^^^ `Foo` is not dyn compatible
-   |
-note: for a trait to be dyn compatible it needs to allow building a vtable
-      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/no-static.rs:9:8
-   |
-LL | trait Foo {
-   |       --- this trait is not dyn compatible...
-LL |     fn foo() {}
-   |        ^^^ ...because associated function `foo` has no `self` parameter
-   = help: only type `Bar` implements `Foo`; consider using it directly instead.
-   = note: required for the cast from `Box<Bar>` to `Box<dyn Foo>`
-help: consider turning `foo` into a method by giving it a `&self` argument
-   |
-LL |     fn foo(&self) {}
-   |            +++++
-help: alternatively, consider constraining `foo` so it does not apply to trait objects
-   |
-LL |     fn foo() where Self: Sized {}
-   |              +++++++++++++++++
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/no-static.rs b/tests/ui/dyn-compatibility/no-static.rs
index 54af16fe18e..9bd87161972 100644
--- a/tests/ui/dyn-compatibility/no-static.rs
+++ b/tests/ui/dyn-compatibility/no-static.rs
@@ -1,16 +1,12 @@
 // Check that we correctly prevent users from making trait objects
 // from traits with static methods.
-//
-//@ revisions: curr dyn_compatible_for_dispatch
-
-#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))]
 
 trait Foo {
     fn foo() {}
 }
 
 fn diverges() -> Box<dyn Foo> {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     loop { }
 }
 
@@ -21,5 +17,5 @@ impl Foo for Bar {}
 fn main() {
     let b: Box<dyn Foo> = Box::new(Bar);
     //~^ ERROR E0038
-    //[curr]~| ERROR E0038
+    //~| ERROR E0038
 }
diff --git a/tests/ui/dyn-compatibility/no-static.stderr b/tests/ui/dyn-compatibility/no-static.stderr
new file mode 100644
index 00000000000..814ab0d53c3
--- /dev/null
+++ b/tests/ui/dyn-compatibility/no-static.stderr
@@ -0,0 +1,76 @@
+error[E0038]: the trait `Foo` is not dyn compatible
+  --> $DIR/no-static.rs:8:22
+   |
+LL | fn diverges() -> Box<dyn Foo> {
+   |                      ^^^^^^^ `Foo` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/no-static.rs:5:8
+   |
+LL | trait Foo {
+   |       --- this trait is not dyn compatible...
+LL |     fn foo() {}
+   |        ^^^ ...because associated function `foo` has no `self` parameter
+   = help: only type `Bar` implements `Foo`; consider using it directly instead.
+help: consider turning `foo` into a method by giving it a `&self` argument
+   |
+LL |     fn foo(&self) {}
+   |            +++++
+help: alternatively, consider constraining `foo` so it does not apply to trait objects
+   |
+LL |     fn foo() where Self: Sized {}
+   |              +++++++++++++++++
+
+error[E0038]: the trait `Foo` is not dyn compatible
+  --> $DIR/no-static.rs:18:12
+   |
+LL |     let b: Box<dyn Foo> = Box::new(Bar);
+   |            ^^^^^^^^^^^^ `Foo` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/no-static.rs:5:8
+   |
+LL | trait Foo {
+   |       --- this trait is not dyn compatible...
+LL |     fn foo() {}
+   |        ^^^ ...because associated function `foo` has no `self` parameter
+   = help: only type `Bar` implements `Foo`; consider using it directly instead.
+help: consider turning `foo` into a method by giving it a `&self` argument
+   |
+LL |     fn foo(&self) {}
+   |            +++++
+help: alternatively, consider constraining `foo` so it does not apply to trait objects
+   |
+LL |     fn foo() where Self: Sized {}
+   |              +++++++++++++++++
+
+error[E0038]: the trait `Foo` is not dyn compatible
+  --> $DIR/no-static.rs:18:27
+   |
+LL |     let b: Box<dyn Foo> = Box::new(Bar);
+   |                           ^^^^^^^^^^^^^ `Foo` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/no-static.rs:5:8
+   |
+LL | trait Foo {
+   |       --- this trait is not dyn compatible...
+LL |     fn foo() {}
+   |        ^^^ ...because associated function `foo` has no `self` parameter
+   = help: only type `Bar` implements `Foo`; consider using it directly instead.
+   = note: required for the cast from `Box<Bar>` to `Box<dyn Foo>`
+help: consider turning `foo` into a method by giving it a `&self` argument
+   |
+LL |     fn foo(&self) {}
+   |            +++++
+help: alternatively, consider constraining `foo` so it does not apply to trait objects
+   |
+LL |     fn foo() where Self: Sized {}
+   |              +++++++++++++++++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr
deleted file mode 100644
index 1fbc10c0c3f..00000000000
--- a/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/sized-2.rs:16:5
-   |
-LL |     t
-   |     ^ `Bar` is not dyn compatible
-   |
-note: for a trait to be dyn compatible it needs to allow building a vtable
-      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/sized-2.rs:9:18
-   |
-LL | trait Bar
-   |       --- this trait is not dyn compatible...
-LL |     where Self : Sized
-   |                  ^^^^^ ...because it requires `Self: Sized`
-   = note: required for the cast from `&T` to `&dyn Bar`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/sized-2.rs b/tests/ui/dyn-compatibility/sized-2.rs
index f5edd287f24..f61d49ee8df 100644
--- a/tests/ui/dyn-compatibility/sized-2.rs
+++ b/tests/ui/dyn-compatibility/sized-2.rs
@@ -1,9 +1,5 @@
 // Check that we correctly prevent users from making trait objects
 // from traits where `Self : Sized`.
-//
-//@ revisions: curr dyn_compatible_for_dispatch
-
-#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))]
 
 trait Bar
     where Self : Sized
@@ -12,7 +8,7 @@ trait Bar
 }
 
 fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     t
     //~^ ERROR E0038
 }
diff --git a/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized-2.stderr
index 91c26a86025..1834d906bb8 100644
--- a/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr
+++ b/tests/ui/dyn-compatibility/sized-2.stderr
@@ -1,36 +1,33 @@
 error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/mentions-Self.rs:24:5
+  --> $DIR/sized-2.rs:10:31
    |
-LL |     t
-   |     ^ `Bar` is not dyn compatible
+LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
+   |                               ^^^^^^^ `Bar` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/mentions-Self.rs:11:22
+  --> $DIR/sized-2.rs:5:18
    |
-LL | trait Bar {
+LL | trait Bar
    |       --- this trait is not dyn compatible...
-LL |     fn bar(&self, x: &Self);
-   |                      ^^^^^ ...because method `bar` references the `Self` type in this parameter
-   = help: consider moving `bar` to another trait
-   = note: required for the cast from `&T` to `&dyn Bar`
+LL |     where Self : Sized
+   |                  ^^^^^ ...because it requires `Self: Sized`
 
-error[E0038]: the trait `Baz` is not dyn compatible
-  --> $DIR/mentions-Self.rs:30:5
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/sized-2.rs:12:5
    |
 LL |     t
-   |     ^ `Baz` is not dyn compatible
+   |     ^ `Bar` is not dyn compatible
    |
 note: for a trait to be dyn compatible it needs to allow building a vtable
       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/mentions-Self.rs:15:22
+  --> $DIR/sized-2.rs:5:18
    |
-LL | trait Baz {
+LL | trait Bar
    |       --- this trait is not dyn compatible...
-LL |     fn baz(&self) -> Self;
-   |                      ^^^^ ...because method `baz` references the `Self` type in its return type
-   = help: consider moving `baz` to another trait
-   = note: required for the cast from `&T` to `&dyn Baz`
+LL |     where Self : Sized
+   |                  ^^^^^ ...because it requires `Self: Sized`
+   = note: required for the cast from `&T` to `&dyn Bar`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr
deleted file mode 100644
index 350c8992c6f..00000000000
--- a/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0038]: the trait `Bar` is not dyn compatible
-  --> $DIR/sized.rs:14:5
-   |
-LL |     t
-   |     ^ `Bar` is not dyn compatible
-   |
-note: for a trait to be dyn compatible it needs to allow building a vtable
-      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/sized.rs:8:12
-   |
-LL | trait Bar: Sized {
-   |       ---  ^^^^^ ...because it requires `Self: Sized`
-   |       |
-   |       this trait is not dyn compatible...
-   = note: required for the cast from `&T` to `&dyn Bar`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/sized.rs b/tests/ui/dyn-compatibility/sized.rs
index 4c4fe3f8f25..eb5279c17e6 100644
--- a/tests/ui/dyn-compatibility/sized.rs
+++ b/tests/ui/dyn-compatibility/sized.rs
@@ -1,16 +1,12 @@
 // Check that we correctly prevent users from making trait objects
 // from traits where `Self : Sized`.
-//
-//@ revisions: curr dyn_compatible_for_dispatch
-
-#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))]
 
 trait Bar: Sized {
     fn bar<T>(&self, t: T);
 }
 
 fn make_bar<T: Bar>(t: &T) -> &dyn Bar {
-    //[curr]~^ ERROR E0038
+    //~^ ERROR E0038
     t
     //~^ ERROR E0038
 }
diff --git a/tests/ui/dyn-compatibility/sized.stderr b/tests/ui/dyn-compatibility/sized.stderr
new file mode 100644
index 00000000000..c66e299cf6f
--- /dev/null
+++ b/tests/ui/dyn-compatibility/sized.stderr
@@ -0,0 +1,34 @@
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/sized.rs:8:32
+   |
+LL | fn make_bar<T: Bar>(t: &T) -> &dyn Bar {
+   |                                ^^^^^^^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/sized.rs:4:12
+   |
+LL | trait Bar: Sized {
+   |       ---  ^^^^^ ...because it requires `Self: Sized`
+   |       |
+   |       this trait is not dyn compatible...
+
+error[E0038]: the trait `Bar` is not dyn compatible
+  --> $DIR/sized.rs:10:5
+   |
+LL |     t
+   |     ^ `Bar` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/sized.rs:4:12
+   |
+LL | trait Bar: Sized {
+   |       ---  ^^^^^ ...because it requires `Self: Sized`
+   |       |
+   |       this trait is not dyn compatible...
+   = note: required for the cast from `&T` to `&dyn Bar`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr
deleted file mode 100644
index 0bc7d0b14d3..00000000000
--- a/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0038]: the trait `Qux` is not dyn compatible
-  --> $DIR/taint-const-eval.rs:11:33
-   |
-LL | static FOO: &(dyn Qux + Sync) = "desc";
-   |                                 ^^^^^^ `Qux` is not dyn compatible
-   |
-note: for a trait to be dyn compatible it needs to allow building a vtable
-      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
-  --> $DIR/taint-const-eval.rs:8:8
-   |
-LL | trait Qux {
-   |       --- this trait is not dyn compatible...
-LL |     fn bar();
-   |        ^^^ ...because associated function `bar` has no `self` parameter
-   = note: required for the cast from `&'static str` to `&'static (dyn Qux + Sync + 'static)`
-help: consider turning `bar` into a method by giving it a `&self` argument
-   |
-LL |     fn bar(&self);
-   |            +++++
-help: alternatively, consider constraining `bar` so it does not apply to trait objects
-   |
-LL |     fn bar() where Self: Sized;
-   |              +++++++++++++++++
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/dyn-compatibility/taint-const-eval.rs b/tests/ui/dyn-compatibility/taint-const-eval.rs
index 2feae58080b..7ea763e1846 100644
--- a/tests/ui/dyn-compatibility/taint-const-eval.rs
+++ b/tests/ui/dyn-compatibility/taint-const-eval.rs
@@ -1,16 +1,12 @@
 // Test that we do not attempt to create dyn-incompatible trait objects in const eval.
 
-//@ revisions: curr dyn_compatible_for_dispatch
-
-#![cfg_attr(dyn_compatible_for_dispatch, feature(dyn_compatible_for_dispatch))]
-
 trait Qux {
     fn bar();
 }
 
 static FOO: &(dyn Qux + Sync) = "desc";
 //~^ the trait `Qux` is not dyn compatible
-//[curr]~| the trait `Qux` is not dyn compatible
-//[curr]~| the trait `Qux` is not dyn compatible
+//~| the trait `Qux` is not dyn compatible
+//~| the trait `Qux` is not dyn compatible
 
 fn main() {}
diff --git a/tests/ui/dyn-compatibility/taint-const-eval.stderr b/tests/ui/dyn-compatibility/taint-const-eval.stderr
new file mode 100644
index 00000000000..942c20db6ce
--- /dev/null
+++ b/tests/ui/dyn-compatibility/taint-const-eval.stderr
@@ -0,0 +1,74 @@
+error[E0038]: the trait `Qux` is not dyn compatible
+  --> $DIR/taint-const-eval.rs:7:15
+   |
+LL | static FOO: &(dyn Qux + Sync) = "desc";
+   |               ^^^^^^^^^^^^^^ `Qux` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/taint-const-eval.rs:4:8
+   |
+LL | trait Qux {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar();
+   |        ^^^ ...because associated function `bar` has no `self` parameter
+help: consider turning `bar` into a method by giving it a `&self` argument
+   |
+LL |     fn bar(&self);
+   |            +++++
+help: alternatively, consider constraining `bar` so it does not apply to trait objects
+   |
+LL |     fn bar() where Self: Sized;
+   |              +++++++++++++++++
+
+error[E0038]: the trait `Qux` is not dyn compatible
+  --> $DIR/taint-const-eval.rs:7:33
+   |
+LL | static FOO: &(dyn Qux + Sync) = "desc";
+   |                                 ^^^^^^ `Qux` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/taint-const-eval.rs:4:8
+   |
+LL | trait Qux {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar();
+   |        ^^^ ...because associated function `bar` has no `self` parameter
+   = note: required for the cast from `&'static str` to `&'static (dyn Qux + Sync + 'static)`
+help: consider turning `bar` into a method by giving it a `&self` argument
+   |
+LL |     fn bar(&self);
+   |            +++++
+help: alternatively, consider constraining `bar` so it does not apply to trait objects
+   |
+LL |     fn bar() where Self: Sized;
+   |              +++++++++++++++++
+
+error[E0038]: the trait `Qux` is not dyn compatible
+  --> $DIR/taint-const-eval.rs:7:15
+   |
+LL | static FOO: &(dyn Qux + Sync) = "desc";
+   |               ^^^^^^^^^^^^^^ `Qux` is not dyn compatible
+   |
+note: for a trait to be dyn compatible it needs to allow building a vtable
+      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+  --> $DIR/taint-const-eval.rs:4:8
+   |
+LL | trait Qux {
+   |       --- this trait is not dyn compatible...
+LL |     fn bar();
+   |        ^^^ ...because associated function `bar` has no `self` parameter
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider turning `bar` into a method by giving it a `&self` argument
+   |
+LL |     fn bar(&self);
+   |            +++++
+help: alternatively, consider constraining `bar` so it does not apply to trait objects
+   |
+LL |     fn bar() where Self: Sized;
+   |              +++++++++++++++++
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0038`.