| 1 |
#[lang = "sized"] |
| 2 |
pub trait Sized {} |
| 3 |
|
| 4 |
trait Foo { |
| 5 |
type A; |
| 6 |
|
| 7 |
fn test(a: Self::A) -> Self::A { |
| 8 |
a |
| 9 |
} |
| 10 |
} |
| 11 |
|
| 12 |
struct Bar(i32); |
| 13 |
// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } |
| 14 |
|
| 15 |
impl Foo for Bar { |
| 16 |
type A = i32; |
| 17 |
} |
| 18 |
|
| 19 |
struct Baz(f32); |
| 20 |
// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 } |
| 21 |
|
| 22 |
impl Foo for Baz { |
| 23 |
type A = f32; |
| 24 |
} |
| 25 |
|
| 26 |
fn main() { |
| 27 |
let a: <Baz as Foo>::A; |
| 28 |
a = 123f32; |
| 29 |
|
| 30 |
let b; |
| 31 |
b = <Baz as Foo>::test(a); |
| 32 |
} |