| 1 |
/* { dg-output "Bar::A = 456\r*\n<Foo as Bar>::A = 456\r*\n" } */ |
| 2 |
extern "C" { |
| 3 |
fn printf(s: *const i8, ...); |
| 4 |
} |
| 5 |
|
| 6 |
#[lang = "sized"] |
| 7 |
pub trait Sized {} |
| 8 |
|
| 9 |
trait Foo { |
| 10 |
const A: i32 = 123; |
| 11 |
} |
| 12 |
|
| 13 |
struct Bar; |
| 14 |
impl Foo for Bar { |
| 15 |
const A: i32 = 456; |
| 16 |
} |
| 17 |
|
| 18 |
fn main() -> i32 { |
| 19 |
let a; |
| 20 |
a = Bar::A; |
| 21 |
|
| 22 |
unsafe { |
| 23 |
let _a = "Bar::A = %i\n\0"; |
| 24 |
let _b = _a as *const str; |
| 25 |
let _c = _b as *const i8; |
| 26 |
printf(_c, a); |
| 27 |
} |
| 28 |
|
| 29 |
let b; |
| 30 |
b = <Bar as Foo>::A; |
| 31 |
|
| 32 |
unsafe { |
| 33 |
let _a = "<Foo as Bar>::A = %i\n\0"; |
| 34 |
let _b = _a as *const str; |
| 35 |
let _c = _b as *const i8; |
| 36 |
printf(_c, b); |
| 37 |
} |
| 38 |
|
| 39 |
0 |
| 40 |
} |