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

Commit 7523a33

Browse files
authored
Add some ICEs (#1525)
1 parent dfef762 commit 7523a33

File tree

7 files changed

+127
-0
lines changed

7 files changed

+127
-0
lines changed

ices/106238.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(trait_alias)]
2+
use core::ops::Add;
3+
4+
pub trait DoSome<T> {}
5+
6+
// Trait alias causes compiler panic
7+
pub trait Cell<T: Add<T, Output=T>> = DoSome<T>;
8+
9+
struct _Container<T> {
10+
pub cells: dyn Cell<T>,
11+
}
12+
13+
fn main() {}

ices/107409.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use std::marker::PhantomData as Boo;
2+
3+
struct Gc<'gc, T: 'gc>(Boo<fn(&'gc T) -> &'gc T>);
4+
5+
trait Rootable<'env> {
6+
type AsRoot<'r>: Rootable<'r> + 'r
7+
where
8+
'env: 'r;
9+
}
10+
11+
impl<'env, T: Rootable<'env>> Rootable<'env> for Gc<'env, T> {
12+
type AsRoot<'r> = Gc<'r, T::AsRoot<'r>> where 'env: 'r;
13+
}
14+
15+
impl<'env> Rootable<'env> for i32 {
16+
type AsRoot<'r> = i32 where 'env: 'r;
17+
}
18+
19+
fn reroot<'gc, T: Rootable<'gc>>(_t: T, _f: for<'a> fn(T::AsRoot<'a>)) {}
20+
21+
fn test<'gc>(t: Gc<'gc, i32>) {
22+
reroot(t, |_| ());
23+
}
24+
25+
fn main() {}

ices/108399.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
use std::future::Future;
4+
5+
type FutNothing<'a> = impl 'a + Future<Output = ()>;
6+
7+
async fn operation(x: &mut ()) -> () {
8+
()
9+
}
10+
11+
async fn indirect() {
12+
call(operation).await
13+
}
14+
15+
async fn call<F>(mut f: F)
16+
where
17+
for<'any> F: FnMut(&'any mut ()) -> FutNothing<'any>,
18+
{
19+
f(&mut ()).await
20+
}
21+
22+
fn main() {}

ices/108498.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(type_alias_impl_trait)]
2+
type Opaque = impl Sized;
3+
4+
fn get_rpit() -> impl Clone {}
5+
6+
fn query(_: impl FnOnce() -> Opaque) {}
7+
8+
fn test() -> Opaque {
9+
query(get_rpit);
10+
get_rpit()
11+
}
12+
13+
fn main() {
14+
test();
15+
}

ices/108683.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn example(var: i32) {
2+
|| {
3+
let 0 = var;
4+
};
5+
}
6+
7+
fn main() {}

ices/108814.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(non_lifetime_binders)]
2+
3+
fn take(_: impl for<T> FnOnce(T) -> T) {}
4+
5+
fn main() {
6+
take(|x| x)
7+
}
8+

ices/109020.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
use core::marker::PhantomData;
4+
5+
type WithEmplacableForFn<'a> = impl EmplacableFn + 'a;
6+
7+
fn with_emplacable_for<'a, F, R>(mut f: F) -> R
8+
where
9+
F: for<'b> FnMut(Emplacable<WithEmplacableForFn<'b>>) -> R,
10+
{
11+
fn with_emplacable_for_inner<'a, R>(
12+
_: &'a (),
13+
_: &mut dyn FnMut(Emplacable<WithEmplacableForFn<'a>>) -> R,
14+
) -> R {
15+
fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> {
16+
()
17+
}
18+
loop {}
19+
}
20+
21+
with_emplacable_for_inner(&(), &mut f)
22+
}
23+
24+
trait EmplacableFn {}
25+
26+
impl EmplacableFn for () {}
27+
28+
struct Emplacable<F>
29+
where
30+
F: EmplacableFn,
31+
{
32+
phantom: PhantomData<F>,
33+
}
34+
35+
fn main() {
36+
with_emplacable_for(|_| {});
37+
}

0 commit comments

Comments
 (0)