blob: 2ba87285ef161e0addd61da41af5aa586fd65ec6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* { dg-output "not\r*\n" } */
extern "C" {
fn printf(s: *const i8, ...);
}
#[lang = "not"]
pub trait Not {
type Output;
fn not(self) -> Self::Output;
}
impl Not for i32 {
type Output = i32;
fn not(self) -> i32 {
unsafe {
let a = "not\n\0";
let b = a as *const str;
let c = b as *const i8;
printf(c);
}
!self
}
}
fn main() -> i32 {
let a: i32 = 1;
let _b = !a;
0
}
|