diff options
Diffstat (limited to 'src/test/ui/type-alias-impl-trait/bounds-are-checked-2.rs')
-rw-r--r-- | src/test/ui/type-alias-impl-trait/bounds-are-checked-2.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.rs b/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.rs new file mode 100644 index 000000000..55b4dc8dc --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/bounds-are-checked-2.rs @@ -0,0 +1,19 @@ +// Make sure that we check that impl trait types implement the traits that they +// claim to. + +#![feature(type_alias_impl_trait)] + +type X<T> = impl Clone; + +fn f<T: Clone>(t: T) -> X<T> { + t + //~^ ERROR the trait bound `T: Clone` is not satisfied +} + +fn g<T>(o: Option<X<T>>) -> Option<X<T>> { + o.clone() +} + +fn main() { + g(None::<X<&mut ()>>); +} |