diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs
index 0322c9e4ab011..7ef36d0e9ae37 100644
--- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs
@@ -971,15 +971,17 @@ where
rhs: T,
) -> Result<(), NoSolution> {
let goals = self.delegate.relate(param_env, lhs, variance, rhs, self.origin_span)?;
- if cfg!(debug_assertions) {
- for g in goals.iter() {
- match g.predicate.kind().skip_binder() {
- ty::PredicateKind::Subtype { .. } | ty::PredicateKind::AliasRelate(..) => {}
- p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
+ for &goal in goals.iter() {
+ let source = match goal.predicate.kind().skip_binder() {
+ ty::PredicateKind::Subtype { .. } | ty::PredicateKind::AliasRelate(..) => {
+ GoalSource::TypeRelating
}
- }
+ // FIXME(-Znext-solver=coinductive): should these WF goals also be unproductive?
+ ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => GoalSource::Misc,
+ p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
+ };
+ self.add_goal(source, goal);
}
- self.add_goals(GoalSource::TypeRelating, goals);
Ok(())
}
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index 7334beb52c9d5..0017186c1b082 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/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
similarity index 86%
rename from tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr
rename to tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
index 372d379de5a4f..64304be9d6b15 100644
--- a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.stderr
+++ b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
@@ -1,12 +1,12 @@
error[E0283]: type annotations needed
- --> $DIR/dedup-normalized-2-higher-ranked.rs:23:5
+ --> $DIR/dedup-normalized-2-higher-ranked.rs:28:5
|
LL | impls(rigid);
| ^^^^^ cannot infer type of the type parameter `U` declared on the function `impls`
|
= note: cannot satisfy `for<'b>
::Rigid: Bound<'b, _>`
note: required by a bound in `impls`
- --> $DIR/dedup-normalized-2-higher-ranked.rs:20:13
+ --> $DIR/dedup-normalized-2-higher-ranked.rs:25:13
|
LL | fn impls Bound<'b, U>, U>(_: T) {}
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `impls`
diff --git a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs
index 9224d47d30fd6..32b8c689248fb 100644
--- a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs
+++ b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.rs
@@ -1,3 +1,8 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+//@[next] check-pass
+
// We try to prove `for<'b> T::Rigid: Bound<'b, ?0>` and have 2 candidates from where-clauses:
//
// - `for<'a> Bound<'a, String>`
@@ -21,7 +26,7 @@ fn impls Bound<'b, U>, U>(_: T) {}
fn test(rigid: P::Rigid) {
impls(rigid);
- //~^ ERROR type annotations needed
+ //[current]~^ ERROR type annotations needed
}
fn main() {}
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 3cc4377514a21..02bcaee80154f 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 0000000000000..01da33241c810
--- /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 0d46a4c8276dc..ff741cdcf20bc 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
}
}
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
index 1ebc396cdf5b1..57548f75d5e49 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs
@@ -3,7 +3,6 @@
// priv-in-pub lint tests where the private trait bounds a public type
#![crate_type = "lib"]
-#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
struct PrivTy;
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
index ee79ce3f5d750..33f82a3a4fec3 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -1,30 +1,30 @@
warning: trait `PrivTr` is more private than the item `S`
- --> $DIR/where-pub-type-impls-priv-trait.rs:20:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:19:1
|
LL | pub struct S
| ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
= note: `#[warn(private_bounds)]` on by default
warning: trait `PrivTr` is more private than the item `E`
- --> $DIR/where-pub-type-impls-priv-trait.rs:27:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:26:1
|
LL | pub enum E
| ^^^^^^^^^^ enum `E` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
warning: trait `PrivTr` is more private than the item `f`
- --> $DIR/where-pub-type-impls-priv-trait.rs:34:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:33:1
|
LL | / pub fn f()
LL | |
@@ -33,13 +33,13 @@ LL | | PubTy: PrivTr
| |_________________^ function `f` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
warning: trait `PrivTr` is more private than the item `S`
- --> $DIR/where-pub-type-impls-priv-trait.rs:41:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:40:1
|
LL | / impl S
LL | |
@@ -48,13 +48,13 @@ LL | | PubTy: PrivTr
| |_________________^ implementation `S` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
warning: trait `PrivTr` is more private than the item `S::f`
- --> $DIR/where-pub-type-impls-priv-trait.rs:46:5
+ --> $DIR/where-pub-type-impls-priv-trait.rs:45:5
|
LL | / pub fn f()
LL | |
@@ -63,7 +63,7 @@ LL | | PubTy: PrivTr
| |_____________________^ associated function `S::f` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
- --> $DIR/where-pub-type-impls-priv-trait.rs:10:1
+ --> $DIR/where-pub-type-impls-priv-trait.rs:9:1
|
LL | trait PrivTr {}
| ^^^^^^^^^^^^
diff --git a/tests/ui/traits/next-solver/well-formed-in-relate.rs b/tests/ui/traits/next-solver/well-formed-in-relate.rs
new file mode 100644
index 0000000000000..eec1ddef228c4
--- /dev/null
+++ b/tests/ui/traits/next-solver/well-formed-in-relate.rs
@@ -0,0 +1,21 @@
+fn main() {
+ let x;
+ //~^ ERROR type annotations needed for `Map<_, _>`
+ higher_ranked();
+ x = unconstrained_map();
+}
+
+fn higher_ranked() where for<'a> &'a (): Sized {}
+
+struct Map where T: Fn() -> U {
+ t: T,
+}
+
+trait Mirror {
+ type Assoc;
+}
+impl Mirror for T {
+ type Assoc = T;
+}
+
+fn unconstrained_map U, U>() ->