Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 2b1d085

Browse files
Add some ICEs
1 parent 38883be commit 2b1d085

13 files changed

+253
-0
lines changed

ices/102465.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![feature(lang_items, no_core)]
2+
#![no_std]
3+
#![no_core]
4+
5+
#[lang = "sized"]
6+
pub trait Sized {}
7+
8+
#[lang = "copy"]
9+
trait Copy {}
10+
11+
fn bla(argc: isize) {
12+
match argc {
13+
1 => 1, // removing this arm fixes the ICE
14+
_ => 1,
15+
};
16+
}
17+
18+
fn main() {}

ices/105047.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(raw_ref_op)]
2+
3+
const RCZ: *const i32 = &raw const *&0;
4+
5+
const fn f() {
6+
if let RCZ = &raw const *&0 {}
7+
}
8+
9+
fn main() {}

ices/105819.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(type_alias_impl_trait)]
2+
// check-pass
3+
4+
fn main() {}
5+
6+
fn upvar() {
7+
#[derive(Copy, Clone)]
8+
struct Foo((u32, u32));
9+
10+
type T = impl Copy;
11+
let foo: T = Foo((1u32, 2u32));
12+
let x = move || {
13+
let Foo((a, b)) = foo;
14+
};
15+
}

ices/105937.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> {
2+
if n > 15 {
3+
encode_num(n / 16, &mut writer)?;
4+
}
5+
Ok(())
6+
}
7+
8+
pub trait ExampleWriter {
9+
type Error;
10+
}
11+
12+
impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T {
13+
type Error = T::Error;
14+
}
15+
16+
struct Error;
17+
18+
impl ExampleWriter for Error {
19+
type Error = ();
20+
}
21+
22+
fn main() {
23+
encode_num(69, &mut Error).unwrap();
24+
}

ices/108580.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
2+
#![allow(incomplete_features)]
3+
4+
trait Iterator {
5+
type Item;
6+
}
7+
8+
trait IntoIterator {
9+
fn into_iterator(&self) -> impl Iterator<Item: > + '_;
10+
}
11+
12+
struct IntoIterFn<F, I> {
13+
f: F,
14+
_marker: core::marker::PhantomData<I>,
15+
}
16+
17+
impl<F, I> IntoIterator for IntoIterFn<F, I>
18+
where
19+
F: Fn() -> I,
20+
I: Iterator,
21+
{
22+
fn into_iterator(&self) -> impl Iterator<Item: '_> {
23+
(self.f)()
24+
}
25+
}
26+
27+
fn main() {}

ices/109239.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![allow(incomplete_features)]
2+
#![feature(return_position_impl_trait_in_trait)]
3+
#![crate_type = "lib"]
4+
5+
trait Trait {
6+
type Type;
7+
8+
fn method(&self) -> impl Trait<Type = impl Trait<Type = impl Sized + '_> + '_>;
9+
}
10+
11+
fn main() {}

ices/109281.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(type_alias_impl_trait)]
2+
struct S;
3+
type ReturnType<'a> = impl Eq + 'a;
4+
impl std::ops::Deref for S {
5+
type Target = dyn Fn(&()) -> ReturnType;
6+
fn deref() -> &'static Self::Target {}
7+
}
8+
9+
fn main() {}

ices/109298.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
fn arr_by_ref(mut x: [(); 3]) {
2+
let f = || {
3+
let [ref y, ref mut z @ ..] = x;
4+
};
5+
f();
6+
}
7+
8+
fn main() {}

ices/109299.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
trait Document {
2+
fn cursor(&self) -> Lexer::Cursor<'_>;
3+
}
4+
5+
struct Lexer<'d> {
6+
cursor: (),
7+
_phantom: std::marker::PhantomData<&'d ()>,
8+
}
9+
10+
impl<'cursor> Lexer<'d> {
11+
type Cursor<'a> = DocCursorImpl<'a>;
12+
}
13+
14+
fn main() {}

ices/109300.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(generic_const_exprs)]
2+
trait B {
3+
type U<T: A>;
4+
}
5+
6+
fn f<T: B<U<1i32> = ()>>() {}
7+
8+
fn main() {}

ices/109304.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#![recursion_limit = "10"]
2+
macro_rules! link {
3+
($outer:ident, $inner:ident) => {
4+
struct $outer($inner);
5+
impl $outer {
6+
fn new() -> $outer {
7+
$outer($inner::new())
8+
}
9+
}
10+
impl std::ops::Deref for $outer {
11+
type Target = $inner;
12+
fn deref(&self) -> &$inner {
13+
&self.0
14+
}
15+
}
16+
};
17+
}
18+
19+
struct Bottom;
20+
21+
impl Bottom {
22+
fn new() -> Bottom {
23+
Bottom
24+
}
25+
}
26+
27+
link!(Top, A);
28+
link!(A, B);
29+
link!(B, C);
30+
link!(C, D);
31+
link!(D, E);
32+
link!(E, F);
33+
link!(F, G);
34+
link!(G, H);
35+
link!(H, I);
36+
link!(I, J);
37+
link!(J, K);
38+
link!(K, Bottom);
39+
40+
fn main() {}

ices/95134.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> {
2+
if n > 15 {
3+
encode_num(n / 16, &mut writer)?;
4+
}
5+
Ok(())
6+
}
7+
8+
pub trait ExampleWriter {
9+
type Error;
10+
}
11+
12+
impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T {
13+
type Error = T::Error;
14+
}
15+
16+
struct EmptyWriter;
17+
18+
impl ExampleWriter for EmptyWriter {
19+
type Error = ();
20+
}
21+
22+
fn main() {
23+
encode_num(69, &mut EmptyWriter).unwrap();
24+
}

ices/98010.rs

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#![no_std]
2+
#![no_core]
3+
#![no_main]
4+
#![feature(no_core, lang_items)]
5+
6+
#[lang = "sized"]
7+
trait Sized {}
8+
#[lang = "sync"]
9+
trait Sync {}
10+
#[lang = "copy"]
11+
trait Copy {}
12+
#[lang = "freeze"]
13+
trait Freeze {}
14+
15+
impl Sync for u32 {}
16+
impl Sync for i32 {}
17+
18+
// impl Copy for u32 {} // if remove, it cause rustc crash
19+
20+
#[lang = "drop_in_place"]
21+
#[allow(unconditional_recursion)]
22+
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
23+
unsafe { drop_in_place(to_drop) }
24+
}
25+
26+
#[link(name = "Kernel32")]
27+
extern "system" {
28+
pub fn ExitProcess(uexitcode: u32) -> !;
29+
}
30+
31+
fn exit_process(exit_code: u32) -> ! {
32+
// Copying is necessary to pass the value through the function argument, and if this is avoided, there will be no error either.
33+
unsafe {
34+
ExitProcess(exit_code);
35+
}
36+
}
37+
38+
#[no_mangle]
39+
pub extern "C" fn wWinMainCRTStartup() -> i32 {
40+
exit_process(0);
41+
}
42+
43+
#[no_mangle]
44+
pub static _fltused: i32 = 1;
45+
46+
fn main() {}

0 commit comments

Comments
 (0)