2015-02-17 09:57:15 -06:00
|
|
|
// Check that we correctly prevent users from making trait objects
|
|
|
|
// form traits that make use of `Self` in an argument or return position.
|
|
|
|
|
|
|
|
trait Bar<T> {
|
|
|
|
fn bar(&self, x: &T);
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Baz : Bar<Self> {
|
|
|
|
}
|
|
|
|
|
2019-05-28 13:46:13 -05:00
|
|
|
fn make_bar<T:Bar<u32>>(t: &T) -> &dyn Bar<u32> {
|
2015-02-17 09:57:15 -06:00
|
|
|
t
|
|
|
|
}
|
|
|
|
|
2019-05-28 13:46:13 -05:00
|
|
|
fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
|
2015-09-24 10:27:29 -05:00
|
|
|
//~^ ERROR E0038
|
2015-02-17 09:57:15 -06:00
|
|
|
t
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|