Rollup merge of #108010 - compiler-errors:can_eq-returns-bool, r=lcnr
Make `InferCtxt::can_eq` and `InferCtxt::can_sub` return booleans Nobody matches on the result, nor does the result return anything useful...
This commit is contained in:
commit
8f65e25aec
13 changed files with 33 additions and 43 deletions
|
@ -576,7 +576,7 @@ fn foo(&self) -> Self::T { String::new() }
|
|||
tcx.impl_defaultness(item.id.owner_id)
|
||||
{
|
||||
let assoc_ty = tcx.bound_type_of(item.id.owner_id).subst_identity();
|
||||
if self.infcx.can_eq(param_env, assoc_ty, found).is_ok() {
|
||||
if self.infcx.can_eq(param_env, assoc_ty, found) {
|
||||
diag.span_label(
|
||||
item.span,
|
||||
"associated type defaults can't be assumed inside the \
|
||||
|
@ -598,7 +598,7 @@ fn foo(&self) -> Self::T { String::new() }
|
|||
if let hir::AssocItemKind::Type = item.kind {
|
||||
let assoc_ty = tcx.bound_type_of(item.id.owner_id).subst_identity();
|
||||
|
||||
if self.infcx.can_eq(param_env, assoc_ty, found).is_ok() {
|
||||
if self.infcx.can_eq(param_env, assoc_ty, found) {
|
||||
diag.span_label(item.span, "expected this associated type");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -880,30 +880,20 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
self.inner.borrow_mut().unwrap_region_constraints().add_given(sub, sup);
|
||||
}
|
||||
|
||||
pub fn can_sub<T>(&self, param_env: ty::ParamEnv<'tcx>, a: T, b: T) -> UnitResult<'tcx>
|
||||
pub fn can_sub<T>(&self, param_env: ty::ParamEnv<'tcx>, a: T, b: T) -> bool
|
||||
where
|
||||
T: at::ToTrace<'tcx>,
|
||||
{
|
||||
let origin = &ObligationCause::dummy();
|
||||
self.probe(|_| {
|
||||
self.at(origin, param_env).sub(a, b).map(|InferOk { obligations: _, .. }| {
|
||||
// Ignore obligations, since we are unrolling
|
||||
// everything anyway.
|
||||
})
|
||||
})
|
||||
self.probe(|_| self.at(origin, param_env).sub(a, b).is_ok())
|
||||
}
|
||||
|
||||
pub fn can_eq<T>(&self, param_env: ty::ParamEnv<'tcx>, a: T, b: T) -> UnitResult<'tcx>
|
||||
pub fn can_eq<T>(&self, param_env: ty::ParamEnv<'tcx>, a: T, b: T) -> bool
|
||||
where
|
||||
T: at::ToTrace<'tcx>,
|
||||
{
|
||||
let origin = &ObligationCause::dummy();
|
||||
self.probe(|_| {
|
||||
self.at(origin, param_env).eq(a, b).map(|InferOk { obligations: _, .. }| {
|
||||
// Ignore obligations, since we are unrolling
|
||||
// everything anyway.
|
||||
})
|
||||
})
|
||||
self.probe(|_| self.at(origin, param_env).eq(a, b).is_ok())
|
||||
}
|
||||
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue