diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index 7334beb52c9d..0017186c1b08 100644
--- a/compiler/rustc_ty_utils/src/layout.rs
+++ b/compiler/rustc_ty_utils/src/layout.rs
@@ -611,7 +611,7 @@ fn layout_of_uncached<'tcx>(
}
// Types with no meaningful known layout.
- ty::Param(_) => {
+ ty::Param(_) | ty::Placeholder(..) => {
return Err(error(cx, LayoutError::TooGeneric(ty)));
}
@@ -628,11 +628,7 @@ fn layout_of_uncached<'tcx>(
return Err(error(cx, err));
}
- ty::Placeholder(..)
- | ty::Bound(..)
- | ty::CoroutineWitness(..)
- | ty::Infer(_)
- | ty::Error(_) => {
+ ty::Bound(..) | ty::CoroutineWitness(..) | ty::Infer(_) | ty::Error(_) => {
// `ty::Error` is handled at the top of this function.
bug!("layout_of: unexpected type `{ty}`")
}
diff --git a/tests/ui/consts/too_generic_eval_ice.stderr b/tests/ui/consts/too_generic_eval_ice.current.stderr
similarity index 90%
rename from tests/ui/consts/too_generic_eval_ice.stderr
rename to tests/ui/consts/too_generic_eval_ice.current.stderr
index 3cc4377514a2..02bcaee80154 100644
--- a/tests/ui/consts/too_generic_eval_ice.stderr
+++ b/tests/ui/consts/too_generic_eval_ice.current.stderr
@@ -1,5 +1,5 @@
error: constant expression depends on a generic parameter
- --> $DIR/too_generic_eval_ice.rs:7:13
+ --> $DIR/too_generic_eval_ice.rs:11:13
|
LL | [5; Self::HOST_SIZE] == [6; 0]
| ^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
- --> $DIR/too_generic_eval_ice.rs:7:9
+ --> $DIR/too_generic_eval_ice.rs:11:9
|
LL | [5; Self::HOST_SIZE] == [6; 0]
| ^^^^^^^^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
- --> $DIR/too_generic_eval_ice.rs:7:30
+ --> $DIR/too_generic_eval_ice.rs:11:30
|
LL | [5; Self::HOST_SIZE] == [6; 0]
| ^^
@@ -23,7 +23,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
= note: this may fail depending on what value the parameter takes
error[E0277]: can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
- --> $DIR/too_generic_eval_ice.rs:7:30
+ --> $DIR/too_generic_eval_ice.rs:11:30
|
LL | [5; Self::HOST_SIZE] == [6; 0]
| ^^ no implementation for `[{integer}; Self::HOST_SIZE] == [{integer}; 0]`
diff --git a/tests/ui/consts/too_generic_eval_ice.next.stderr b/tests/ui/consts/too_generic_eval_ice.next.stderr
new file mode 100644
index 000000000000..01da33241c81
--- /dev/null
+++ b/tests/ui/consts/too_generic_eval_ice.next.stderr
@@ -0,0 +1,9 @@
+error[E0284]: type annotations needed: cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated`
+ --> $DIR/too_generic_eval_ice.rs:11:13
+ |
+LL | [5; Self::HOST_SIZE] == [6; 0]
+ | ^^^^^^^^^^^^^^^ cannot satisfy `the constant `Self::HOST_SIZE` can be evaluated`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/consts/too_generic_eval_ice.rs b/tests/ui/consts/too_generic_eval_ice.rs
index 0d46a4c8276d..ff741cdcf20b 100644
--- a/tests/ui/consts/too_generic_eval_ice.rs
+++ b/tests/ui/consts/too_generic_eval_ice.rs
@@ -1,3 +1,7 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
pub struct Foo(A, B);
impl Foo {
@@ -5,10 +9,11 @@ impl Foo {
pub fn crash() -> bool {
[5; Self::HOST_SIZE] == [6; 0]
- //~^ ERROR constant expression depends on a generic parameter
- //~| ERROR constant expression depends on a generic parameter
- //~| ERROR constant expression depends on a generic parameter
- //~| ERROR can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
+ //[current]~^ ERROR constant expression depends on a generic parameter
+ //[current]~| ERROR constant expression depends on a generic parameter
+ //[current]~| ERROR constant expression depends on a generic parameter
+ //[current]~| ERROR can't compare `[{integer}; Self::HOST_SIZE]` with `[{integer}; 0]`
+ //[next]~^^^^^ ERROR type annotations needed
}
}