From 7523a334e4a31231a8a4ce74f61fefa0f578187e Mon Sep 17 00:00:00 2001 From: Ritik Mishra Date: Sun, 12 Mar 2023 05:15:11 -0700 Subject: [PATCH] Add some ICEs (#1525) --- ices/106238.rs | 13 +++++++++++++ ices/107409.rs | 25 +++++++++++++++++++++++++ ices/108399.rs | 22 ++++++++++++++++++++++ ices/108498.rs | 15 +++++++++++++++ ices/108683.rs | 7 +++++++ ices/108814.rs | 8 ++++++++ ices/109020.rs | 37 +++++++++++++++++++++++++++++++++++++ 7 files changed, 127 insertions(+) create mode 100644 ices/106238.rs create mode 100644 ices/107409.rs create mode 100644 ices/108399.rs create mode 100644 ices/108498.rs create mode 100644 ices/108683.rs create mode 100644 ices/108814.rs create mode 100644 ices/109020.rs diff --git a/ices/106238.rs b/ices/106238.rs new file mode 100644 index 00000000..aee64714 --- /dev/null +++ b/ices/106238.rs @@ -0,0 +1,13 @@ +#![feature(trait_alias)] +use core::ops::Add; + +pub trait DoSome {} + +// Trait alias causes compiler panic +pub trait Cell> = DoSome; + +struct _Container { + pub cells: dyn Cell, +} + +fn main() {} diff --git a/ices/107409.rs b/ices/107409.rs new file mode 100644 index 00000000..de495e44 --- /dev/null +++ b/ices/107409.rs @@ -0,0 +1,25 @@ +use std::marker::PhantomData as Boo; + +struct Gc<'gc, T: 'gc>(Boo &'gc T>); + +trait Rootable<'env> { + type AsRoot<'r>: Rootable<'r> + 'r + where + 'env: 'r; +} + +impl<'env, T: Rootable<'env>> Rootable<'env> for Gc<'env, T> { + type AsRoot<'r> = Gc<'r, T::AsRoot<'r>> where 'env: 'r; +} + +impl<'env> Rootable<'env> for i32 { + type AsRoot<'r> = i32 where 'env: 'r; +} + +fn reroot<'gc, T: Rootable<'gc>>(_t: T, _f: for<'a> fn(T::AsRoot<'a>)) {} + +fn test<'gc>(t: Gc<'gc, i32>) { + reroot(t, |_| ()); +} + +fn main() {} diff --git a/ices/108399.rs b/ices/108399.rs new file mode 100644 index 00000000..e54e5ce0 --- /dev/null +++ b/ices/108399.rs @@ -0,0 +1,22 @@ +#![feature(type_alias_impl_trait)] + +use std::future::Future; + +type FutNothing<'a> = impl 'a + Future; + +async fn operation(x: &mut ()) -> () { + () +} + +async fn indirect() { + call(operation).await +} + +async fn call(mut f: F) +where + for<'any> F: FnMut(&'any mut ()) -> FutNothing<'any>, +{ + f(&mut ()).await +} + +fn main() {} diff --git a/ices/108498.rs b/ices/108498.rs new file mode 100644 index 00000000..d51a6e4d --- /dev/null +++ b/ices/108498.rs @@ -0,0 +1,15 @@ +#![feature(type_alias_impl_trait)] +type Opaque = impl Sized; + +fn get_rpit() -> impl Clone {} + +fn query(_: impl FnOnce() -> Opaque) {} + +fn test() -> Opaque { + query(get_rpit); + get_rpit() +} + +fn main() { + test(); +} diff --git a/ices/108683.rs b/ices/108683.rs new file mode 100644 index 00000000..dd22e93f --- /dev/null +++ b/ices/108683.rs @@ -0,0 +1,7 @@ +fn example(var: i32) { + || { + let 0 = var; + }; +} + +fn main() {} diff --git a/ices/108814.rs b/ices/108814.rs new file mode 100644 index 00000000..b7215a9e --- /dev/null +++ b/ices/108814.rs @@ -0,0 +1,8 @@ +#![feature(non_lifetime_binders)] + +fn take(_: impl for FnOnce(T) -> T) {} + +fn main() { + take(|x| x) +} + diff --git a/ices/109020.rs b/ices/109020.rs new file mode 100644 index 00000000..ac9ac87b --- /dev/null +++ b/ices/109020.rs @@ -0,0 +1,37 @@ +#![feature(type_alias_impl_trait)] + +use core::marker::PhantomData; + +type WithEmplacableForFn<'a> = impl EmplacableFn + 'a; + +fn with_emplacable_for<'a, F, R>(mut f: F) -> R +where + F: for<'b> FnMut(Emplacable>) -> R, +{ + fn with_emplacable_for_inner<'a, R>( + _: &'a (), + _: &mut dyn FnMut(Emplacable>) -> R, + ) -> R { + fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> { + () + } + loop {} + } + + with_emplacable_for_inner(&(), &mut f) +} + +trait EmplacableFn {} + +impl EmplacableFn for () {} + +struct Emplacable +where + F: EmplacableFn, +{ + phantom: PhantomData, +} + +fn main() { + with_emplacable_for(|_| {}); +}