add tcx
to fn walk
This commit is contained in:
parent
bfaf13af4e
commit
cc47998e28
29 changed files with 73 additions and 67 deletions
|
@ -767,14 +767,15 @@ fn substs_infer_vars<'a, 'tcx>(
|
|||
selcx: &mut SelectionContext<'a, 'tcx>,
|
||||
substs: ty::Binder<'tcx, SubstsRef<'tcx>>,
|
||||
) -> impl Iterator<Item = TyOrConstInferVar<'tcx>> {
|
||||
let tcx = selcx.tcx();
|
||||
selcx
|
||||
.infcx()
|
||||
.resolve_vars_if_possible(substs)
|
||||
.skip_binder() // ok because this check doesn't care about regions
|
||||
.iter()
|
||||
.filter(|arg| arg.has_infer_types_or_consts())
|
||||
.flat_map(|arg| {
|
||||
let mut walker = arg.walk();
|
||||
.flat_map(move |arg| {
|
||||
let mut walker = arg.walk(tcx);
|
||||
while let Some(c) = walker.next() {
|
||||
if !c.has_infer_types_or_consts() {
|
||||
walker.visited.remove(&c);
|
||||
|
|
|
@ -278,7 +278,7 @@ fn predicate_references_self(
|
|||
(predicate, sp): (ty::Predicate<'tcx>, Span),
|
||||
) -> Option<Span> {
|
||||
let self_ty = tcx.types.self_param;
|
||||
let has_self_ty = |arg: &GenericArg<'_>| arg.walk().any(|arg| arg == self_ty.into());
|
||||
let has_self_ty = |arg: &GenericArg<'tcx>| arg.walk(tcx).any(|arg| arg == self_ty.into());
|
||||
match predicate.kind().skip_binder() {
|
||||
ty::PredicateKind::Trait(ref data) => {
|
||||
// In the case of a trait predicate, we can skip the "self" type.
|
||||
|
|
|
@ -947,7 +947,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let mut unsizing_params = GrowableBitSet::new_empty();
|
||||
if tcx.features().relaxed_struct_unsize {
|
||||
for arg in tail_field_ty.walk() {
|
||||
for arg in tail_field_ty.walk(tcx) {
|
||||
if let Some(i) = maybe_unsizing_param_idx(arg) {
|
||||
unsizing_params.insert(i);
|
||||
}
|
||||
|
@ -956,7 +956,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// Ensure none of the other fields mention the parameters used
|
||||
// in unsizing.
|
||||
for field in prefix_fields {
|
||||
for arg in tcx.type_of(field.did).walk() {
|
||||
for arg in tcx.type_of(field.did).walk(tcx) {
|
||||
if let Some(i) = maybe_unsizing_param_idx(arg) {
|
||||
unsizing_params.remove(i);
|
||||
}
|
||||
|
@ -968,7 +968,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
} else {
|
||||
let mut found = false;
|
||||
for arg in tail_field_ty.walk() {
|
||||
for arg in tail_field_ty.walk(tcx) {
|
||||
if let Some(i) = maybe_unsizing_param_idx(arg) {
|
||||
unsizing_params.insert(i);
|
||||
found = true;
|
||||
|
@ -984,7 +984,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// by putting it in a query; it would only need the `DefId` as it
|
||||
// looks at declared field types, not anything substituted.
|
||||
for field in prefix_fields {
|
||||
for arg in tcx.type_of(field.did).walk() {
|
||||
for arg in tcx.type_of(field.did).walk(tcx) {
|
||||
if let Some(i) = maybe_unsizing_param_idx(arg) {
|
||||
if unsizing_params.contains(i) {
|
||||
return Err(Unimplemented);
|
||||
|
|
|
@ -422,7 +422,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
|
||||
/// Pushes all the predicates needed to validate that `ty` is WF into `out`.
|
||||
fn compute(&mut self, arg: GenericArg<'tcx>) {
|
||||
let mut walker = arg.walk();
|
||||
let mut walker = arg.walk(self.tcx());
|
||||
let param_env = self.param_env;
|
||||
let depth = self.recursion_depth;
|
||||
while let Some(arg) = walker.next() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue