Skip to content

Commit 741dddd

Browse files
authored
Merge pull request rust-lang#1273 from matthiaskrgr/29may
2 parents 355856c + 3951fe6 commit 741dddd

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

ices/97484.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
struct A;
2+
struct B;
3+
struct C;
4+
struct D;
5+
struct E;
6+
struct F;
7+
struct G;
8+
9+
fn foo(a: &A, d: D, e: &E, g: G) {}
10+
11+
fn main() {
12+
foo(&&A, B, C, D, E, F, G);
13+
}

ices/97490.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pub type Yes = extern "sysv64" fn(&'static u8) -> !;
2+
3+
fn main() {
4+
unsafe {
5+
let yes = &6 as *const _ as *const Yes;
6+
core::arch::asm!("call {}", in(reg) yes, options(noreturn));
7+
}
8+
}

ices/97491.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::ops::Sub;
2+
3+
trait Vector2 {
4+
type ScalarType;
5+
fn from_values(x: Self::ScalarType, y: Self::ScalarType) -> Self
6+
where Self: Sized;
7+
fn x(&self) -> Self::ScalarType;
8+
fn y(&self) -> Self::ScalarType;
9+
}
10+
11+
impl<T> Sub for dyn Vector2<ScalarType=T>
12+
where T: Sub<Output=T>,
13+
(dyn Vector2<ScalarType=T>): Sized{
14+
type Output = dyn Vector2<ScalarType=T>;
15+
fn sub(self, rhs: Self) -> Self::Output {
16+
Self::from_values(self.x()-rhs.x(), self.y() - rhs.y())
17+
}
18+
}
19+
20+
fn main() {}

ices/97501.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![feature(core_intrinsics)]
2+
use std::intrinsics::wrapping_add;
3+
4+
#[derive(Clone, Copy)]
5+
struct WrapInt8 {
6+
value: u8
7+
}
8+
9+
impl std::ops::Add for WrapInt8 {
10+
type Output = WrapInt8;
11+
fn add(self, other: WrapInt8) -> WrapInt8 {
12+
wrapping_add(self, other)
13+
}
14+
}
15+
16+
fn main() {
17+
let p = WrapInt8 { value: 123 };
18+
let q = WrapInt8 { value: 234 };
19+
println!("{}", (p + q).value);
20+
}

0 commit comments

Comments
 (0)