diff options
Diffstat (limited to 'tests/ui/object-safety/object-safety-bounds.rs')
-rw-r--r-- | tests/ui/object-safety/object-safety-bounds.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/object-safety/object-safety-bounds.rs b/tests/ui/object-safety/object-safety-bounds.rs new file mode 100644 index 000000000..44bd36932 --- /dev/null +++ b/tests/ui/object-safety/object-safety-bounds.rs @@ -0,0 +1,12 @@ +// Traits with bounds mentioning `Self` are not object safe + +trait X { + type U: PartialEq<Self>; +} + +fn f() -> Box<dyn X<U = u32>> { + //~^ ERROR the trait `X` cannot be made into an object + loop {} +} + +fn main() {} |