diff --git a/ices/102465.rs b/ices/102465.rs new file mode 100644 index 00000000..d871e940 --- /dev/null +++ b/ices/102465.rs @@ -0,0 +1,18 @@ +#![feature(lang_items, no_core)] +#![no_std] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +#[lang = "copy"] +trait Copy {} + +fn bla(argc: isize) { + match argc { + 1 => 1, // removing this arm fixes the ICE + _ => 1, + }; +} + +fn main() {} diff --git a/ices/105047.rs b/ices/105047.rs new file mode 100644 index 00000000..d998e418 --- /dev/null +++ b/ices/105047.rs @@ -0,0 +1,9 @@ +#![feature(raw_ref_op)] + +const RCZ: *const i32 = &raw const *&0; + +const fn f() { + if let RCZ = &raw const *&0 {} +} + +fn main() {} diff --git a/ices/105819.rs b/ices/105819.rs new file mode 100644 index 00000000..d23eaf91 --- /dev/null +++ b/ices/105819.rs @@ -0,0 +1,15 @@ +#![feature(type_alias_impl_trait)] +// check-pass + +fn main() {} + +fn upvar() { + #[derive(Copy, Clone)] + struct Foo((u32, u32)); + + type T = impl Copy; + let foo: T = Foo((1u32, 2u32)); + let x = move || { + let Foo((a, b)) = foo; + }; +} diff --git a/ices/108580.rs b/ices/108580.rs new file mode 100644 index 00000000..efe81b56 --- /dev/null +++ b/ices/108580.rs @@ -0,0 +1,27 @@ +#![feature(associated_type_bounds, return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +trait Iterator { + type Item; +} + +trait IntoIterator { + fn into_iterator(&self) -> impl Iterator + '_; +} + +struct IntoIterFn { + f: F, + _marker: core::marker::PhantomData, +} + +impl IntoIterator for IntoIterFn +where + F: Fn() -> I, + I: Iterator, +{ + fn into_iterator(&self) -> impl Iterator { + (self.f)() + } +} + +fn main() {} diff --git a/ices/109239.rs b/ices/109239.rs new file mode 100644 index 00000000..3895d67c --- /dev/null +++ b/ices/109239.rs @@ -0,0 +1,10 @@ +#![allow(incomplete_features)] +#![feature(return_position_impl_trait_in_trait)] + +trait Trait { + type Type; + + fn method(&self) -> impl Trait + '_>; +} + +fn main() {} diff --git a/ices/109281.rs b/ices/109281.rs new file mode 100644 index 00000000..a0d1a868 --- /dev/null +++ b/ices/109281.rs @@ -0,0 +1,9 @@ +#![feature(type_alias_impl_trait)] +struct S; +type ReturnType<'a> = impl Eq + 'a; +impl std::ops::Deref for S { + type Target = dyn Fn(&()) -> ReturnType; + fn deref() -> &'static Self::Target {} +} + +fn main() {} diff --git a/ices/109298.rs b/ices/109298.rs new file mode 100644 index 00000000..e5ab4cfe --- /dev/null +++ b/ices/109298.rs @@ -0,0 +1,8 @@ +fn arr_by_ref(mut x: [(); 3]) { + let f = || { + let [ref y, ref mut z @ ..] = x; + }; + f(); +} + +fn main() {} diff --git a/ices/109299.rs b/ices/109299.rs new file mode 100644 index 00000000..84eaad32 --- /dev/null +++ b/ices/109299.rs @@ -0,0 +1,14 @@ +trait Document { + fn cursor(&self) -> Lexer::Cursor<'_>; +} + +struct Lexer<'d> { + cursor: (), + _phantom: std::marker::PhantomData<&'d ()>, +} + +impl<'cursor> Lexer<'d> { + type Cursor<'a> = DocCursorImpl<'a>; +} + +fn main() {} diff --git a/ices/109300.rs b/ices/109300.rs new file mode 100644 index 00000000..bf04bd2b --- /dev/null +++ b/ices/109300.rs @@ -0,0 +1,8 @@ +#![feature(generic_const_exprs)] +trait B { + type U; +} + +fn f = ()>>() {} + +fn main() {} diff --git a/ices/109304.rs b/ices/109304.rs new file mode 100644 index 00000000..4d65f5d6 --- /dev/null +++ b/ices/109304.rs @@ -0,0 +1,40 @@ +#![recursion_limit = "10"] +macro_rules! link { + ($outer:ident, $inner:ident) => { + struct $outer($inner); + impl $outer { + fn new() -> $outer { + $outer($inner::new()) + } + } + impl std::ops::Deref for $outer { + type Target = $inner; + fn deref(&self) -> &$inner { + &self.0 + } + } + }; +} + +struct Bottom; + +impl Bottom { + fn new() -> Bottom { + Bottom + } +} + +link!(Top, A); +link!(A, B); +link!(B, C); +link!(C, D); +link!(D, E); +link!(E, F); +link!(F, G); +link!(G, H); +link!(H, I); +link!(I, J); +link!(J, K); +link!(K, Bottom); + +fn main() {} diff --git a/ices/95134.rs b/ices/95134.rs new file mode 100644 index 00000000..98e36d13 --- /dev/null +++ b/ices/95134.rs @@ -0,0 +1,24 @@ +pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { + if n > 15 { + encode_num(n / 16, &mut writer)?; + } + Ok(()) +} + +pub trait ExampleWriter { + type Error; +} + +impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T { + type Error = T::Error; +} + +struct EmptyWriter; + +impl ExampleWriter for EmptyWriter { + type Error = (); +} + +fn main() { + encode_num(69, &mut EmptyWriter).unwrap(); +} diff --git a/ices/98010.rs b/ices/98010.rs new file mode 100644 index 00000000..186f95b4 --- /dev/null +++ b/ices/98010.rs @@ -0,0 +1,46 @@ +#![no_std] +#![no_core] +#![no_main] +#![feature(no_core, lang_items)] + +#[lang = "sized"] +trait Sized {} +#[lang = "sync"] +trait Sync {} +#[lang = "copy"] +trait Copy {} +#[lang = "freeze"] +trait Freeze {} + +impl Sync for u32 {} +impl Sync for i32 {} + +// impl Copy for u32 {} // if remove, it cause rustc crash + +#[lang = "drop_in_place"] +#[allow(unconditional_recursion)] +pub unsafe fn drop_in_place(to_drop: *mut T) { + unsafe { drop_in_place(to_drop) } +} + +#[link(name = "Kernel32")] +extern "system" { + pub fn ExitProcess(uexitcode: u32) -> !; +} + +fn exit_process(exit_code: u32) -> ! { + // Copying is necessary to pass the value through the function argument, and if this is avoided, there will be no error either. + unsafe { + ExitProcess(exit_code); + } +} + +#[no_mangle] +pub extern "C" fn wWinMainCRTStartup() -> i32 { + exit_process(0); +} + +#[no_mangle] +pub static _fltused: i32 = 1; + +fn main() {}