Skip to content

Commit 0374022

Browse files
Do not compute type_of for impl item if impl where clauses are unsatisfied
1 parent b6240d3 commit 0374022

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ where
235235
.map(|pred| goal.with(cx, pred));
236236
ecx.add_goals(GoalSource::ImplWhereBound, where_clause_bounds);
237237

238+
ecx.try_evaluate_added_goals()?;
239+
238240
// Add GAT where clauses from the trait's definition.
239241
// FIXME: We don't need these, since these are the type's own WF obligations.
240242
ecx.add_goals(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//@ check-pass
2+
//@ revisions: current next
3+
//@ ignore-compare-mode-next-solver (explicit revisions)
4+
//@[next] compile-flags: -Znext-solver
5+
//@ edition: 2024
6+
7+
use std::future::Future;
8+
9+
trait Handler {}
10+
11+
struct W<T>(T);
12+
13+
trait SendTarget {
14+
fn call(self) -> impl Future<Output = ()> + Send;
15+
}
16+
17+
impl<T> SendTarget for W<T>
18+
where
19+
T: Handler + Send,
20+
{
21+
async fn call(self) {
22+
todo!()
23+
}
24+
}
25+
26+
impl<T> SendTarget for T
27+
where
28+
T: Handler + Send,
29+
{
30+
async fn call(self) {
31+
W(self).call().await
32+
}
33+
}
34+
35+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//@ check-pass
2+
//@ revisions: current next
3+
//@ ignore-compare-mode-next-solver (explicit revisions)
4+
//@[next] compile-flags: -Znext-solver
5+
//@ edition: 2024
6+
7+
trait Foo {
8+
fn call(self) -> impl Send;
9+
}
10+
11+
trait Nested {}
12+
impl<T> Foo for T
13+
where
14+
T: Nested,
15+
{
16+
fn call(self) -> impl Sized {
17+
NotSatisfied.call()
18+
}
19+
}
20+
21+
struct NotSatisfied;
22+
impl Foo for NotSatisfied {
23+
fn call(self) -> impl Sized {
24+
todo!()
25+
}
26+
}
27+
28+
fn main() {}

0 commit comments

Comments
 (0)