blob: 22182825490c1e2a50dd2fcfb7eec342ee63ea7d (
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
|
#[lang = "sized"]
pub trait Sized {}
mod core {
mod ops {
#[lang = "add"]
pub trait Add<Rhs = Self> {
type Output;
fn add(self, rhs: Rhs) -> Self::Output;
}
}
}
impl core::ops::Add for i32 {
type Output = i32;
fn add(self, rhs: i32) -> Self::Output {
self + rhs
}
}
pub fn foo<T: core::ops::Add<Output = i32>>(a: T) -> i32 {
a + a
}
pub fn main() -> i32 {
foo(1) - 2
}
|