Don't try to resolve inference variables in WF computation, just register
This commit is contained in:
parent
c4693bc946
commit
2d15f1ca42
2 changed files with 24 additions and 37 deletions
|
@ -452,26 +452,16 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||||
predicate,
|
predicate,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
ty::ConstKind::Infer(infer) => {
|
ty::ConstKind::Infer(_) => {
|
||||||
let resolved = self.infcx.shallow_resolve(infer);
|
let cause = self.cause(traits::WellFormed(None));
|
||||||
// the `InferConst` changed, meaning that we made progress.
|
|
||||||
if resolved != infer {
|
|
||||||
let cause = self.cause(traits::WellFormed(None));
|
|
||||||
|
|
||||||
let resolved_constant = self.infcx.tcx.mk_const(ty::ConstS {
|
self.out.push(traits::Obligation::with_depth(
|
||||||
kind: ty::ConstKind::Infer(resolved),
|
cause,
|
||||||
ty: constant.ty(),
|
self.recursion_depth,
|
||||||
});
|
self.param_env,
|
||||||
self.out.push(traits::Obligation::with_depth(
|
ty::Binder::dummy(ty::PredicateKind::WellFormed(constant.into()))
|
||||||
cause,
|
|
||||||
self.recursion_depth,
|
|
||||||
self.param_env,
|
|
||||||
ty::Binder::dummy(ty::PredicateKind::WellFormed(
|
|
||||||
resolved_constant.into(),
|
|
||||||
))
|
|
||||||
.to_predicate(self.tcx()),
|
.to_predicate(self.tcx()),
|
||||||
));
|
));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ty::ConstKind::Error(_)
|
ty::ConstKind::Error(_)
|
||||||
| ty::ConstKind::Param(_)
|
| ty::ConstKind::Param(_)
|
||||||
|
@ -675,22 +665,14 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||||
// See also the comment on `fn obligations`, describing "livelock"
|
// See also the comment on `fn obligations`, describing "livelock"
|
||||||
// prevention, which happens before this can be reached.
|
// prevention, which happens before this can be reached.
|
||||||
ty::Infer(_) => {
|
ty::Infer(_) => {
|
||||||
let ty = self.infcx.shallow_resolve(ty);
|
let cause = self.cause(traits::WellFormed(None));
|
||||||
if let ty::Infer(ty::TyVar(_)) = ty.kind() {
|
self.out.push(traits::Obligation::with_depth(
|
||||||
// Not yet resolved, but we've made progress.
|
cause,
|
||||||
let cause = self.cause(traits::WellFormed(None));
|
self.recursion_depth,
|
||||||
self.out.push(traits::Obligation::with_depth(
|
param_env,
|
||||||
cause,
|
ty::Binder::dummy(ty::PredicateKind::WellFormed(ty.into()))
|
||||||
self.recursion_depth,
|
.to_predicate(self.tcx()),
|
||||||
param_env,
|
));
|
||||||
ty::Binder::dummy(ty::PredicateKind::WellFormed(ty.into()))
|
|
||||||
.to_predicate(self.tcx()),
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
// Yes, resolved, proceed with the result.
|
|
||||||
// FIXME(eddyb) add the type to `walker` instead of recursing.
|
|
||||||
self.compute(ty.into());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed for `SmallCString<N>`
|
||||||
--> $DIR/issue-98299.rs:4:5
|
--> $DIR/issue-98299.rs:4:36
|
||||||
|
|
|
|
||||||
LL | SmallCString::try_from(p).map(|cstr| cstr);
|
LL | SmallCString::try_from(p).map(|cstr| cstr);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for enum `Result<SmallCString<{_: usize}>, ()>`
|
| ^^^^
|
||||||
|
|
|
||||||
|
help: consider giving this closure parameter an explicit type, where the the value of const parameter `N` is specified
|
||||||
|
|
|
||||||
|
LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr);
|
||||||
|
| +++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue