]> git.lizzy.rs Git - rust.git/commitdiff
review comments
authorEsteban Küber <esteban@kuber.com.ar>
Sun, 8 Jan 2023 07:24:36 +0000 (07:24 +0000)
committerEsteban Küber <esteban@kuber.com.ar>
Wed, 11 Jan 2023 21:30:10 +0000 (21:30 +0000)
compiler/rustc_hir_analysis/src/astconv/mod.rs

index 7127dadc1e167d347ce7dba2fbd9e6d5c9fbbdec..315a2a2af1bcacebc5c6c52f7b64d8d904f51aac 100644 (file)
@@ -2129,11 +2129,7 @@ pub fn associated_path_to_ty(
                     let infcx = tcx.infer_ctxt().build();
                     // We create a fresh `ty::ParamEnv` instead of the one for `self.item_def_id()`
                     // to avoid a cycle error in `src/test/ui/resolve/issue-102946.rs`.
-                    let param_env = ty::ParamEnv::new(
-                        ty::List::empty(),
-                        traits::Reveal::All,
-                        hir::Constness::NotConst,
-                    );
+                    let param_env = ty::ParamEnv::empty();
                     let traits: Vec<_> = self
                         .tcx()
                         .all_traits()
@@ -2141,17 +2137,16 @@ pub fn associated_path_to_ty(
                             // Consider only traits with the associated type
                             tcx.associated_items(*trait_def_id)
                                 .in_definition_order()
-                                .find(|i| {
+                                .any(|i| {
                                     i.kind.namespace() == Namespace::TypeNS
                                         && i.ident(tcx).normalize_to_macros_2_0() == assoc_ident
                                         && matches!(i.kind, ty::AssocKind::Type)
                                 })
-                                .is_some()
                             // Consider only accessible traits
                             && tcx.visibility(*trait_def_id)
                                 .is_accessible_from(self.item_def_id(), tcx)
                             && tcx.all_impls(*trait_def_id)
-                                .filter(|impl_def_id| {
+                                .any(|impl_def_id| {
                                     let trait_ref = tcx.impl_trait_ref(impl_def_id);
                                     trait_ref.map_or(false, |impl_| {
                                         infcx
@@ -2164,8 +2159,6 @@ pub fn associated_path_to_ty(
                                     })
                                     && tcx.impl_polarity(impl_def_id) != ty::ImplPolarity::Negative
                                 })
-                                .next()
-                                .is_some()
                         })
                         .map(|trait_def_id| tcx.def_path_str(trait_def_id))
                         .collect();
@@ -2305,7 +2298,7 @@ fn qpath_to_ty(
                     .filter_map(|impl_def_id| tcx.impl_trait_ref(impl_def_id))
                     .map(|impl_| impl_.self_ty())
                     // We don't care about blanket impls.
-                    .filter(|self_ty| !self_ty.has_non_region_infer())
+                    .filter(|self_ty| !self_ty.has_non_region_param())
                     .map(|self_ty| tcx.erase_regions(self_ty).to_string())
                     .collect()
             };