This repository has been 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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #327 from JohnTitor/add-ices
Add 5 ICEs
- Loading branch information
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,27 @@ | ||
pub trait Trait1 { | ||
type C; | ||
} | ||
|
||
struct T1; | ||
impl Trait1 for T1 { | ||
type C = usize; | ||
} | ||
pub trait Callback<T: Trait1>: FnMut(<T as Trait1>::C) {} | ||
impl<T: Trait1, F: FnMut(<T as Trait1>::C)> Callback<T> for F {} | ||
|
||
pub struct State<T: Trait1> { | ||
callback: Option<Box<dyn Callback<T>>>, | ||
} | ||
impl<T: Trait1> State<T> { | ||
fn new() -> Self { | ||
Self { callback: None } | ||
} | ||
fn test_cb(&mut self, d: <T as Trait1>::C) { | ||
(self.callback.as_mut().unwrap())(d) | ||
} | ||
} | ||
|
||
fn main() { | ||
let mut s = State::<T1>::new(); | ||
s.test_cb(1); | ||
} |
This file contains 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,38 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(type_alias_impl_trait)] | ||
#![feature(impl_trait_in_bindings)] | ||
|
||
type FooArg<'a> = &'a dyn ToString; | ||
type FooRet = impl std::fmt::Debug; | ||
|
||
type FooItem = Box<dyn Fn(FooArg) -> FooRet>; | ||
type Foo = impl Iterator<Item = FooItem>; | ||
|
||
#[repr(C)] | ||
struct Bar(u8); | ||
|
||
impl Iterator for Bar { | ||
type Item = FooItem; | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
Some(Box::new(quux)) | ||
} | ||
} | ||
|
||
fn quux(st: FooArg) -> FooRet { | ||
Some(st.to_string()) | ||
} | ||
|
||
fn ham() -> Foo { | ||
Bar(1) | ||
} | ||
|
||
fn oof() -> impl std::fmt::Debug { | ||
let mut bar = ham(); | ||
let func = bar.next().unwrap(); | ||
return func(&"oof"); | ||
} | ||
|
||
fn main() { | ||
println!("{:?}", oof()); | ||
} |
This file contains 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,5 @@ | ||
struct S; | ||
|
||
fn main() { | ||
&([S][0],); | ||
} |
This file contains 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,6 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(impl_trait_in_bindings)] | ||
|
||
fn main() { | ||
let ref _x: impl Sized = 5; | ||
} |
This file contains 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,16 @@ | ||
use std::sync::atomic::{AtomicPtr, Ordering}; | ||
|
||
const P: &dyn T = &S as &dyn T; | ||
static mut LOGGER: AtomicPtr<&dyn T> = AtomicPtr::new(&mut P); | ||
|
||
pub trait T {} | ||
struct S; | ||
impl T for S {} | ||
|
||
pub fn f() { | ||
match *LOGGER.load(Ordering::SeqCst) { | ||
P | _ => {} | ||
} | ||
} | ||
|
||
fn main() {} |