From 757c75fcd1e889c57cbf758fa2b8ab376a922b91 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 21 Jan 2025 09:17:40 +0000 Subject: [PATCH] Reject `impl Trait` within `?Trait` generics or assoc ty bounds --- .../src/hir_ty_lowering/bounds.rs | 2 +- .../diagnostic-flags/allow-non-lint-warnings.rs | 11 +++++------ .../allow-non-lint-warnings.without_flag.stderr | 8 ++++---- .../feature-gate-more-maybe-bounds.rs | 8 ++++---- .../feature-gate-more-maybe-bounds.stderr | 10 +++++----- .../ui/impl-trait/opt-out-bound-not-satisfied.rs | 11 +++++++++++ .../opt-out-bound-not-satisfied.stderr | 16 ++++++++++++++++ tests/ui/issues/issue-37534.rs | 2 +- tests/ui/issues/issue-37534.stderr | 4 ++-- tests/ui/issues/issue-87199.rs | 8 ++++---- tests/ui/issues/issue-87199.stderr | 10 +++++----- .../ui/trait-bounds/maybe-bound-has-path-args.rs | 2 +- .../maybe-bound-has-path-args.stderr | 4 ++-- tests/ui/trait-bounds/maybe-bound-with-assoc.rs | 4 ++-- .../trait-bounds/maybe-bound-with-assoc.stderr | 6 +++--- tests/ui/traits/maybe-polarity-pass.rs | 8 +++----- tests/ui/traits/maybe-polarity-pass.stderr | 14 +++++++------- tests/ui/traits/maybe-polarity-repeated.rs | 4 ++-- tests/ui/traits/maybe-polarity-repeated.stderr | 6 +++--- tests/ui/unsized/maybe-bounds-where.rs | 4 ++-- tests/ui/unsized/maybe-bounds-where.stderr | 6 +++--- 21 files changed, 86 insertions(+), 62 deletions(-) create mode 100644 tests/ui/impl-trait/opt-out-bound-not-satisfied.rs create mode 100644 tests/ui/impl-trait/opt-out-bound-not-satisfied.stderr diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs index e949d4a11261e..60f809bae9d18 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs @@ -103,7 +103,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { continue; } // There was a `?Trait` bound, but it was not `?Sized`; warn. - self.dcx().span_warn( + self.dcx().span_err( unbound.span, "relaxing a default bound only does something for `?Sized`; \ all other traits are not bound by default", diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs index 40b9e6536f500..8980ef9c4220f 100644 --- a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs @@ -1,8 +1,7 @@ // ignore-tidy-linelength //! Check that `-A warnings` cli flag applies to non-lint warnings as well. //! -//! This test tries to exercise that by checking that the "relaxing a default bound only does -//! something for `?Sized`; all other traits are not bound by default" non-lint warning (normally +//! This test tries to exercise that by checking that a non-lint warning (normally //! warn-by-default) is suppressed if the `-A warnings` cli flag is passed. //! //! Take special note that `warnings` is a special pseudo lint group in relationship to non-lint @@ -14,7 +13,7 @@ //! - Original impl PR: . //! - RFC 507 "Release channels": //! . -#![crate_type = "lib"] +#![feature(rustc_attrs)] //@ revisions: without_flag with_flag @@ -22,6 +21,6 @@ //@ check-pass -pub trait Trait {} -pub fn f() {} -//[without_flag]~^ WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +#[rustc_error(warn)] +fn main() {} +//[without_flag]~^ WARN unexpected annotation used with `#[rustc_error(...)]`! diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr index b037847c70f1b..3f33ccbd1c9f9 100644 --- a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr @@ -1,8 +1,8 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/allow-non-lint-warnings.rs:26:13 +warning: unexpected annotation used with `#[rustc_error(...)]`! + --> $DIR/allow-non-lint-warnings.rs:25:1 | -LL | pub fn f() {} - | ^^^^^^ +LL | fn main() {} + | ^^^^^^^^^ warning: 1 warning emitted diff --git a/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs index debe143b09172..6a832744e3ee9 100644 --- a/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs +++ b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs @@ -11,14 +11,14 @@ fn foo(_: Box) {} //~^ ERROR `?Trait` is not permitted in trait object types fn bar(_: T) {} //~^ ERROR type parameter has more than one relaxed default bound, only one is supported -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default trait Trait {} // Do not suggest `#![feature(more_maybe_bounds)]` for repetitions fn baz(_ : T) {} //~^ ERROR type parameter has more than one relaxed default bound, only one is supported -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr index e6d65e059977a..729df4eb37cac 100644 --- a/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr @@ -35,13 +35,13 @@ LL | fn bar(_: T) {} = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:12:11 | LL | fn bar(_: T) {} | ^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:12:21 | LL | fn bar(_: T) {} @@ -53,19 +53,19 @@ error[E0203]: type parameter has more than one relaxed default bound, only one i LL | fn baz(_ : T) {} | ^^^^^^ ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:19:11 | LL | fn baz(_ : T) {} | ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:19:20 | LL | fn baz(_ : T) {} | ^^^^^^ -error: aborting due to 5 previous errors; 4 warnings emitted +error: aborting due to 9 previous errors Some errors have detailed explanations: E0203, E0658. For more information about an error, try `rustc --explain E0203`. diff --git a/tests/ui/impl-trait/opt-out-bound-not-satisfied.rs b/tests/ui/impl-trait/opt-out-bound-not-satisfied.rs new file mode 100644 index 0000000000000..27c493a13bf91 --- /dev/null +++ b/tests/ui/impl-trait/opt-out-bound-not-satisfied.rs @@ -0,0 +1,11 @@ +//! Regression test for ICE https://github.com/rust-lang/rust/issues/135730 +//! This used + +use std::future::Future; +fn foo() -> impl ?Future { + //~^ ERROR: relaxing a default bound only does something for `?Sized` + //~| ERROR: relaxing a default bound only does something for `?Sized` + () +} + +pub fn main() {} diff --git a/tests/ui/impl-trait/opt-out-bound-not-satisfied.stderr b/tests/ui/impl-trait/opt-out-bound-not-satisfied.stderr new file mode 100644 index 0000000000000..4d1f9ded742a4 --- /dev/null +++ b/tests/ui/impl-trait/opt-out-bound-not-satisfied.stderr @@ -0,0 +1,16 @@ +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/opt-out-bound-not-satisfied.rs:2:18 + | +LL | fn foo() -> impl ?Future { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/opt-out-bound-not-satisfied.rs:2:18 + | +LL | fn foo() -> impl ?Future { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/issues/issue-37534.rs b/tests/ui/issues/issue-37534.rs index dff89d3888d0c..09d60b7786b99 100644 --- a/tests/ui/issues/issue-37534.rs +++ b/tests/ui/issues/issue-37534.rs @@ -1,5 +1,5 @@ struct Foo {} //~^ ERROR expected trait, found derive macro `Hash` -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` fn main() {} diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr index 8747bd5ac6fad..3219854bc70ce 100644 --- a/tests/ui/issues/issue-37534.stderr +++ b/tests/ui/issues/issue-37534.stderr @@ -9,12 +9,12 @@ help: consider importing this trait instead LL + use std::hash::Hash; | -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-37534.rs:1:15 | LL | struct Foo {} | ^^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0404`. diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs index 34879c5a7ca3b..6664119e57981 100644 --- a/tests/ui/issues/issue-87199.rs +++ b/tests/ui/issues/issue-87199.rs @@ -6,12 +6,12 @@ // Check that these function definitions only emit warnings, not errors fn arg(_: T) {} -//~^ warning: relaxing a default bound only does something for `?Sized` +//~^ ERROR: relaxing a default bound only does something for `?Sized` fn ref_arg(_: &T) {} -//~^ warning: relaxing a default bound only does something for `?Sized` +//~^ ERROR: relaxing a default bound only does something for `?Sized` fn ret() -> impl Iterator + ?Send { std::iter::empty() } -//~^ warning: relaxing a default bound only does something for `?Sized` -//~| warning: relaxing a default bound only does something for `?Sized` +//~^ ERROR: relaxing a default bound only does something for `?Sized` +//~| ERROR: relaxing a default bound only does something for `?Sized` // Check that there's no `?Sized` relaxation! fn main() { diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr index a0ed2946fb4af..acc4e84779c9c 100644 --- a/tests/ui/issues/issue-87199.stderr +++ b/tests/ui/issues/issue-87199.stderr @@ -1,22 +1,22 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:8:11 | LL | fn arg(_: T) {} | ^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:10:15 | LL | fn ref_arg(_: &T) {} | ^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:12:40 | LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } | ^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:12:40 | LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } @@ -41,6 +41,6 @@ help: consider relaxing the implicit `Sized` restriction LL | fn ref_arg(_: &T) {} | ++++++++ -error: aborting due to 1 previous error; 4 warnings emitted +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/trait-bounds/maybe-bound-has-path-args.rs b/tests/ui/trait-bounds/maybe-bound-has-path-args.rs index fd0e96917004d..e5abcae5d219b 100644 --- a/tests/ui/trait-bounds/maybe-bound-has-path-args.rs +++ b/tests/ui/trait-bounds/maybe-bound-has-path-args.rs @@ -2,6 +2,6 @@ trait Trait {} fn test::Trait>() {} //~^ ERROR type arguments are not allowed on module `maybe_bound_has_path_args` -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` fn main() {} diff --git a/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr b/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr index 0c167fff94012..dc55b26c9183c 100644 --- a/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr +++ b/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr @@ -1,4 +1,4 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bound-has-path-args.rs:3:12 | LL | fn test::Trait>() {} @@ -12,6 +12,6 @@ LL | fn test::Trait>() {} | | | not allowed on module `maybe_bound_has_path_args` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/trait-bounds/maybe-bound-with-assoc.rs b/tests/ui/trait-bounds/maybe-bound-with-assoc.rs index b6b2551e4638e..9127c2de16d5e 100644 --- a/tests/ui/trait-bounds/maybe-bound-with-assoc.rs +++ b/tests/ui/trait-bounds/maybe-bound-with-assoc.rs @@ -2,11 +2,11 @@ trait HasAssoc { type Assoc; } fn hasassoc>() {} -//~^ WARN relaxing a default bound +//~^ ERROR relaxing a default bound trait NoAssoc {} fn noassoc>() {} -//~^ WARN relaxing a default bound +//~^ ERROR relaxing a default bound //~| ERROR associated type `Missing` not found for `NoAssoc` fn main() {} diff --git a/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr b/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr index 91d78e59cd5a7..36a1e0ade2063 100644 --- a/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr +++ b/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr @@ -1,10 +1,10 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bound-with-assoc.rs:4:16 | LL | fn hasassoc>() {} | ^^^^^^^^^^^^^^^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bound-with-assoc.rs:8:15 | LL | fn noassoc>() {} @@ -16,6 +16,6 @@ error[E0220]: associated type `Missing` not found for `NoAssoc` LL | fn noassoc>() {} | ^^^^^^^ associated type `Missing` not found -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/traits/maybe-polarity-pass.rs b/tests/ui/traits/maybe-polarity-pass.rs index 075a0d8dcac4d..1ccd52bc1694a 100644 --- a/tests/ui/traits/maybe-polarity-pass.rs +++ b/tests/ui/traits/maybe-polarity-pass.rs @@ -1,5 +1,3 @@ -//@ check-pass - #![feature(auto_traits)] #![feature(more_maybe_bounds)] #![feature(negative_impls)] @@ -12,9 +10,9 @@ trait Trait4 where Self: Trait1 {} fn foo(_: Box<(dyn Trait3 + ?Trait2)>) {} fn bar(_: &T) {} -//~^ WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~^ ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default struct S; impl !Trait2 for S {} diff --git a/tests/ui/traits/maybe-polarity-pass.stderr b/tests/ui/traits/maybe-polarity-pass.stderr index 09ed52f5b0dd7..1f378dd665ae6 100644 --- a/tests/ui/traits/maybe-polarity-pass.stderr +++ b/tests/ui/traits/maybe-polarity-pass.stderr @@ -1,20 +1,20 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/maybe-polarity-pass.rs:14:20 +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-polarity-pass.rs:12:20 | LL | fn bar(_: &T) {} | ^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/maybe-polarity-pass.rs:14:30 +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-polarity-pass.rs:12:30 | LL | fn bar(_: &T) {} | ^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/maybe-polarity-pass.rs:14:40 +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-polarity-pass.rs:12:40 | LL | fn bar(_: &T) {} | ^^^^^^^ -warning: 3 warnings emitted +error: aborting due to 3 previous errors diff --git a/tests/ui/traits/maybe-polarity-repeated.rs b/tests/ui/traits/maybe-polarity-repeated.rs index 4b5ec83fffab0..fd1ef567b3eab 100644 --- a/tests/ui/traits/maybe-polarity-repeated.rs +++ b/tests/ui/traits/maybe-polarity-repeated.rs @@ -3,7 +3,7 @@ trait Trait {} fn foo(_: T) {} //~^ ERROR type parameter has more than one relaxed default bound, only one is supported -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default fn main() {} diff --git a/tests/ui/traits/maybe-polarity-repeated.stderr b/tests/ui/traits/maybe-polarity-repeated.stderr index 610c484fbec59..4fa1dc45bda85 100644 --- a/tests/ui/traits/maybe-polarity-repeated.stderr +++ b/tests/ui/traits/maybe-polarity-repeated.stderr @@ -4,18 +4,18 @@ error[E0203]: type parameter has more than one relaxed default bound, only one i LL | fn foo(_: T) {} | ^^^^^^ ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-polarity-repeated.rs:4:11 | LL | fn foo(_: T) {} | ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-polarity-repeated.rs:4:20 | LL | fn foo(_: T) {} | ^^^^^^ -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0203`. diff --git a/tests/ui/unsized/maybe-bounds-where.rs b/tests/ui/unsized/maybe-bounds-where.rs index 7e82a3eb449cb..4c4141631a7c5 100644 --- a/tests/ui/unsized/maybe-bounds-where.rs +++ b/tests/ui/unsized/maybe-bounds-where.rs @@ -11,11 +11,11 @@ trait Trait<'a> {} struct S4(T) where for<'a> T: ?Trait<'a>; //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` struct S5(*const T) where T: ?Trait<'static> + ?Sized; //~^ ERROR type parameter has more than one relaxed default bound -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` impl S1 { fn f() where T: ?Sized {} diff --git a/tests/ui/unsized/maybe-bounds-where.stderr b/tests/ui/unsized/maybe-bounds-where.stderr index f785126166781..fb6d37c29660a 100644 --- a/tests/ui/unsized/maybe-bounds-where.stderr +++ b/tests/ui/unsized/maybe-bounds-where.stderr @@ -43,7 +43,7 @@ LL | fn f() where T: ?Sized {} = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bounds-where.rs:12:34 | LL | struct S4(T) where for<'a> T: ?Trait<'a>; @@ -58,13 +58,13 @@ LL | struct S5(*const T) where T: ?Trait<'static> + ?Sized; = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bounds-where.rs:16:33 | LL | struct S5(*const T) where T: ?Trait<'static> + ?Sized; | ^^^^^^^^^^^^^^^ -error: aborting due to 6 previous errors; 2 warnings emitted +error: aborting due to 8 previous errors Some errors have detailed explanations: E0203, E0658. For more information about an error, try `rustc --explain E0203`.