Update term for use in more places
Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the future, but slightly worried it allows items which are consts which only accept types.
This commit is contained in:
parent
67f56671d0
commit
e7529d6a38
31 changed files with 284 additions and 128 deletions
|
@ -6,7 +6,7 @@ use super::*;
|
|||
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
||||
use crate::infer::InferCtxt;
|
||||
use rustc_middle::ty::fold::TypeFolder;
|
||||
use rustc_middle::ty::{Region, RegionVid};
|
||||
use rustc_middle::ty::{Region, RegionVid, Term};
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
|
||||
|
@ -606,7 +606,11 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
}
|
||||
|
||||
fn is_self_referential_projection(&self, p: ty::PolyProjectionPredicate<'_>) -> bool {
|
||||
matches!(*p.ty().skip_binder().kind(), ty::Projection(proj) if proj == p.skip_binder().projection_ty)
|
||||
if let Term::Ty(ty) = p.term().skip_binder() {
|
||||
matches!(ty.kind(), ty::Projection(proj) if proj == &p.skip_binder().projection_ty)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn evaluate_nested_obligations(
|
||||
|
@ -663,7 +667,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
// Additionally, we check if we've seen this predicate before,
|
||||
// to avoid rendering duplicate bounds to the user.
|
||||
if self.is_param_no_infer(p.skip_binder().projection_ty.substs)
|
||||
&& !p.ty().skip_binder().has_infer_types()
|
||||
&& !p.term().skip_binder().has_infer_types()
|
||||
&& is_new_pred
|
||||
{
|
||||
debug!(
|
||||
|
@ -752,7 +756,8 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
// when we started out trying to unify
|
||||
// some inference variables. See the comment above
|
||||
// for more infomration
|
||||
if p.ty().skip_binder().has_infer_types() {
|
||||
if p.term().skip_binder().ty().map_or(false, |ty| ty.has_infer_types())
|
||||
{
|
||||
if !self.evaluate_nested_obligations(
|
||||
ty,
|
||||
v.into_iter(),
|
||||
|
@ -774,7 +779,8 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
// However, we should always make progress (either by generating
|
||||
// subobligations or getting an error) when we started off with
|
||||
// inference variables
|
||||
if p.ty().skip_binder().has_infer_types() {
|
||||
if p.term().skip_binder().ty().map_or(false, |ty| ty.has_infer_types())
|
||||
{
|
||||
panic!("Unexpected result when selecting {:?} {:?}", ty, obligation)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue