review comments

This commit is contained in:
Esteban Küber 2022-12-27 13:44:39 -08:00
parent 1b341fe8a1
commit df2a35ea3d

View File

@ -29,9 +29,7 @@ use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::hir::nested_filter; use rustc_middle::hir::nested_filter;
use rustc_middle::ty::query::Providers; use rustc_middle::ty::query::Providers;
use rustc_middle::ty::util::{Discr, IntTypeExt}; use rustc_middle::ty::util::{Discr, IntTypeExt};
use rustc_middle::ty::{ use rustc_middle::ty::{self, AdtKind, Const, IsSuggestable, ToPredicate, Ty, TyCtxt};
self, AdtKind, Const, IsSuggestable, ToPredicate, Ty, TyCtxt, TypeVisitable,
};
use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::Span; use rustc_span::Span;
use rustc_target::spec::abi; use rustc_target::spec::abi;
@ -1270,7 +1268,7 @@ fn suggest_impl_iterator<'tcx>(
if !tcx if !tcx
.infer_ctxt() .infer_ctxt()
.build() .build()
.type_implements_trait(iter_trait, [ret_ty], tcx.param_env(iter_trait)) .type_implements_trait(iter_trait, [ret_ty], tcx.param_env(def_id))
.must_apply_modulo_regions() .must_apply_modulo_regions()
{ {
return None; return None;
@ -1296,8 +1294,7 @@ fn suggest_impl_iterator<'tcx>(
)); ));
if ocx.select_where_possible().is_empty() if ocx.select_where_possible().is_empty()
&& let item_ty = infcx.resolve_vars_if_possible(ty_var) && let item_ty = infcx.resolve_vars_if_possible(ty_var)
&& !item_ty.references_error() && item_ty.is_suggestable(tcx, false)
&& !item_ty.has_placeholders()
{ {
return Some(item_ty); return Some(item_ty);
} }