diff options
| author | Michael Goulet <michael@errs.io> | 2024-06-27 12:06:47 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-06-27 12:11:09 -0400 |
| commit | c9870cfa4bed1163be4e9fde814d79860f3caa57 (patch) | |
| tree | 32f3a3abb1361b73b45d385c72c54cd44c6de907 | |
| parent | 81c2c575192d8d6cc79e67187cd17cc2ed831b12 (diff) | |
| download | rust-c9870cfa4bed1163be4e9fde814d79860f3caa57.tar.gz rust-c9870cfa4bed1163be4e9fde814d79860f3caa57.zip | |
supertrait_def_ids
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 4391e251675..d9fb10df103 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2443,7 +2443,7 @@ impl<'tcx> TyCtxt<'tcx> { /// Given the def_id of a Trait `trait_def_id` and the name of an associated item `assoc_name` /// returns true if the `trait_def_id` defines an associated item of name `assoc_name`. pub fn trait_may_define_assoc_item(self, trait_def_id: DefId, assoc_name: Ident) -> bool { - self.super_traits_of(trait_def_id).any(|trait_did| { + self.supertrait_def_ids(trait_def_id).any(|trait_did| { self.associated_items(trait_did) .filter_by_name_unhygienic(assoc_name.name) .any(|item| self.hygienic_eq(assoc_name, item.ident(self), trait_did)) @@ -2467,8 +2467,7 @@ impl<'tcx> TyCtxt<'tcx> { /// Computes the def-ids of the transitive supertraits of `trait_def_id`. This (intentionally) /// does not compute the full elaborated super-predicates but just the set of def-ids. It is used /// to identify which traits may define a given associated type to help avoid cycle errors. - /// Returns a `DefId` iterator. - fn super_traits_of(self, trait_def_id: DefId) -> impl Iterator<Item = DefId> + 'tcx { + fn supertrait_def_ids(self, trait_def_id: DefId) -> impl Iterator<Item = DefId> + 'tcx { let mut set = FxHashSet::default(); let mut stack = vec![trait_def_id]; |
