mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #122943 - matthiaskrgr:ice-tests-9xxxx-to-12xxxx, r=fmease
add a couple more ice tests Fixes rust-lang/rust#104779 Fixes rust-lang/rust#106423 Fixes rust-lang/rust#106444 Fixes rust-lang/rust#101852 Fixes rust-lang/rust#106874 Fixes rust-lang/rust#105047 Fixes rust-lang/rust#107228 Fixes rust-lang/rust#99945
This commit is contained in:
commit
2463ad0f5f
@ -0,0 +1,26 @@
|
||||
// issue: rust-lang/rust#104779
|
||||
// ICE region infer, IndexMap: key not found
|
||||
|
||||
struct Inv<'a>(&'a mut &'a ());
|
||||
enum Foo<T> {
|
||||
Bar,
|
||||
Var(T),
|
||||
}
|
||||
type Subtype = Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>;
|
||||
type Supertype = Foo<for<'a> fn(Inv<'a>, Inv<'a>)>;
|
||||
|
||||
fn foo() -> impl Sized {
|
||||
//~^ WARN function cannot return without recursing
|
||||
loop {
|
||||
match foo() {
|
||||
//~^ ERROR higher-ranked subtype error
|
||||
//~^^ ERROR higher-ranked subtype error
|
||||
Subtype::Bar => (),
|
||||
//~^ ERROR higher-ranked subtype error
|
||||
//~^^ ERROR higher-ranked subtype error
|
||||
Supertype::Var(x) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {}
|
@ -0,0 +1,42 @@
|
||||
warning: function cannot return without recursing
|
||||
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:12:1
|
||||
|
|
||||
LL | fn foo() -> impl Sized {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
|
||||
...
|
||||
LL | match foo() {
|
||||
| ----- recursive call site
|
||||
|
|
||||
= help: a `loop` may express intention better if this is on purpose
|
||||
= note: `#[warn(unconditional_recursion)]` on by default
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
|
||||
|
|
||||
LL | match foo() {
|
||||
| ^^^^^
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
|
||||
|
|
||||
LL | match foo() {
|
||||
| ^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
|
||||
|
|
||||
LL | Subtype::Bar => (),
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
|
||||
|
|
||||
LL | Subtype::Bar => (),
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
|
@ -0,0 +1,57 @@
|
||||
// issue: rust-lang/rust#106423
|
||||
// ICE collection encountered polymorphic constant: UnevaluatedConst {..}
|
||||
//@ edition:2021
|
||||
//@ check-pass
|
||||
|
||||
#![feature(generic_const_exprs, generic_arg_infer)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(unused)]
|
||||
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
pub struct Arr<T, const N: usize> {
|
||||
v: [MaybeUninit<T>; N],
|
||||
}
|
||||
|
||||
impl<T, const N: usize> Arr<T, N> {
|
||||
const ELEM: MaybeUninit<T> = MaybeUninit::uninit();
|
||||
const INIT: [MaybeUninit<T>; N] = [Self::ELEM; N]; // important for optimization of `new`
|
||||
|
||||
fn new() -> Self {
|
||||
Arr { v: Self::INIT }
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BaFormatFilter<const N: usize> {}
|
||||
|
||||
pub enum DigitalFilter<const N: usize>
|
||||
where
|
||||
[(); N * 2 + 1]: Sized,
|
||||
[(); N * 2]: Sized,
|
||||
{
|
||||
Ba(BaFormatFilter<{ N * 2 + 1 }>),
|
||||
}
|
||||
|
||||
pub fn iirfilter_st_copy<const N: usize, const M: usize>(_: [f32; M]) -> DigitalFilter<N>
|
||||
where
|
||||
[(); N * 2 + 1]: Sized,
|
||||
[(); N * 2]: Sized,
|
||||
{
|
||||
let zpk = zpk2tf_st(&Arr::<f32, { N * 2 }>::new(), &Arr::<f32, { N * 2 }>::new());
|
||||
DigitalFilter::Ba(zpk)
|
||||
}
|
||||
|
||||
pub fn zpk2tf_st<const N: usize>(
|
||||
_z: &Arr<f32, N>,
|
||||
_p: &Arr<f32, N>,
|
||||
) -> BaFormatFilter<{ N + 1 }>
|
||||
where
|
||||
[(); N + 1]: Sized,
|
||||
{
|
||||
BaFormatFilter {}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
iirfilter_st_copy::<4, 2>([10., 50.,]);
|
||||
}
|
16
tests/ui/drop/norm-ice-106444.rs
Normal file
16
tests/ui/drop/norm-ice-106444.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// issue: rust-lang/rust#106444
|
||||
// ICE failed to normalize
|
||||
//@ compile-flags: -Zmir-opt-level=3
|
||||
//@ check-pass
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
||||
pub trait A {
|
||||
type B;
|
||||
}
|
||||
|
||||
pub struct S<T: A>(T::B);
|
||||
|
||||
pub fn foo<T: A>(p: *mut S<T>) {
|
||||
unsafe { core::ptr::drop_in_place(p) };
|
||||
}
|
12
tests/ui/impl-trait/recursive-ice-101862.rs
Normal file
12
tests/ui/impl-trait/recursive-ice-101862.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// issue: rust-lang/rust#101852
|
||||
// ICE opaque type with non-universal region substs
|
||||
|
||||
pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
|
||||
//~^ WARN function cannot return without recursing
|
||||
vec![].append(&mut ice(x.as_ref()));
|
||||
//~^ ERROR expected generic type parameter, found `&str`
|
||||
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
fn main() {}
|
24
tests/ui/impl-trait/recursive-ice-101862.stderr
Normal file
24
tests/ui/impl-trait/recursive-ice-101862.stderr
Normal file
@ -0,0 +1,24 @@
|
||||
warning: function cannot return without recursing
|
||||
--> $DIR/recursive-ice-101862.rs:4:1
|
||||
|
|
||||
LL | pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
|
||||
LL |
|
||||
LL | vec![].append(&mut ice(x.as_ref()));
|
||||
| --------------- recursive call site
|
||||
|
|
||||
= help: a `loop` may express intention better if this is on purpose
|
||||
= note: `#[warn(unconditional_recursion)]` on by default
|
||||
|
||||
error[E0792]: expected generic type parameter, found `&str`
|
||||
--> $DIR/recursive-ice-101862.rs:6:5
|
||||
|
|
||||
LL | pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
|
||||
| --------------- this generic parameter must be used with a generic type parameter
|
||||
LL |
|
||||
LL | vec![].append(&mut ice(x.as_ref()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0792`.
|
48
tests/ui/nll/ice-106874.rs
Normal file
48
tests/ui/nll/ice-106874.rs
Normal file
@ -0,0 +1,48 @@
|
||||
// issue: rust-lang/rust#106874
|
||||
// ICE BoundUniversalRegionError
|
||||
|
||||
use std::marker::PhantomData;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub fn func<V, F: Fn(&mut V)>(f: F) -> A<impl X> {
|
||||
A(B(C::new(D::new(move |st| f(st)))))
|
||||
//~^ ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR implementation of `Fn` is not general enough
|
||||
//~| ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR implementation of `Fn` is not general enough
|
||||
//~| ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR implementation of `Fn` is not general enough
|
||||
//~| ERROR implementation of `FnOnce` is not general enough
|
||||
//~| ERROR higher-ranked subtype error
|
||||
//~| ERROR higher-ranked subtype error
|
||||
}
|
||||
|
||||
trait X {}
|
||||
trait Y {
|
||||
type V;
|
||||
}
|
||||
|
||||
struct A<T>(T);
|
||||
|
||||
struct B<T>(Rc<T>);
|
||||
impl<T> X for B<T> {}
|
||||
|
||||
struct C<T: Y>(T::V);
|
||||
impl<T: Y> C<T> {
|
||||
fn new(_: T) -> Rc<Self> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
struct D<V, F>(F, PhantomData<fn(&mut V)>);
|
||||
|
||||
impl<V, F> D<V, F> {
|
||||
fn new(_: F) -> Self {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
impl<V, F: Fn(&mut V)> Y for D<V, F> {
|
||||
type V = V;
|
||||
}
|
||||
|
||||
pub fn main() {}
|
90
tests/ui/nll/ice-106874.stderr
Normal file
90
tests/ui/nll/ice-106874.stderr
Normal file
@ -0,0 +1,90 @@
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:5
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`...
|
||||
= note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:5
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`...
|
||||
= note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1`
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: implementation of `Fn` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:7
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:7
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `Fn` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:7
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2`
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:9
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `Fn` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:9
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `FnOnce` is not general enough
|
||||
--> $DIR/ice-106874.rs:8:9
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
||||
|
|
||||
= note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
|
||||
= note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/ice-106874.rs:8:41
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/ice-106874.rs:8:41
|
||||
|
|
||||
LL | A(B(C::new(D::new(move |st| f(st)))))
|
||||
| ^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
15
tests/ui/raw-ref-op/const-eval-compare-ice-105047.rs
Normal file
15
tests/ui/raw-ref-op/const-eval-compare-ice-105047.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// issue: rust-lang/rust#105047
|
||||
// ICE raw ptr comparison should already be caught in the trait systems
|
||||
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
const RCZ: *const i32 = &raw const *&0;
|
||||
|
||||
const fn f() {
|
||||
if let RCZ = &raw const *&0 { }
|
||||
//~^ WARN function pointers and raw pointers not derived from integers in patterns
|
||||
//~| ERROR pointers cannot be reliably compared during const eval
|
||||
//~| WARN this was previously accepted by the compiler but is being phased out
|
||||
}
|
||||
|
||||
fn main() {}
|
31
tests/ui/raw-ref-op/const-eval-compare-ice-105047.stderr
Normal file
31
tests/ui/raw-ref-op/const-eval-compare-ice-105047.stderr
Normal file
@ -0,0 +1,31 @@
|
||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||
--> $DIR/const-eval-compare-ice-105047.rs:9:12
|
||||
|
|
||||
LL | if let RCZ = &raw const *&0 { }
|
||||
| ^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
|
||||
= note: `#[warn(pointer_structural_match)]` on by default
|
||||
|
||||
error: pointers cannot be reliably compared during const eval
|
||||
--> $DIR/const-eval-compare-ice-105047.rs:9:12
|
||||
|
|
||||
LL | if let RCZ = &raw const *&0 { }
|
||||
| ^^^
|
||||
|
|
||||
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
|
||||
--> $DIR/const-eval-compare-ice-105047.rs:9:12
|
||||
|
|
||||
LL | if let RCZ = &raw const *&0 { }
|
||||
| ^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
|
||||
= note: `#[warn(pointer_structural_match)]` on by default
|
||||
|
28
tests/ui/specialization/broken-mir-drop-glue-107228.rs
Normal file
28
tests/ui/specialization/broken-mir-drop-glue-107228.rs
Normal file
@ -0,0 +1,28 @@
|
||||
// issue: rust-lang/rust#107228
|
||||
// ICE broken MIR in DropGlue
|
||||
//@ compile-flags: -Zvalidate-mir
|
||||
//@ check-pass
|
||||
|
||||
#![feature(specialization)]
|
||||
#![crate_type="lib"]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub(crate) trait SpecTrait {
|
||||
type Assoc;
|
||||
}
|
||||
|
||||
impl<C> SpecTrait for C {
|
||||
default type Assoc = Vec<Self>;
|
||||
}
|
||||
|
||||
pub(crate) struct AssocWrap<C: SpecTrait> {
|
||||
_assoc: C::Assoc,
|
||||
}
|
||||
|
||||
fn instantiate<C: SpecTrait>() -> AssocWrap<C> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
instantiate::<()>();
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
// issue: rust-lang/rust#99945
|
||||
// ICE Failed to normalize
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait Widget<E> {
|
||||
type State;
|
||||
|
||||
fn make_state(&self) -> Self::State;
|
||||
}
|
||||
|
||||
impl<E> Widget<E> for () {
|
||||
type State = ();
|
||||
|
||||
fn make_state(&self) -> Self::State {}
|
||||
}
|
||||
|
||||
struct StatefulWidget<F>(F);
|
||||
|
||||
type StateWidget<'a> = impl Widget<&'a ()>;
|
||||
|
||||
impl<F: for<'a> Fn(&'a ()) -> StateWidget<'a>> Widget<()> for StatefulWidget<F> {
|
||||
type State = ();
|
||||
|
||||
fn make_state(&self) -> Self::State {}
|
||||
}
|
||||
|
||||
fn new_stateful_widget<F: for<'a> Fn(&'a ()) -> StateWidget<'a>>(build: F) -> impl Widget<()> {
|
||||
StatefulWidget(build)
|
||||
//~^ ERROR expected generic lifetime parameter, found `'a`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
new_stateful_widget(|_| ()).make_state();
|
||||
//~^ ERROR mismatched types
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/failed-to-normalize-ice-99945.rs:34:29
|
||||
|
|
||||
LL | type StateWidget<'a> = impl Widget<&'a ()>;
|
||||
| ------------------- the expected opaque type
|
||||
...
|
||||
LL | new_stateful_widget(|_| ()).make_state();
|
||||
| ^^ expected opaque type, found `()`
|
||||
|
|
||||
= note: expected opaque type `StateWidget<'_>`
|
||||
found unit type `()`
|
||||
|
||||
error[E0792]: expected generic lifetime parameter, found `'a`
|
||||
--> $DIR/failed-to-normalize-ice-99945.rs:29:5
|
||||
|
|
||||
LL | type StateWidget<'a> = impl Widget<&'a ()>;
|
||||
| -- this generic parameter must be used with a generic lifetime parameter
|
||||
...
|
||||
LL | StatefulWidget(build)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0792.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user