Skip to content

Commit 39cf611

Browse files
authored
Unrolled build for rust-lang#122943
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12xxxx, r=fmease add a couple more ice tests Fixes rust-lang#104779 Fixes rust-lang#106423 Fixes rust-lang#106444 Fixes rust-lang#101852 Fixes rust-lang#106874 Fixes rust-lang#105047 Fixes rust-lang#107228 Fixes rust-lang#99945
2 parents 9b8d12c + 9aea37d commit 39cf611

13 files changed

+450
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// issue: rust-lang/rust#104779
2+
// ICE region infer, IndexMap: key not found
3+
4+
struct Inv<'a>(&'a mut &'a ());
5+
enum Foo<T> {
6+
Bar,
7+
Var(T),
8+
}
9+
type Subtype = Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>;
10+
type Supertype = Foo<for<'a> fn(Inv<'a>, Inv<'a>)>;
11+
12+
fn foo() -> impl Sized {
13+
//~^ WARN function cannot return without recursing
14+
loop {
15+
match foo() {
16+
//~^ ERROR higher-ranked subtype error
17+
//~^^ ERROR higher-ranked subtype error
18+
Subtype::Bar => (),
19+
//~^ ERROR higher-ranked subtype error
20+
//~^^ ERROR higher-ranked subtype error
21+
Supertype::Var(x) => {}
22+
}
23+
}
24+
}
25+
26+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
warning: function cannot return without recursing
2+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:12:1
3+
|
4+
LL | fn foo() -> impl Sized {
5+
| ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6+
...
7+
LL | match foo() {
8+
| ----- recursive call site
9+
|
10+
= help: a `loop` may express intention better if this is on purpose
11+
= note: `#[warn(unconditional_recursion)]` on by default
12+
13+
error: higher-ranked subtype error
14+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
15+
|
16+
LL | match foo() {
17+
| ^^^^^
18+
19+
error: higher-ranked subtype error
20+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
21+
|
22+
LL | match foo() {
23+
| ^^^^^
24+
|
25+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
26+
27+
error: higher-ranked subtype error
28+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
29+
|
30+
LL | Subtype::Bar => (),
31+
| ^^^^^^^^^^^^
32+
33+
error: higher-ranked subtype error
34+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
35+
|
36+
LL | Subtype::Bar => (),
37+
| ^^^^^^^^^^^^
38+
|
39+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
40+
41+
error: aborting due to 4 previous errors; 1 warning emitted
42+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// issue: rust-lang/rust#106423
2+
// ICE collection encountered polymorphic constant: UnevaluatedConst {..}
3+
//@ edition:2021
4+
//@ check-pass
5+
6+
#![feature(generic_const_exprs, generic_arg_infer)]
7+
#![allow(incomplete_features)]
8+
#![allow(unused)]
9+
10+
use core::mem::MaybeUninit;
11+
12+
pub struct Arr<T, const N: usize> {
13+
v: [MaybeUninit<T>; N],
14+
}
15+
16+
impl<T, const N: usize> Arr<T, N> {
17+
const ELEM: MaybeUninit<T> = MaybeUninit::uninit();
18+
const INIT: [MaybeUninit<T>; N] = [Self::ELEM; N]; // important for optimization of `new`
19+
20+
fn new() -> Self {
21+
Arr { v: Self::INIT }
22+
}
23+
}
24+
25+
pub struct BaFormatFilter<const N: usize> {}
26+
27+
pub enum DigitalFilter<const N: usize>
28+
where
29+
[(); N * 2 + 1]: Sized,
30+
[(); N * 2]: Sized,
31+
{
32+
Ba(BaFormatFilter<{ N * 2 + 1 }>),
33+
}
34+
35+
pub fn iirfilter_st_copy<const N: usize, const M: usize>(_: [f32; M]) -> DigitalFilter<N>
36+
where
37+
[(); N * 2 + 1]: Sized,
38+
[(); N * 2]: Sized,
39+
{
40+
let zpk = zpk2tf_st(&Arr::<f32, { N * 2 }>::new(), &Arr::<f32, { N * 2 }>::new());
41+
DigitalFilter::Ba(zpk)
42+
}
43+
44+
pub fn zpk2tf_st<const N: usize>(
45+
_z: &Arr<f32, N>,
46+
_p: &Arr<f32, N>,
47+
) -> BaFormatFilter<{ N + 1 }>
48+
where
49+
[(); N + 1]: Sized,
50+
{
51+
BaFormatFilter {}
52+
}
53+
54+
55+
fn main() {
56+
iirfilter_st_copy::<4, 2>([10., 50.,]);
57+
}

tests/ui/drop/norm-ice-106444.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// issue: rust-lang/rust#106444
2+
// ICE failed to normalize
3+
//@ compile-flags: -Zmir-opt-level=3
4+
//@ check-pass
5+
6+
#![crate_type="lib"]
7+
8+
pub trait A {
9+
type B;
10+
}
11+
12+
pub struct S<T: A>(T::B);
13+
14+
pub fn foo<T: A>(p: *mut S<T>) {
15+
unsafe { core::ptr::drop_in_place(p) };
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// issue: rust-lang/rust#101852
2+
// ICE opaque type with non-universal region substs
3+
4+
pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
5+
//~^ WARN function cannot return without recursing
6+
vec![].append(&mut ice(x.as_ref()));
7+
//~^ ERROR expected generic type parameter, found `&str`
8+
9+
Vec::new()
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning: function cannot return without recursing
2+
--> $DIR/recursive-ice-101862.rs:4:1
3+
|
4+
LL | pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6+
LL |
7+
LL | vec![].append(&mut ice(x.as_ref()));
8+
| --------------- recursive call site
9+
|
10+
= help: a `loop` may express intention better if this is on purpose
11+
= note: `#[warn(unconditional_recursion)]` on by default
12+
13+
error[E0792]: expected generic type parameter, found `&str`
14+
--> $DIR/recursive-ice-101862.rs:6:5
15+
|
16+
LL | pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> {
17+
| --------------- this generic parameter must be used with a generic type parameter
18+
LL |
19+
LL | vec![].append(&mut ice(x.as_ref()));
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
22+
error: aborting due to 1 previous error; 1 warning emitted
23+
24+
For more information about this error, try `rustc --explain E0792`.

tests/ui/nll/ice-106874.rs

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// issue: rust-lang/rust#106874
2+
// ICE BoundUniversalRegionError
3+
4+
use std::marker::PhantomData;
5+
use std::rc::Rc;
6+
7+
pub fn func<V, F: Fn(&mut V)>(f: F) -> A<impl X> {
8+
A(B(C::new(D::new(move |st| f(st)))))
9+
//~^ ERROR implementation of `FnOnce` is not general enough
10+
//~| ERROR implementation of `Fn` is not general enough
11+
//~| ERROR implementation of `FnOnce` is not general enough
12+
//~| ERROR implementation of `FnOnce` is not general enough
13+
//~| ERROR implementation of `Fn` is not general enough
14+
//~| ERROR implementation of `FnOnce` is not general enough
15+
//~| ERROR implementation of `Fn` is not general enough
16+
//~| ERROR implementation of `FnOnce` is not general enough
17+
//~| ERROR higher-ranked subtype error
18+
//~| ERROR higher-ranked subtype error
19+
}
20+
21+
trait X {}
22+
trait Y {
23+
type V;
24+
}
25+
26+
struct A<T>(T);
27+
28+
struct B<T>(Rc<T>);
29+
impl<T> X for B<T> {}
30+
31+
struct C<T: Y>(T::V);
32+
impl<T: Y> C<T> {
33+
fn new(_: T) -> Rc<Self> {
34+
todo!()
35+
}
36+
}
37+
struct D<V, F>(F, PhantomData<fn(&mut V)>);
38+
39+
impl<V, F> D<V, F> {
40+
fn new(_: F) -> Self {
41+
todo!()
42+
}
43+
}
44+
impl<V, F: Fn(&mut V)> Y for D<V, F> {
45+
type V = V;
46+
}
47+
48+
pub fn main() {}

tests/ui/nll/ice-106874.stderr

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
error: implementation of `FnOnce` is not general enough
2+
--> $DIR/ice-106874.rs:8:5
3+
|
4+
LL | A(B(C::new(D::new(move |st| f(st)))))
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
6+
|
7+
= note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`...
8+
= note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1`
9+
10+
error: implementation of `FnOnce` is not general enough
11+
--> $DIR/ice-106874.rs:8:5
12+
|
13+
LL | A(B(C::new(D::new(move |st| f(st)))))
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
15+
|
16+
= note: closure with signature `fn(&'0 mut V)` must implement `FnOnce<(&mut V,)>`, for some specific lifetime `'0`...
17+
= note: ...but it actually implements `FnOnce<(&'1 mut V,)>`, for some specific lifetime `'1`
18+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
19+
20+
error: implementation of `Fn` is not general enough
21+
--> $DIR/ice-106874.rs:8:7
22+
|
23+
LL | A(B(C::new(D::new(move |st| f(st)))))
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough
25+
|
26+
= note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`...
27+
= note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2`
28+
29+
error: implementation of `FnOnce` is not general enough
30+
--> $DIR/ice-106874.rs:8:7
31+
|
32+
LL | A(B(C::new(D::new(move |st| f(st)))))
33+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
34+
|
35+
= note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
36+
= note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`
37+
38+
error: implementation of `Fn` is not general enough
39+
--> $DIR/ice-106874.rs:8:7
40+
|
41+
LL | A(B(C::new(D::new(move |st| f(st)))))
42+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough
43+
|
44+
= note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`...
45+
= note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2`
46+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
47+
48+
error: implementation of `FnOnce` is not general enough
49+
--> $DIR/ice-106874.rs:8:9
50+
|
51+
LL | A(B(C::new(D::new(move |st| f(st)))))
52+
| ^^^^^^ implementation of `FnOnce` is not general enough
53+
|
54+
= note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
55+
= note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`
56+
57+
error: implementation of `Fn` is not general enough
58+
--> $DIR/ice-106874.rs:8:9
59+
|
60+
LL | A(B(C::new(D::new(move |st| f(st)))))
61+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Fn` is not general enough
62+
|
63+
= note: closure with signature `fn(&'2 mut V)` must implement `Fn<(&'1 mut V,)>`, for any lifetime `'1`...
64+
= note: ...but it actually implements `Fn<(&'2 mut V,)>`, for some specific lifetime `'2`
65+
66+
error: implementation of `FnOnce` is not general enough
67+
--> $DIR/ice-106874.rs:8:9
68+
|
69+
LL | A(B(C::new(D::new(move |st| f(st)))))
70+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
71+
|
72+
= note: closure with signature `fn(&'2 mut V)` must implement `FnOnce<(&'1 mut V,)>`, for any lifetime `'1`...
73+
= note: ...but it actually implements `FnOnce<(&'2 mut V,)>`, for some specific lifetime `'2`
74+
75+
error: higher-ranked subtype error
76+
--> $DIR/ice-106874.rs:8:41
77+
|
78+
LL | A(B(C::new(D::new(move |st| f(st)))))
79+
| ^
80+
81+
error: higher-ranked subtype error
82+
--> $DIR/ice-106874.rs:8:41
83+
|
84+
LL | A(B(C::new(D::new(move |st| f(st)))))
85+
| ^
86+
|
87+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
88+
89+
error: aborting due to 10 previous errors
90+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// issue: rust-lang/rust#105047
2+
// ICE raw ptr comparison should already be caught in the trait systems
3+
4+
#![feature(raw_ref_op)]
5+
6+
const RCZ: *const i32 = &raw const *&0;
7+
8+
const fn f() {
9+
if let RCZ = &raw const *&0 { }
10+
//~^ WARN function pointers and raw pointers not derived from integers in patterns
11+
//~| ERROR pointers cannot be reliably compared during const eval
12+
//~| WARN this was previously accepted by the compiler but is being phased out
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
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.
2+
--> $DIR/const-eval-compare-ice-105047.rs:9:12
3+
|
4+
LL | if let RCZ = &raw const *&0 { }
5+
| ^^^
6+
|
7+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8+
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
9+
= note: `#[warn(pointer_structural_match)]` on by default
10+
11+
error: pointers cannot be reliably compared during const eval
12+
--> $DIR/const-eval-compare-ice-105047.rs:9:12
13+
|
14+
LL | if let RCZ = &raw const *&0 { }
15+
| ^^^
16+
|
17+
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
18+
19+
error: aborting due to 1 previous error; 1 warning emitted
20+
21+
Future incompatibility report: Future breakage diagnostic:
22+
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.
23+
--> $DIR/const-eval-compare-ice-105047.rs:9:12
24+
|
25+
LL | if let RCZ = &raw const *&0 { }
26+
| ^^^
27+
|
28+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
29+
= note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362>
30+
= note: `#[warn(pointer_structural_match)]` on by default
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// issue: rust-lang/rust#107228
2+
// ICE broken MIR in DropGlue
3+
//@ compile-flags: -Zvalidate-mir
4+
//@ check-pass
5+
6+
#![feature(specialization)]
7+
#![crate_type="lib"]
8+
#![allow(incomplete_features)]
9+
10+
pub(crate) trait SpecTrait {
11+
type Assoc;
12+
}
13+
14+
impl<C> SpecTrait for C {
15+
default type Assoc = Vec<Self>;
16+
}
17+
18+
pub(crate) struct AssocWrap<C: SpecTrait> {
19+
_assoc: C::Assoc,
20+
}
21+
22+
fn instantiate<C: SpecTrait>() -> AssocWrap<C> {
23+
loop {}
24+
}
25+
26+
pub fn main() {
27+
instantiate::<()>();
28+
}

0 commit comments

Comments
 (0)