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

File tree

8 files changed

+137
-0
lines changed

8 files changed

+137
-0
lines changed

ices/106238.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
14+
fn main() {}
15+

ices/107409.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 where 'env: 'r;
7+
}
8+
9+
impl<'env, T: Rootable<'env>> Rootable<'env> for Gc<'env, T> {
10+
type AsRoot<'r> = Gc<'r, T::AsRoot<'r>> where 'env: 'r;
11+
}
12+
13+
impl<'env> Rootable<'env> for i32 {
14+
type AsRoot<'r> = i32 where 'env: 'r;
15+
}
16+
17+
fn reroot<'gc, T: Rootable<'gc>>(_t: T, _f: for<'a> fn(T::AsRoot<'a>)) {
18+
}
19+
20+
fn test<'gc>(t: Gc<'gc, i32>) {
21+
reroot(t, |_| ());
22+
}
23+
24+
fn main() {}

ices/108399.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+

ices/108498.rs

+15
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

+7
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

+8
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/108832.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
fn ice()
2+
where
3+
for<'w> fn(&'w ()): FnMut(&'w ()),
4+
{
5+
}
6+
7+
fn main() {
8+
ice();
9+
}

ices/109020.rs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
}
38+

0 commit comments

Comments
 (0)