rust/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
1.1 KiB
Rust
Raw Normal View History

#![feature(auto_traits)]
trait Trait1 {}
auto trait Trait2 {}
trait Trait3: ?Trait1 {}
//~^ ERROR `?Trait` is not permitted in supertraits
trait Trait4 where Self: ?Trait1 {}
//~^ ERROR ?Trait` bounds are only permitted at the point where a type parameter is declared
fn foo(_: Box<dyn Trait1 + ?Trait2>) {}
//~^ ERROR `?Trait` is not permitted in trait object types
fn bar<T: ?Trait1 + ?Trait2>(_: 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
2024-07-26 08:33:30 -05:00
trait Trait {}
// Do not suggest `#![feature(more_maybe_bounds)]` for repetitions
fn baz<T: ?Trait + ?Trait>(_ : 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
fn main() {}