From 46a8d6e38bb45fe3b1fa37072f266b8f22ec85c7 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sat, 11 Apr 2020 08:39:36 +0900 Subject: [PATCH] Add 5 ICEs --- ices/70746.rs | 27 +++++++++++++++++++++++++++ ices/70877.rs | 38 ++++++++++++++++++++++++++++++++++++++ ices/70934.rs | 5 +++++ ices/70971.rs | 6 ++++++ ices/70972.rs | 16 ++++++++++++++++ 5 files changed, 92 insertions(+) create mode 100644 ices/70746.rs create mode 100644 ices/70877.rs create mode 100644 ices/70934.rs create mode 100644 ices/70971.rs create mode 100644 ices/70972.rs diff --git a/ices/70746.rs b/ices/70746.rs new file mode 100644 index 00000000..c43d10a7 --- /dev/null +++ b/ices/70746.rs @@ -0,0 +1,27 @@ +pub trait Trait1 { + type C; +} + +struct T1; +impl Trait1 for T1 { + type C = usize; +} +pub trait Callback: FnMut(::C) {} +impl::C)> Callback for F {} + +pub struct State { + callback: Option>>, +} +impl State { + fn new() -> Self { + Self { callback: None } + } + fn test_cb(&mut self, d: ::C) { + (self.callback.as_mut().unwrap())(d) + } +} + +fn main() { + let mut s = State::::new(); + s.test_cb(1); +} diff --git a/ices/70877.rs b/ices/70877.rs new file mode 100644 index 00000000..991136ad --- /dev/null +++ b/ices/70877.rs @@ -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 FooRet>; +type Foo = impl Iterator; + +#[repr(C)] +struct Bar(u8); + +impl Iterator for Bar { + type Item = FooItem; + + fn next(&mut self) -> Option { + 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()); +} diff --git a/ices/70934.rs b/ices/70934.rs new file mode 100644 index 00000000..bbaa2188 --- /dev/null +++ b/ices/70934.rs @@ -0,0 +1,5 @@ +struct S; + +fn main() { + &([S][0],); +} diff --git a/ices/70971.rs b/ices/70971.rs new file mode 100644 index 00000000..afbdc1b3 --- /dev/null +++ b/ices/70971.rs @@ -0,0 +1,6 @@ +#![allow(incomplete_features)] +#![feature(impl_trait_in_bindings)] + +fn main() { + let ref _x: impl Sized = 5; +} diff --git a/ices/70972.rs b/ices/70972.rs new file mode 100644 index 00000000..4f5a5553 --- /dev/null +++ b/ices/70972.rs @@ -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() {}