Debian Codegraph @

gcc/testsuite/rust/compile/torture/traits8.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 trait Foo {
5 fn default() -> i32;
6 }
7
8 struct Bar(i32);
9 // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }
10
11 impl Foo for Bar {
12 fn default() -> i32 {
13 123
14 }
15 }
16
17 fn type_bound_test<T: Foo>() -> i32 {
18 T::default()
19 }
20
21 fn main() {
22 let a;
23 a = type_bound_test::<Bar>();
24 }