about summary refs log tree commit diff
path: root/tests/ui/trait-bounds/duplicate-relaxed-bounds.rs
blob: a1681ddec77b0abb79a54397ad5552e9578c23e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
fn dupes<T: ?Sized + ?Sized + ?Iterator + ?Iterator>() {}
//~^ ERROR duplicate relaxed `Sized` bounds
//~| ERROR duplicate relaxed `Iterator` bounds
//~| ERROR bound modifier `?` can only be applied to `Sized`
//~| ERROR bound modifier `?` can only be applied to `Sized`

trait Trait {
    // We used to say "type parameter has more than one relaxed default bound"
    // even on *associated types* like here. Test that we no longer do that.
    type Type: ?Sized + ?Sized;
    //~^ ERROR duplicate relaxed `Sized` bounds
    //~| ERROR duplicate relaxed `Sized` bounds
}

// We used to emit an additional error about "multiple relaxed default bounds".
// However, multiple relaxed bounds are actually *fine* if they're distinct.
// Ultimately, we still reject this because `Sized` is
// the only (stable) default trait, so we're fine.
fn not_dupes<T: ?Sized + ?Iterator>() {}
//~^ ERROR bound modifier `?` can only be applied to `Sized`

fn main() {}