mirror of
https://github.com/rust-lang/rust
synced 2024-09-06 01:11:17 +00:00
23 lines
403 B
Rust
23 lines
403 B
Rust
// Make sure that we check that impl trait types implement the traits that they
|
|
// claim to.
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
mod foo {
|
|
pub type X<T> = impl Clone;
|
|
|
|
fn f<T: Clone>(t: T) -> X<T> {
|
|
t
|
|
//~^ ERROR the trait bound `T: Clone` is not satisfied
|
|
}
|
|
}
|
|
use foo::X;
|
|
|
|
fn g<T>(o: Option<X<T>>) -> Option<X<T>> {
|
|
o.clone()
|
|
}
|
|
|
|
fn main() {
|
|
g(None::<X<&mut ()>>);
|
|
}
|