| 1 |
// { dg-output "Foo::bar\r*\n" } |
| 2 |
// { dg-additional-options "-w" } |
| 3 |
extern "C" { |
| 4 |
fn printf(s: *const i8, ...); |
| 5 |
} |
| 6 |
|
| 7 |
#[lang = "sized"] |
| 8 |
pub trait Sized {} |
| 9 |
|
| 10 |
struct Foo {} |
| 11 |
|
| 12 |
trait Bar { |
| 13 |
fn bar(&self) { |
| 14 |
unsafe { |
| 15 |
let _a = "Bar::bar\n\0"; |
| 16 |
let _b = _a as *const str; |
| 17 |
let _c = _b as *const i8; |
| 18 |
printf(_c); |
| 19 |
} |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
impl Foo { |
| 24 |
fn bar(&self) { |
| 25 |
unsafe { |
| 26 |
let _a = "Foo::bar\n\0"; |
| 27 |
let _b = _a as *const str; |
| 28 |
let _c = _b as *const i8; |
| 29 |
printf(_c); |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
impl Bar for Foo { |
| 35 |
fn bar(&self) { |
| 36 |
unsafe { |
| 37 |
let _a = "<Bar as Foo>::bar\n\0"; |
| 38 |
let _b = _a as *const str; |
| 39 |
let _c = _b as *const i8; |
| 40 |
printf(_c); |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
pub fn main() -> i32 { |
| 46 |
let mut f = Foo {}; |
| 47 |
f.bar(); |
| 48 |
|
| 49 |
0 |
| 50 |
} |