diff --git a/ices/80351.rs b/ices/80351.rs new file mode 100644 index 00000000..3d90ee00 --- /dev/null +++ b/ices/80351.rs @@ -0,0 +1,19 @@ +fn main() { + enqueue::<(), _>(|_result| {}); +} + +trait Query<'a> { + type Result: 'a; + fn execute() -> Self::Result; +} + +impl<'a> Query<'a> for () { + type Result = (); + fn execute() -> () { + () + } +} + +fn enqueue Query<'q>, F: 'static + for<'r> FnOnce(>::Result)>(f: F) { + let _: Box = Box::new(move || f(Q::execute())); +} diff --git a/ices/81199.rs b/ices/81199.rs new file mode 100644 index 00000000..a45cbc14 --- /dev/null +++ b/ices/81199.rs @@ -0,0 +1,9 @@ +union PtrRepr { + const_ptr: *const T, + mut_ptr: *mut T, + components: ::Metadata +} + +pub trait Pointee { + type Metadata; +} diff --git a/ices/81786.sh b/ices/81786.sh new file mode 100644 index 00000000..bfaaa34c --- /dev/null +++ b/ices/81786.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +cat > out.rs <<'EOF' +#![feature(auto_traits, negative_impls)] + +auto trait AutoTrait {} + +pub struct Struct { + k: K, + v: V +} + +impl !AutoTrait for *const T {} + +impl AutoTrait for Struct +where + K: AutoTrait, + V: AutoTrait, +{ +} + +impl AutoTrait for Struct {} + +pub struct Wrap<'a> { + inner: &'a Struct, +} + +fn main() {} +EOF + +rustdoc out.rs --output-format json diff --git a/ices/81809.rs b/ices/81809.rs new file mode 100644 index 00000000..7e67c47e --- /dev/null +++ b/ices/81809.rs @@ -0,0 +1,74 @@ +use std::ops::Index; + +pub trait Indexable { + type Index; +} +struct Foo; +struct Bar; +impl Indexable for Foo { type Index = u8; } +impl Indexable for Bar { type Index = u16; } + +pub trait Indexer: Index {} + +struct Store; + +impl Index for Store { + type Output = Foo; + fn index(&self, _: u8) -> &Foo { panic!() } +} +impl Index for Store { + type Output = Bar; + fn index(&self, _: u16) -> &Bar { panic!() } +} +impl Indexer for Store { } +impl Indexer for Store { } + +// implies StoreIndex: Index + Index +trait StoreIndex: Indexer + Indexer {} + +impl StoreIndex for Store {} + +struct Collection { + stores: Vec, +} + +trait StoreCollection { + fn get_store(&self, _: usize) -> Option<&dyn StoreIndex>; +} + +impl StoreCollection for Collection { + // Fails to compile: + // expected: + // Option<&dyn StoreIndex + // found: + // Option<&Store> + /* + fn get_store(&self, i: usize) -> Option<&dyn StoreIndex> { + self.stores.get(i) + } + */ + + // ICE + fn get_store(&self, i: usize) -> Option<&dyn StoreIndex> { + if let Some(s) = self.stores.get(i) { + Some(s as &dyn StoreIndex) + } else { + None + } + } + + // However, if the above is removed in favor of Indexing + // type checking succeeds and the type of `&self.stores[i]` + // is properly inferred + /* + fn get_store(&self, i: usize) -> Option<&dyn StoreIndex> { + if i < self.stores.len() { + Some(&self.stores[i]) + } else { + None + } + } + */ +} + +fn main() {} diff --git a/ices/81899.rs b/ices/81899.rs new file mode 100644 index 00000000..4c0a2a6d --- /dev/null +++ b/ices/81899.rs @@ -0,0 +1,10 @@ +const _CONST: &[u8] = &f(&[], |_| {}); + +const fn f(_: &[u8], _: F) -> &[u8] +where + F: FnMut(&u8), +{ + panic!() +} + +fn main() {} diff --git a/ices/81924.rs b/ices/81924.rs new file mode 100644 index 00000000..fa0bdb76 --- /dev/null +++ b/ices/81924.rs @@ -0,0 +1 @@ +#![a = {enum b {