about summary refs log tree commit diff
path: root/tests/ui/traits/maybe-polarity-pass.rs
blob: 1ccd52bc1694a47e63369f058d1d9ddf33e668e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#![feature(auto_traits)]
#![feature(more_maybe_bounds)]
#![feature(negative_impls)]

trait Trait1 {}
auto trait Trait2 {}

trait Trait3 : ?Trait1 {}
trait Trait4 where Self: Trait1 {}

fn foo(_: Box<(dyn Trait3 + ?Trait2)>) {}
fn bar<T: ?Sized + ?Trait2 + ?Trait1 + ?Trait4>(_: &T) {}
//~^ 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 {}
impl Trait1 for S {}
impl Trait3 for S {}

fn main() {
    foo(Box::new(S));
    bar(&S);
}