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

Commit 13ca236

Browse files
authored
Merge pull request #1622 from albertlarsan68/add-ices
Add some ICEs
2 parents c1dd1f2 + 51f5e0f commit 13ca236

25 files changed

+375
-0
lines changed

ices/100041.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pub trait WellUnformed {
2+
type RequestNormalize;
3+
}
4+
5+
impl<T: ?Sized> WellUnformed for T {
6+
type RequestNormalize = ();
7+
}
8+
9+
pub fn latent(_: &[<[[()]] as WellUnformed>::RequestNormalize; 0]) {}
10+
11+
pub fn bang() {
12+
latent(&[]);
13+
}
14+
15+
fn main() {}

ices/110106.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(inherent_associated_types)]
2+
#![allow(incomplete_features)]
3+
4+
struct D<T> {
5+
a: T
6+
}
7+
8+
impl<T: Default> D<T> {
9+
type Item = T;
10+
11+
fn next() -> Self::Item {
12+
Self::Item::default()
13+
}
14+
}
15+
16+
17+
fn main() {
18+
}
19+

ices/110378.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(generic_const_exprs)]
2+
3+
fn foo<const L: usize>(_a: [u8; L], _b: [u8; L]) -> [u8; L + 1] {
4+
[0_u8; L + 1]
5+
}
6+
7+
fn main() {
8+
let baz = [[0_u8; 1]; 8];
9+
10+
let _: [u8; 4] = foo(foo(foo(baz[0], baz[1]), foo(baz[2], baz[3])), foo(foo(baz[4], baz[5]), foo(baz[6], baz[7])));
11+
//let _: [u8; 3] = foo(foo(baz[0], baz[1]), foo(baz[2], baz[3]));
12+
}
13+

ices/110630.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(generic_const_exprs)]
2+
3+
use std::ops::Mul;
4+
5+
pub trait Indices<const N: usize> {
6+
const NUM_ELEMS: usize = I::NUM_ELEMS * N;
7+
}
8+
9+
pub trait Concat<J> {
10+
type Output;
11+
}
12+
13+
pub struct Tensor<I: Indices<N>, const N: usize>
14+
where
15+
[u8; I::NUM_ELEMS]: Sized, {}
16+
17+
impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul<Tensor<J, N>> for Tensor<I, N>
18+
where
19+
I: Concat<T>,
20+
<I as Concat<J>>::Output: Indices<N>,
21+
[u8; I::NUM_ELEMS]: Sized,
22+
[u8; J::NUM_ELEMS]: Sized,
23+
[u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized,
24+
{
25+
type Output = Tensor<<I as Concat<J>>::Output, N>;
26+
}

ices/110696.rs

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
use std::marker::PhantomData;
4+
5+
6+
trait MyIndex<T> {
7+
type O;
8+
fn my_index(self) -> Self::O;
9+
}
10+
trait MyFrom<T>: Sized {
11+
type Error;
12+
fn my_from(value: T) -> Result<Self, Self::Error>;
13+
}
14+
15+
16+
trait F {}
17+
impl F for () {}
18+
type DummyT<T> = impl F;
19+
fn _dummy_t<T>() -> DummyT<T> {}
20+
21+
struct Phantom1<T>(PhantomData<T>);
22+
struct Phantom2<T>(PhantomData<T>);
23+
struct Scope<T>(Phantom2<DummyT<T>>);
24+
25+
impl<T> Scope<T> {
26+
fn new() -> Self {
27+
unimplemented!()
28+
}
29+
}
30+
31+
impl<T> MyFrom<Phantom2<T>> for Phantom1<T> {
32+
type Error = ();
33+
fn my_from(_: Phantom2<T>) -> Result<Self, Self::Error> {
34+
unimplemented!()
35+
}
36+
}
37+
38+
impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<DummyT<T>> for Scope<U> {
39+
type O = T;
40+
fn my_index(self) -> Self::O {
41+
MyFrom::my_from(self.0).ok().unwrap()
42+
}
43+
}
44+
45+
fn main() {
46+
let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
47+
}
48+

ices/110726.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn foo<'a>() -> impl Sized + 'a {
2+
let i: i32 = foo();
3+
i
4+
}
5+
6+
fn main() {}

ices/111176.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use std::mem;
2+
3+
pub struct S<T: Tr> {
4+
pub f: <T as Tr>::I,
5+
}
6+
7+
pub trait Tr {
8+
type I: Tr;
9+
}
10+
11+
impl<T: Tr> Tr for S<T> {
12+
type I = S<S<T>>;
13+
}
14+
15+
impl Tr for () {
16+
type I = ();
17+
}
18+
19+
fn foo<T: Tr>() -> usize {
20+
mem::size_of::<S<T>>()
21+
}
22+
23+
fn main() {
24+
println!("{}", foo::<S<()>>());
25+
}

ices/111353.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(unsized_fn_params)]
2+
pub fn f(mut x: [i32]) {
3+
x[0] = 1;
4+
}
5+
6+
fn main() {}

ices/111433.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(generic_const_exprs)]
2+
#![allow(incomplete_features)]
3+
4+
const fn inner<'a>() -> usize where &'a (): Sized {
5+
3
6+
}
7+
8+
fn test<'a>() {
9+
let _: [u8; inner::<'a>()];
10+
let _ = [0; inner::<'a>()];
11+
}
12+
13+
fn main() {
14+
test();
15+
}

ices/112347.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![feature(unboxed_closures)]
2+
3+
use std::future::Future;
4+
5+
trait Trait {
6+
fn func(&self, _: &str);
7+
}
8+
9+
impl<T> Trait for T
10+
where
11+
for<'a> T: Fn<(&'a str,)> + Send + Sync,
12+
for<'a> <T as FnOnce<(&'a str,)>>::Output: Future<Output = usize> + Send,
13+
{
14+
fn func(&self, _: &str) {
15+
println!("hello!");
16+
}
17+
}
18+
19+
async fn strlen(x: &str) -> usize {
20+
x.len()
21+
}
22+
23+
fn main() {
24+
strlen.func("hi");
25+
}

ices/112574.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(non_lifetime_binders)]
2+
3+
pub fn bar()
4+
where
5+
for<const N: usize = {
6+
(||1usize)()
7+
}> V: IntoIterator
8+
{
9+
}
10+
11+
fn main() {
12+
bar();
13+
}
14+

ices/112623.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![feature(const_trait_impl)]
2+
3+
#[const_trait]
4+
trait Func<T> {
5+
type Output;
6+
7+
fn call_once(self, arg: T) -> Self::Output;
8+
}
9+
10+
struct Closure;
11+
12+
impl const Func<&usize> for Closure {
13+
type Output = usize;
14+
15+
fn call_once(&'static self, arg: &usize) -> Self::Output {
16+
*arg
17+
}
18+
}
19+
20+
enum Bug<T = [(); Closure.call_once(&0)]> {
21+
V(T),
22+
}

ices/112631.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(inherent_associated_types)]
2+
#![allow(incomplete_features)]
3+
4+
struct Foo<T>(T);
5+
6+
impl<'a> Foo<fn(&'a ())> {
7+
type Assoc = &'a ();
8+
}
9+
10+
fn bar(_: for<'a> fn(Foo<fn(Foo<fn(&'static ())>::Assoc)>::Assoc)) {}
11+
12+
fn main() {}

ices/112832.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
pub trait QueryDb {
2+
type Db;
3+
}
4+
5+
pub struct QueryTable<Q, DB> {
6+
db: DB,
7+
storage: Q,
8+
}
9+
10+
impl<Q> QueryTable<Q, <Q as QueryDb>::Db> where Q: for<'d> AsyncQueryFunction<'d> {}
11+
12+
pub trait AsyncQueryFunction<'d>: QueryDb<Db = <Self as AsyncQueryFunction<'d>>::SendDb> {
13+
type SendDb: 'd;
14+
}
15+
16+
pub trait QueryStorageOpsAsync<Q>
17+
where
18+
Q: for<'d> AsyncQueryFunction<'d>,
19+
{
20+
}
21+
22+
fn main() {}

ices/113017.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(generic_const_exprs)]
2+
3+
pub fn String<V>(elem)
4+
where
5+
V: 'a,
6+
for<const N: usize = { || {}}> V: 'a,
7+
for<C2: , R2, R3: > <&str as IntoIterator>::Item: 'static,
8+
{}
9+

ices/113021.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(generic_const_exprs)]
2+
3+
pub async fn something(path: &[[usize; N_ISLANDS]; PrivateStruct]) -> usize {
4+
match path {
5+
[] | _ => 0,
6+
}
7+
}
8+
9+
pub fn main() {}
10+

ices/113133.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![allow(incomplete_features)]
2+
#![feature(generic_const_exprs, non_lifetime_binders)]
3+
4+
pub fn foo()
5+
where
6+
for<const N: usize = { const fn bar() {} bar(); 1 }> ():,
7+
{}
8+
9+
fn main() {}

ices/113272.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
trait Trait {
2+
type RefTarget;
3+
}
4+
5+
impl Trait for () where Missing: Trait {}
6+
7+
struct Other {
8+
data: <() as Trait>::RefTarget,
9+
}
10+
11+
fn main() {
12+
unsafe {
13+
std::mem::transmute::<Option<()>, Option<&Other>>(None);
14+
}
15+
}

ices/113280.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(dyn_star, pointer_like_trait)]
2+
#![allow(incomplete_features)]
3+
4+
use std::fmt::Debug;
5+
use std::marker::PointerLike;
6+
7+
fn make_dyn_star<'a>(t: impl PointerLike + Debug + 'a) -> dyn* Debug + 'a {
8+
f32::from_bits(0x1) as f64
9+
}
10+
11+
fn main() {
12+
println!("{:?}", make_dyn_star(Box::new(1i32)));
13+
}

ices/113326.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![allow(incomplete_features)]
2+
#![feature(const_trait_impl)]
3+
#![feature(const_closures)]
4+
#![feature(const_refs_to_cell)]
5+
#![feature(type_alias_impl_trait)]
6+
7+
pub type Diff = impl ~const std::marker::Destruct + ~const Fn(usize) -> usize;
8+
9+
pub const fn lift(n: usize) -> Diff {
10+
const move |m: usize| m + n
11+
}
12+
13+
pub const fn reify(n: Diff) -> usize {
14+
n(0)
15+
}
16+
17+
pub const fn add(n: Diff, m: Diff) -> Diff {
18+
const move |x: usize| m(n(x))
19+
}
20+
21+
fn main() {}

ices/113379.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
async fn f999() -> Vec<usize> {
2+
'b: {
3+
continue 'b;
4+
}
5+
}

ices/113434.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(return_position_impl_trait_in_trait)]
2+
3+
struct Wrapper<G: Send>(T);
4+
5+
trait Foo {
6+
fn bar() -> Wrapper<impl Sized>;
7+
}

ices/113462.rs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#[derive(Default)]
2+
struct NonGeneric<'a, const N: NonGeneric> {}

ices/113481.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait Foo {
2+
type Bar<'x>
3+
where
4+
Self: 'x;
5+
}
6+
7+
fn baz() -> impl for<'y> Foo<Bar<'y> = impl ToString> {
8+
42
9+
}
10+
11+
impl Foo for i32 {
12+
type Bar<'x> = &'x str;
13+
}

ices/113610.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn test5() {
2+
let t = (String::new(), Default::default());
3+
}

0 commit comments

Comments
 (0)