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

Add 5 ICEs #327

Merged
merged 1 commit into from
Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions ices/70746.rs
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);
}
38 changes: 38 additions & 0 deletions ices/70877.rs
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());
}
5 changes: 5 additions & 0 deletions ices/70934.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
struct S;

fn main() {
&([S][0],);
}
6 changes: 6 additions & 0 deletions ices/70971.rs
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;
}
16 changes: 16 additions & 0 deletions ices/70972.rs
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() {}