This repository was archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Add some ICEs #1525
Merged
JohnTitor
merged 3 commits into
rust-lang:master
from
ritikmishra:2023-11-03-add-some-ice
Mar 12, 2023
Merged
Add some ICEs #1525
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![feature(trait_alias)] | ||
use core::ops::Add; | ||
|
||
pub trait DoSome<T> {} | ||
|
||
// Trait alias causes compiler panic | ||
pub trait Cell<T: Add<T, Output=T>> = DoSome<T>; | ||
|
||
struct _Container<T> { | ||
pub cells: dyn Cell<T>, | ||
} | ||
|
||
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::marker::PhantomData as Boo; | ||
|
||
struct Gc<'gc, T: 'gc>(Boo<fn(&'gc T) -> &'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() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#![feature(type_alias_impl_trait)] | ||
|
||
use std::future::Future; | ||
|
||
type FutNothing<'a> = impl 'a + Future<Output = ()>; | ||
|
||
async fn operation(x: &mut ()) -> () { | ||
() | ||
} | ||
|
||
async fn indirect() { | ||
call(operation).await | ||
} | ||
|
||
async fn call<F>(mut f: F) | ||
where | ||
for<'any> F: FnMut(&'any mut ()) -> FutNothing<'any>, | ||
{ | ||
f(&mut ()).await | ||
} | ||
|
||
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fn example(var: i32) { | ||
|| { | ||
let 0 = var; | ||
}; | ||
} | ||
|
||
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![feature(non_lifetime_binders)] | ||
|
||
fn take(_: impl for<T> FnOnce(T) -> T) {} | ||
|
||
fn main() { | ||
take(|x| x) | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<WithEmplacableForFn<'b>>) -> R, | ||
{ | ||
fn with_emplacable_for_inner<'a, R>( | ||
_: &'a (), | ||
_: &mut dyn FnMut(Emplacable<WithEmplacableForFn<'a>>) -> R, | ||
) -> R { | ||
fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> { | ||
() | ||
} | ||
loop {} | ||
} | ||
|
||
with_emplacable_for_inner(&(), &mut f) | ||
} | ||
|
||
trait EmplacableFn {} | ||
|
||
impl EmplacableFn for () {} | ||
|
||
struct Emplacable<F> | ||
where | ||
F: EmplacableFn, | ||
{ | ||
phantom: PhantomData<F>, | ||
} | ||
|
||
fn main() { | ||
with_emplacable_for(|_| {}); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.