]> git.lizzy.rs Git - rust.git/blob - tests/ui/type-alias-impl-trait/bounds-are-checked-2.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / type-alias-impl-trait / bounds-are-checked-2.rs
1 // Make sure that we check that impl trait types implement the traits that they
2 // claim to.
3
4 #![feature(type_alias_impl_trait)]
5
6 type X<T> = impl Clone;
7
8 fn f<T: Clone>(t: T) -> X<T> {
9     t
10     //~^ ERROR the trait bound `T: Clone` is not satisfied
11 }
12
13 fn g<T>(o: Option<X<T>>) -> Option<X<T>> {
14     o.clone()
15 }
16
17 fn main() {
18     g(None::<X<&mut ()>>);
19 }