about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGeorg Semmler <github@weiznich.de>2024-10-22 19:48:11 +0200
committerGeorg Semmler <github@weiznich.de>2024-12-18 07:10:11 +0100
commitbfd02d8b36914d222b2ee6ed185cbf6bdba7d9d9 (patch)
tree98d22ef3acec4135c84cf84a2d4a6ea3c7a96c22
parenta89ca2c85e61d03c6e41be89508ed3d012f916f8 (diff)
downloadrust-bfd02d8b36914d222b2ee6ed185cbf6bdba7d9d9.tar.gz
rust-bfd02d8b36914d222b2ee6ed185cbf6bdba7d9d9.zip
Improve testing coverage for `#[diagnostic::do_not_recommend]`
This PR aims to improve the testing coverage for
`#[diagnostic::do_not_recommend]`. It ensures that all tests are run for
the old and new solver to verify that the behaviour is the same for both
variants. It also adds two new tests:

* A test with 4 traits having wild card impl for each other, with
alternating `#[diagnostic::do_not_recommend]` attributse
* A test with a lifetime dependend wild card impl, which is something
that's not supported yet
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.current.stderr (renamed from tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr)4
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.next.stderr21
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs3
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.current.stderr (renamed from tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr)4
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.next.stderr17
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs3
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr (renamed from tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.stderr)16
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr52
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs3
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr15
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr15
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/nested.rs25
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.current.stderr (renamed from tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr)4
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.next.stderr14
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs3
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr10
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr10
-rw-r--r--tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs25
18 files changed, 230 insertions, 14 deletions
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.current.stderr
index be17476524a..660fc7d2171 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.current.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `(): Foo` is not satisfied
-  --> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:11
+  --> $DIR/do_not_apply_attribute_without_feature_flag.rs:22:11
    |
 LL |     check(());
    |     ----- ^^ the trait `Foo` is not implemented for `()`
@@ -11,7 +11,7 @@ LL |     check(());
              (A, B, C)
              (A,)
 note: required by a bound in `check`
-  --> $DIR/do_not_apply_attribute_without_feature_flag.rs:16:18
+  --> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:18
    |
 LL | fn check(a: impl Foo) {}
    |                  ^^^ required by this bound in `check`
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.next.stderr
new file mode 100644
index 00000000000..1cd148186f1
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.next.stderr
@@ -0,0 +1,21 @@
+error[E0277]: the trait bound `(): Foo` is not satisfied
+  --> $DIR/do_not_apply_attribute_without_feature_flag.rs:22:11
+   |
+LL |     check(());
+   |     ----- ^^ the trait `Foo` is not implemented for `()`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the following other types implement trait `Foo`:
+             (A, B)
+             (A, B, C)
+             (A,)
+note: required by a bound in `check`
+  --> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:18
+   |
+LL | fn check(a: impl Foo) {}
+   |                  ^^^ required by this bound in `check`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs
index 5548fa2f52e..9c25069bc7d 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs
@@ -1,3 +1,6 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
 #![allow(unknown_or_malformed_diagnostic_attributes)]
 
 trait Foo {}
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.current.stderr
index 3951231fa2e..d1deaa6a006 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.current.stderr
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `u8: Bar` is not satisfied
-  --> $DIR/feature-gate-do_not_recommend.rs:15:11
+  --> $DIR/feature-gate-do_not_recommend.rs:18:11
    |
 LL |     stuff(1u8);
    |           ^^^ the trait `Bar` is not implemented for `u8`
    |
 note: required by a bound in `stuff`
-  --> $DIR/feature-gate-do_not_recommend.rs:12:13
+  --> $DIR/feature-gate-do_not_recommend.rs:15:13
    |
 LL | fn stuff<T: Bar>(_: T) {}
    |             ^^^ required by this bound in `stuff`
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.next.stderr
new file mode 100644
index 00000000000..5bfcc60edc5
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.next.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the trait bound `u8: Bar` is not satisfied
+  --> $DIR/feature-gate-do_not_recommend.rs:18:11
+   |
+LL |     stuff(1u8);
+   |     ----- ^^^ the trait `Bar` is not implemented for `u8`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `stuff`
+  --> $DIR/feature-gate-do_not_recommend.rs:15:13
+   |
+LL | fn stuff<T: Bar>(_: T) {}
+   |             ^^^ required by this bound in `stuff`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs
index 5a26d28188c..4adce112f15 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs
@@ -1,3 +1,6 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
 #![feature(do_not_recommend)]
 
 pub trait Foo {}
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr
index c83fd46db58..84ab0827ab6 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.stderr
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr
@@ -1,5 +1,5 @@
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:4:1
+  --> $DIR/incorrect-locations.rs:7:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,43 +7,43 @@ LL | #[diagnostic::do_not_recommend]
    = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
 
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:8:1
+  --> $DIR/incorrect-locations.rs:11:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:12:1
+  --> $DIR/incorrect-locations.rs:15:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:16:1
+  --> $DIR/incorrect-locations.rs:19:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:20:1
+  --> $DIR/incorrect-locations.rs:23:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:24:1
+  --> $DIR/incorrect-locations.rs:27:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:28:1
+  --> $DIR/incorrect-locations.rs:31:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
-  --> $DIR/incorrect-locations.rs:32:1
+  --> $DIR/incorrect-locations.rs:35:1
    |
 LL | #[diagnostic::do_not_recommend]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr
new file mode 100644
index 00000000000..84ab0827ab6
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr
@@ -0,0 +1,52 @@
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:7:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:11:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:15:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:19:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:23:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:27:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:31:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
+  --> $DIR/incorrect-locations.rs:35:1
+   |
+LL | #[diagnostic::do_not_recommend]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 8 warnings emitted
+
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs
index 400ef83873e..daacf55ea79 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs
@@ -1,4 +1,7 @@
 //@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
 #![feature(do_not_recommend)]
 
 #[diagnostic::do_not_recommend]
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr
new file mode 100644
index 00000000000..2e08a679360
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `(): Root` is not satisfied
+  --> $DIR/nested.rs:23:18
+   |
+LL |     needs_root::<()>();
+   |                  ^^ the trait `Root` is not implemented for `()`
+   |
+note: required by a bound in `needs_root`
+  --> $DIR/nested.rs:20:18
+   |
+LL | fn needs_root<T: Root>() {}
+   |                  ^^^^ required by this bound in `needs_root`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr
new file mode 100644
index 00000000000..2e08a679360
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `(): Root` is not satisfied
+  --> $DIR/nested.rs:23:18
+   |
+LL |     needs_root::<()>();
+   |                  ^^ the trait `Root` is not implemented for `()`
+   |
+note: required by a bound in `needs_root`
+  --> $DIR/nested.rs:20:18
+   |
+LL | fn needs_root<T: Root>() {}
+   |                  ^^^^ required by this bound in `needs_root`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs
new file mode 100644
index 00000000000..d499cff9f56
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs
@@ -0,0 +1,25 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+#![feature(do_not_recommend)]
+
+trait Root {}
+trait DontRecommend {}
+trait Other {}
+trait Child {}
+
+#[diagnostic::do_not_recommend]
+impl<T> Root for T where T: DontRecommend {}
+
+impl<T> DontRecommend for T where T: Other {}
+
+#[diagnostic::do_not_recommend]
+impl<T> Other for T where T: Child {}
+
+fn needs_root<T: Root>() {}
+
+fn main() {
+    needs_root::<()>();
+    //~^ ERROR the trait bound `(): Root` is not satisfied
+}
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.current.stderr
index d8332229d4f..fdea9eacae1 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.current.stderr
@@ -1,11 +1,11 @@
 error: unknown diagnostic attribute
-  --> $DIR/unstable-feature.rs:4:15
+  --> $DIR/unstable-feature.rs:7:15
    |
 LL | #[diagnostic::do_not_recommend]
    |               ^^^^^^^^^^^^^^^^
    |
 note: the lint level is defined here
-  --> $DIR/unstable-feature.rs:1:9
+  --> $DIR/unstable-feature.rs:4:9
    |
 LL | #![deny(unknown_or_malformed_diagnostic_attributes)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.next.stderr
new file mode 100644
index 00000000000..fdea9eacae1
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.next.stderr
@@ -0,0 +1,14 @@
+error: unknown diagnostic attribute
+  --> $DIR/unstable-feature.rs:7:15
+   |
+LL | #[diagnostic::do_not_recommend]
+   |               ^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/unstable-feature.rs:4:9
+   |
+LL | #![deny(unknown_or_malformed_diagnostic_attributes)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs
index ccc687aa5b3..7a67f67b67f 100644
--- a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs
@@ -1,3 +1,6 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
 #![deny(unknown_or_malformed_diagnostic_attributes)]
 trait Foo {}
 
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr
new file mode 100644
index 00000000000..c2874cf4594
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/with_lifetime.rs:19:5
+   |
+LL | fn foo<'a>(a: &'a ()) {
+   |        -- lifetime `'a` defined here
+LL |     needs_root::<&'a ()>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr
new file mode 100644
index 00000000000..c2874cf4594
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/with_lifetime.rs:19:5
+   |
+LL | fn foo<'a>(a: &'a ()) {
+   |        -- lifetime `'a` defined here
+LL |     needs_root::<&'a ()>();
+   |     ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs
new file mode 100644
index 00000000000..9aaf7f33ecd
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs
@@ -0,0 +1,25 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+#![feature(do_not_recommend)]
+
+trait Root {}
+trait DontRecommend {}
+
+impl<T> Root for T where T: DontRecommend {}
+
+// this has no effect yet for resolving the trait error below
+#[diagnostic::do_not_recommend]
+impl<T> DontRecommend for &'static T {}
+
+fn needs_root<T: Root>() {}
+
+fn foo<'a>(a: &'a ()) {
+    needs_root::<&'a ()>();
+    //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {
+    foo(&());
+}