fix ICE on type error in promoted

This commit is contained in:
Ralf Jung
2024-12-07 17:22:09 +01:00
parent 9c707a8b76
commit ed8ee39930
25 changed files with 78 additions and 213 deletions
@@ -72,20 +72,6 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more
LL + #![feature(adt_const_params)]
|
note: erroneous constant encountered
--> $DIR/unevaluated-const-ice-119731.rs:22:19
|
LL | impl v17<512, v0> {
| ^^
note: erroneous constant encountered
--> $DIR/unevaluated-const-ice-119731.rs:22:19
|
LL | impl v17<512, v0> {
| ^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
--> $DIR/unevaluated-const-ice-119731.rs:28:37
|
@@ -16,12 +16,6 @@ error[E0308]: mismatched types
LL | const X: usize = 42 && 39;
| ^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:8:18
|
LL | const ARR: [i32; X] = [99; 34];
| ^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:10:19
|
@@ -40,12 +34,6 @@ error[E0308]: mismatched types
LL | const X1: usize = 42 || 39;
| ^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:17:19
|
LL | const ARR1: [i32; X1] = [99; 47];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:19:19
|
@@ -64,12 +52,6 @@ error[E0308]: mismatched types
LL | const X2: usize = -42 || -39;
| ^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:26:19
|
LL | const ARR2: [i32; X2] = [99; 18446744073709551607];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:28:19
|
@@ -88,84 +70,42 @@ error[E0308]: mismatched types
LL | const X3: usize = -42 && -39;
| ^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:35:19
|
LL | const ARR3: [i32; X3] = [99; 6];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:37:18
|
LL | const Y: usize = 42.0 == 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:40:19
|
LL | const ARRR: [i32; Y] = [99; 1];
| ^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:42:19
|
LL | const Y1: usize = 42.0 >= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:45:20
|
LL | const ARRR1: [i32; Y1] = [99; 1];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:47:19
|
LL | const Y2: usize = 42.0 <= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:50:20
|
LL | const ARRR2: [i32; Y2] = [99; 1];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:52:19
|
LL | const Y3: usize = 42.0 > 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:55:20
|
LL | const ARRR3: [i32; Y3] = [99; 0];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:57:19
|
LL | const Y4: usize = 42.0 < 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:60:20
|
LL | const ARRR4: [i32; Y4] = [99; 0];
| ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:62:19
|
LL | const Y5: usize = 42.0 != 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
note: erroneous constant encountered
--> $DIR/const-integer-bool-ops.rs:65:20
|
LL | const ARRR5: [i32; Y5] = [99; 0];
| ^^
error: aborting due to 18 previous errors
For more information about this error, try `rustc --explain E0308`.
@@ -4,12 +4,6 @@ error[E0764]: mutable references are not allowed in the final value of constants
LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^
note: erroneous constant encountered
--> $DIR/issue-76510.rs:7:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
| ^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0764`.
@@ -11,12 +11,6 @@ help: use a trailing comma to create a tuple with one element
LL | const TUP: (usize,) = (5usize << 64,);
| + ++
note: erroneous constant encountered
--> $DIR/const-tup-index-span.rs:6:18
|
LL | const ARR: [i32; TUP.0] = [];
| ^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
-18
View File
@@ -19,24 +19,6 @@ LL | | core::mem::size_of::<T>()
LL | | }
| |_____- `Tt::const_val` defined here
note: erroneous constant encountered
--> $DIR/issue-54954.rs:11:15
|
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
| ^^^^^^^
note: erroneous constant encountered
--> $DIR/issue-54954.rs:11:34
|
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
| ^^^^^^^
note: erroneous constant encountered
--> $DIR/issue-54954.rs:16:22
|
LL | let _ = f([1f32; ARR_LEN]);
| ^^^^^^^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0379, E0790.
@@ -4,11 +4,5 @@ error: missing type for `const` item
LL | const FIRST: = 10;
| ^ help: provide a type for the associated constant: `u8`
note: erroneous constant encountered
--> $DIR/missing_assoc_const_type2.rs:18:5
|
LL | TwoDigits::FIRST as usize
| ^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
@@ -0,0 +1,7 @@
struct B<T: ?Sized + Send + 'static> {
x: &'static T,
}
static STR: &'static [u8] = "a b"; //~ERROR: mismatched types
static C: &B<[u8]> = &B { x: STR };
fn main() {}
@@ -0,0 +1,16 @@
error[E0308]: mismatched types
--> $DIR/promoted-type-error-issue-133968.rs:4:29
|
LL | static STR: &'static [u8] = "a b";
| ^^^^^ expected `&[u8]`, found `&str`
|
= note: expected reference `&'static [u8]`
found reference `&'static str`
help: consider adding a leading `b`
|
LL | static STR: &'static [u8] = b"a b";
| +
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
@@ -6,12 +6,6 @@ LL | A = "" + 1
| |
| &str
note: erroneous constant encountered
--> $DIR/issue-41394.rs:7:9
|
LL | A = Foo::A as isize
| ^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0369`.
@@ -25,12 +25,6 @@ LL | const C: S = unsafe { std::mem::transmute(()) };
= note: source type: `()` (0 bits)
= note: target type: `S` (size can vary because of [u8])
note: erroneous constant encountered
--> $DIR/base-layout-is-sized-ice-123078.rs:13:5
|
LL | C;
| ^
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0512.
@@ -29,20 +29,6 @@ LL | const _: u32 = T::C;
|
= note: a `const` is a separate item from the item that contains it
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0401`.
@@ -35,20 +35,6 @@ LL | const _: u32 = T::C;
|
= note: a `const` is a separate item from the item that contains it
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
note: erroneous constant encountered
--> $DIR/generic-params-from-outer-item-in-const-item.rs:22:9
|
LL | I
| ^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0401`.
-6
View File
@@ -20,12 +20,6 @@ LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
LL + const M: usize = (f64::from(N) * LOG10_2) as usize;
|
note: erroneous constant encountered
--> $DIR/issue-50599.rs:4:29
|
LL | let mut digits = [0u32; M];
| ^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0425`.
@@ -6,11 +6,5 @@ LL | !let y = 42;
|
= note: only supported directly in conditions of `if` and `while` expressions
note: erroneous constant encountered
--> $DIR/avoid-invalid-mir.rs:11:13
|
LL | x: [(); N]
| ^
error: aborting due to 1 previous error
@@ -17,12 +17,6 @@ LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 {
LL | }
| - value is dropped here
note: erroneous constant encountered
--> $DIR/arbitrary-self-from-method-substs-ice.rs:24:5
|
LL | FOO;
| ^^^
error[E0801]: invalid generic `self` parameter type: `R`
--> $DIR/arbitrary-self-from-method-substs-ice.rs:10:49
|
@@ -9,12 +9,6 @@ help: consider using `let` instead of `const`
LL | let l: usize = v.count();
| ~~~
note: erroneous constant encountered
--> $DIR/type-dependent-def-issue-49241.rs:4:18
|
LL | let s: [u32; l] = v.into_iter().collect();
| ^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0435`.