mirror of https://github.com/rust-lang/rust
19 lines
414 B
Rust
19 lines
414 B
Rust
//! This test checks that associated types with `Self: Sized` cannot be projected
|
|
//! from a `dyn Trait`.
|
|
|
|
trait Bop {
|
|
type Bar: Default
|
|
where
|
|
Self: Sized;
|
|
}
|
|
|
|
fn bop<T: Bop + ?Sized>() {
|
|
let _ = <T as Bop>::Bar::default();
|
|
//~^ ERROR: trait bounds were not satisfied
|
|
//~| ERROR: the size for values of type `T` cannot be known at compilation time
|
|
}
|
|
|
|
fn main() {
|
|
bop::<dyn Bop>();
|
|
}
|