diff options
Diffstat (limited to 'tests/ui/trait-bounds/duplicate-relaxed-bounds.rs')
| -rw-r--r-- | tests/ui/trait-bounds/duplicate-relaxed-bounds.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/trait-bounds/duplicate-relaxed-bounds.rs b/tests/ui/trait-bounds/duplicate-relaxed-bounds.rs new file mode 100644 index 00000000000..a1681ddec77 --- /dev/null +++ b/tests/ui/trait-bounds/duplicate-relaxed-bounds.rs @@ -0,0 +1,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() {} |
