Skip to content

Commit 8a6c878

Browse files
Do not compute type_of for impl item if impl where clauses are unsatisfied
1 parent d7ea436 commit 8a6c878

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ where
194194
.map(|pred| goal.with(cx, pred));
195195
ecx.add_goals(GoalSource::ImplWhereBound, where_clause_bounds);
196196

197+
ecx.try_evaluate_added_goals()?;
198+
197199
// Add GAT where clauses from the trait's definition.
198200
// FIXME: We don't need these, since these are the type's own WF obligations.
199201
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() {}

0 commit comments

Comments
 (0)