Use error term if missing associated item in new solver
This commit is contained in:
parent
9239760da8
commit
8921391a12
4 changed files with 30 additions and 2 deletions
|
@ -124,10 +124,24 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
if !assoc_def.item.defaultness(tcx).has_value() {
|
if !assoc_def.item.defaultness(tcx).has_value() {
|
||||||
tcx.sess.delay_span_bug(
|
let guar = tcx.sess.delay_span_bug(
|
||||||
tcx.def_span(assoc_def.item.def_id),
|
tcx.def_span(assoc_def.item.def_id),
|
||||||
"missing value for assoc item in impl",
|
"missing value for assoc item in impl",
|
||||||
);
|
);
|
||||||
|
let error_term = match assoc_def.item.kind {
|
||||||
|
ty::AssocKind::Const => tcx
|
||||||
|
.const_error(
|
||||||
|
tcx.type_of(goal.predicate.def_id())
|
||||||
|
.subst(tcx, goal.predicate.projection_ty.substs),
|
||||||
|
guar,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
ty::AssocKind::Type => tcx.ty_error(guar).into(),
|
||||||
|
ty::AssocKind::Fn => unreachable!(),
|
||||||
|
};
|
||||||
|
ecx.eq(goal.param_env, goal.predicate.term, error_term)
|
||||||
|
.expect("expected goal term to be fully unconstrained");
|
||||||
|
return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting the right substitutions here is complex, e.g. given:
|
// Getting the right substitutions here is complex, e.g. given:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0046]: not all trait items implemented, missing: `Error`
|
error[E0046]: not all trait items implemented, missing: `Error`
|
||||||
--> $DIR/issue-103181-1.rs:9:5
|
--> $DIR/issue-103181-1.rs:11:5
|
||||||
|
|
|
|
||||||
LL | type Error;
|
LL | type Error;
|
||||||
| ---------- `Error` from trait
|
| ---------- `Error` from trait
|
12
tests/ui/impl-trait/issue-103181-1.next.stderr
Normal file
12
tests/ui/impl-trait/issue-103181-1.next.stderr
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
error[E0046]: not all trait items implemented, missing: `Error`
|
||||||
|
--> $DIR/issue-103181-1.rs:11:5
|
||||||
|
|
|
||||||
|
LL | type Error;
|
||||||
|
| ---------- `Error` from trait
|
||||||
|
LL | }
|
||||||
|
LL | impl HttpBody for () {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^ missing `Error` in implementation
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0046`.
|
|
@ -1,3 +1,5 @@
|
||||||
|
// revisions: current next
|
||||||
|
//[next] compile-flags: -Ztrait-solver=next
|
||||||
// edition:2021
|
// edition:2021
|
||||||
|
|
||||||
mod hyper {
|
mod hyper {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue