2023-02-18 08:12:49 +00:00
|
|
|
use std::mem;
|
2024-07-28 22:13:50 +00:00
|
|
|
|
2021-07-26 03:38:16 +00:00
|
|
|
use rustc_ast::visit::Visitor;
|
|
|
|
use rustc_ast::{Crate, EnumDef, ast, visit};
|
2023-03-19 19:11:28 +00:00
|
|
|
use rustc_data_structures::fx::FxHashSet;
|
2021-07-26 03:38:16 +00:00
|
|
|
use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
|
2022-11-18 22:52:49 +00:00
|
|
|
use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility, Level};
|
2023-02-22 15:51:17 +00:00
|
|
|
use rustc_middle::ty::Visibility;
|
2024-05-10 03:46:24 +00:00
|
|
|
use tracing::info;
|
2022-10-28 10:58:21 +00:00
|
|
|
|
2023-02-18 08:12:49 +00:00
|
|
|
use crate::{NameBinding, NameBindingKind, Resolver};
|
2024-07-28 22:13:50 +00:00
|
|
|
|
2022-10-28 10:58:21 +00:00
|
|
|
#[derive(Clone, Copy)]
|
2024-09-10 06:19:40 +00:00
|
|
|
enum ParentId<'ra> {
|
2022-10-28 10:58:21 +00:00
|
|
|
Def(LocalDefId),
|
2024-09-10 06:19:40 +00:00
|
|
|
Import(NameBinding<'ra>),
|
2022-10-28 10:58:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl ParentId<'_> {
|
|
|
|
fn level(self) -> Level {
|
|
|
|
match self {
|
|
|
|
ParentId::Def(_) => Level::Direct,
|
|
|
|
ParentId::Import(_) => Level::Reexported,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-26 03:38:16 +00:00
|
|
|
|
2024-09-10 06:19:40 +00:00
|
|
|
pub(crate) struct EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
|
|
|
|
r: &'a mut Resolver<'ra, 'tcx>,
|
2022-11-18 22:52:49 +00:00
|
|
|
def_effective_visibilities: EffectiveVisibilities,
|
2022-10-28 10:58:21 +00:00
|
|
|
/// While walking import chains we need to track effective visibilities per-binding, and def id
|
|
|
|
/// keys in `Resolver::effective_visibilities` are not enough for that, because multiple
|
|
|
|
/// bindings can correspond to a single def id in imports. So we keep a separate table.
|
2024-09-10 06:19:40 +00:00
|
|
|
import_effective_visibilities: EffectiveVisibilities<NameBinding<'ra>>,
|
2022-11-23 22:30:58 +00:00
|
|
|
// It's possible to recalculate this at any point, but it's relatively expensive.
|
|
|
|
current_private_vis: Visibility,
|
2021-07-26 03:38:16 +00:00
|
|
|
changed: bool,
|
|
|
|
}
|
|
|
|
|
2022-12-08 12:59:02 +00:00
|
|
|
impl Resolver<'_, '_> {
|
2022-11-18 22:52:49 +00:00
|
|
|
fn nearest_normal_mod(&mut self, def_id: LocalDefId) -> LocalDefId {
|
|
|
|
self.get_nearest_non_block_module(def_id.to_def_id()).nearest_parent_mod().expect_local()
|
|
|
|
}
|
2022-11-23 16:19:06 +00:00
|
|
|
|
2023-07-04 14:28:57 +00:00
|
|
|
fn private_vis_import(&mut self, binding: NameBinding<'_>) -> Visibility {
|
2022-11-23 16:19:06 +00:00
|
|
|
let NameBindingKind::Import { import, .. } = binding.kind else { unreachable!() };
|
|
|
|
Visibility::Restricted(
|
|
|
|
import
|
|
|
|
.id()
|
|
|
|
.map(|id| self.nearest_normal_mod(self.local_def_id(id)))
|
|
|
|
.unwrap_or(CRATE_DEF_ID),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn private_vis_def(&mut self, def_id: LocalDefId) -> Visibility {
|
2022-11-23 17:13:44 +00:00
|
|
|
// For mod items `nearest_normal_mod` returns its argument, but we actually need its parent.
|
|
|
|
let normal_mod_id = self.nearest_normal_mod(def_id);
|
|
|
|
if normal_mod_id == def_id {
|
2023-03-28 18:18:02 +00:00
|
|
|
Visibility::Restricted(self.tcx.local_parent(def_id))
|
2022-11-23 16:19:06 +00:00
|
|
|
} else {
|
2022-11-23 17:13:44 +00:00
|
|
|
Visibility::Restricted(normal_mod_id)
|
2022-11-23 16:19:06 +00:00
|
|
|
}
|
|
|
|
}
|
2022-11-18 22:52:49 +00:00
|
|
|
}
|
|
|
|
|
2024-09-10 06:19:40 +00:00
|
|
|
impl<'a, 'ra, 'tcx> EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
|
2022-09-22 13:19:53 +00:00
|
|
|
/// Fills the `Resolver::effective_visibilities` table with public & exported items
|
2021-07-26 03:38:16 +00:00
|
|
|
/// For now, this doesn't resolve macros (FIXME) and cannot resolve Impl, as we
|
2023-03-19 19:11:28 +00:00
|
|
|
/// need access to a TyCtxt for that. Returns the set of ambiguous re-exports.
|
2022-12-08 12:59:02 +00:00
|
|
|
pub(crate) fn compute_effective_visibilities<'c>(
|
2024-09-10 06:19:40 +00:00
|
|
|
r: &'a mut Resolver<'ra, 'tcx>,
|
2022-12-08 12:59:02 +00:00
|
|
|
krate: &'c Crate,
|
2024-09-10 06:19:40 +00:00
|
|
|
) -> FxHashSet<NameBinding<'ra>> {
|
2022-10-28 10:58:21 +00:00
|
|
|
let mut visitor = EffectiveVisibilitiesVisitor {
|
|
|
|
r,
|
2022-11-18 22:52:49 +00:00
|
|
|
def_effective_visibilities: Default::default(),
|
2022-10-28 10:58:21 +00:00
|
|
|
import_effective_visibilities: Default::default(),
|
2023-03-28 18:18:02 +00:00
|
|
|
current_private_vis: Visibility::Restricted(CRATE_DEF_ID),
|
2023-06-06 15:26:38 +00:00
|
|
|
changed: true,
|
2022-10-28 10:58:21 +00:00
|
|
|
};
|
2021-07-26 03:38:16 +00:00
|
|
|
|
2023-03-28 18:18:02 +00:00
|
|
|
visitor.def_effective_visibilities.update_root();
|
2022-09-22 13:19:53 +00:00
|
|
|
visitor.set_bindings_effective_visibilities(CRATE_DEF_ID);
|
2021-07-26 03:38:16 +00:00
|
|
|
|
|
|
|
while visitor.changed {
|
2022-10-28 10:58:21 +00:00
|
|
|
visitor.changed = false;
|
2021-07-26 03:38:16 +00:00
|
|
|
visit::walk_crate(&mut visitor, krate);
|
|
|
|
}
|
2022-11-18 22:52:49 +00:00
|
|
|
visitor.r.effective_visibilities = visitor.def_effective_visibilities;
|
2021-07-26 03:38:16 +00:00
|
|
|
|
2023-03-19 19:11:28 +00:00
|
|
|
let mut exported_ambiguities = FxHashSet::default();
|
|
|
|
|
2022-11-05 12:54:45 +00:00
|
|
|
// Update visibilities for import def ids. These are not used during the
|
|
|
|
// `EffectiveVisibilitiesVisitor` pass, because we have more detailed binding-based
|
|
|
|
// information, but are used by later passes. Effective visibility of an import def id
|
|
|
|
// is the maximum value among visibilities of bindings corresponding to that def id.
|
|
|
|
for (binding, eff_vis) in visitor.import_effective_visibilities.iter() {
|
|
|
|
let NameBindingKind::Import { import, .. } = binding.kind else { unreachable!() };
|
2024-06-25 16:03:39 +00:00
|
|
|
if !binding.is_ambiguity_recursive() {
|
2023-03-19 19:11:28 +00:00
|
|
|
if let Some(node_id) = import.id() {
|
|
|
|
r.effective_visibilities.update_eff_vis(r.local_def_id(node_id), eff_vis, r.tcx)
|
|
|
|
}
|
|
|
|
} else if binding.ambiguity.is_some() && eff_vis.is_public_at_level(Level::Reexported) {
|
|
|
|
exported_ambiguities.insert(*binding);
|
2022-11-05 12:54:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-22 13:19:53 +00:00
|
|
|
info!("resolve::effective_visibilities: {:#?}", r.effective_visibilities);
|
2023-03-19 19:11:28 +00:00
|
|
|
|
|
|
|
exported_ambiguities
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
|
2022-09-22 13:19:53 +00:00
|
|
|
/// Update effective visibilities of bindings in the given module,
|
|
|
|
/// including their whole reexport chains.
|
|
|
|
fn set_bindings_effective_visibilities(&mut self, module_id: LocalDefId) {
|
2023-11-21 19:07:32 +00:00
|
|
|
assert!(self.r.module_map.contains_key(&module_id.to_def_id()));
|
2022-08-14 14:04:30 +00:00
|
|
|
let module = self.r.get_module(module_id.to_def_id()).unwrap();
|
|
|
|
let resolutions = self.r.resolutions(module);
|
|
|
|
|
2022-10-19 13:56:41 +00:00
|
|
|
for (_, name_resolution) in resolutions.borrow().iter() {
|
2025-01-20 20:35:45 +00:00
|
|
|
let Some(mut binding) = name_resolution.borrow().binding() else {
|
|
|
|
continue;
|
|
|
|
};
|
|
|
|
// Set the given effective visibility level to `Level::Direct` and
|
|
|
|
// sets the rest of the `use` chain to `Level::Reexported` until
|
|
|
|
// we hit the actual exported item.
|
|
|
|
//
|
|
|
|
// If the binding is ambiguous, put the root ambiguity binding and all reexports
|
|
|
|
// leading to it into the table. They are used by the `ambiguous_glob_reexports`
|
|
|
|
// lint. For all bindings added to the table this way `is_ambiguity` returns true.
|
|
|
|
let is_ambiguity =
|
|
|
|
|binding: NameBinding<'ra>, warn: bool| binding.ambiguity.is_some() && !warn;
|
|
|
|
let mut parent_id = ParentId::Def(module_id);
|
|
|
|
let mut warn_ambiguity = binding.warn_ambiguity;
|
|
|
|
while let NameBindingKind::Import { binding: nested_binding, .. } = binding.kind {
|
|
|
|
self.update_import(binding, parent_id);
|
|
|
|
|
|
|
|
if is_ambiguity(binding, warn_ambiguity) {
|
|
|
|
// Stop at the root ambiguity, further bindings in the chain should not
|
|
|
|
// be reexported because the root ambiguity blocks any access to them.
|
|
|
|
// (Those further bindings are most likely not ambiguities themselves.)
|
|
|
|
break;
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
2025-01-20 20:35:45 +00:00
|
|
|
|
|
|
|
parent_id = ParentId::Import(binding);
|
|
|
|
binding = nested_binding;
|
|
|
|
warn_ambiguity |= nested_binding.warn_ambiguity;
|
|
|
|
}
|
|
|
|
if !is_ambiguity(binding, warn_ambiguity)
|
|
|
|
&& let Some(def_id) = binding.res().opt_def_id().and_then(|id| id.as_local())
|
|
|
|
{
|
|
|
|
self.update_def(def_id, binding.vis.expect_local(), parent_id);
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-10 06:19:40 +00:00
|
|
|
fn effective_vis_or_private(&mut self, parent_id: ParentId<'ra>) -> EffectiveVisibility {
|
2022-11-23 17:31:35 +00:00
|
|
|
// Private nodes are only added to the table for caching, they could be added or removed at
|
|
|
|
// any moment without consequences, so we don't set `changed` to true when adding them.
|
|
|
|
*match parent_id {
|
|
|
|
ParentId::Def(def_id) => self
|
|
|
|
.def_effective_visibilities
|
|
|
|
.effective_vis_or_private(def_id, || self.r.private_vis_def(def_id)),
|
|
|
|
ParentId::Import(binding) => self
|
|
|
|
.import_effective_visibilities
|
|
|
|
.effective_vis_or_private(binding, || self.r.private_vis_import(binding)),
|
2022-10-28 10:58:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-22 12:58:49 +00:00
|
|
|
/// All effective visibilities for a node are larger or equal than private visibility
|
|
|
|
/// for that node (see `check_invariants` in middle/privacy.rs).
|
|
|
|
/// So if either parent or nominal visibility is the same as private visibility, then
|
|
|
|
/// `min(parent_vis, nominal_vis) <= private_vis`, and the update logic is guaranteed
|
|
|
|
/// to not update anything and we can skip it.
|
|
|
|
///
|
|
|
|
/// We are checking this condition only if the correct value of private visibility is
|
2023-04-09 21:35:02 +00:00
|
|
|
/// cheaply available, otherwise it doesn't make sense performance-wise.
|
2023-03-22 12:58:49 +00:00
|
|
|
///
|
|
|
|
/// `None` is returned if the update can be skipped,
|
|
|
|
/// and cheap private visibility is returned otherwise.
|
|
|
|
fn may_update(
|
|
|
|
&self,
|
|
|
|
nominal_vis: Visibility,
|
|
|
|
parent_id: ParentId<'_>,
|
|
|
|
) -> Option<Option<Visibility>> {
|
|
|
|
match parent_id {
|
|
|
|
ParentId::Def(def_id) => (nominal_vis != self.current_private_vis
|
2023-12-05 20:16:08 +00:00
|
|
|
&& self.r.tcx.local_visibility(def_id) != self.current_private_vis)
|
2023-03-22 12:58:49 +00:00
|
|
|
.then_some(Some(self.current_private_vis)),
|
|
|
|
ParentId::Import(_) => Some(None),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-10 06:19:40 +00:00
|
|
|
fn update_import(&mut self, binding: NameBinding<'ra>, parent_id: ParentId<'ra>) {
|
2022-10-28 10:58:21 +00:00
|
|
|
let nominal_vis = binding.vis.expect_local();
|
2023-03-22 12:58:49 +00:00
|
|
|
let Some(cheap_private_vis) = self.may_update(nominal_vis, parent_id) else { return };
|
2022-11-23 17:31:35 +00:00
|
|
|
let inherited_eff_vis = self.effective_vis_or_private(parent_id);
|
2023-02-18 08:11:00 +00:00
|
|
|
let tcx = self.r.tcx;
|
2022-10-28 10:58:21 +00:00
|
|
|
self.changed |= self.import_effective_visibilities.update(
|
|
|
|
binding,
|
2023-05-10 12:35:00 +00:00
|
|
|
Some(nominal_vis),
|
2023-03-22 12:58:49 +00:00
|
|
|
|| cheap_private_vis.unwrap_or_else(|| self.r.private_vis_import(binding)),
|
2022-11-23 17:31:35 +00:00
|
|
|
inherited_eff_vis,
|
2022-10-28 10:58:21 +00:00
|
|
|
parent_id.level(),
|
2023-02-18 08:11:00 +00:00
|
|
|
tcx,
|
2022-10-28 10:58:21 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-09-10 06:19:40 +00:00
|
|
|
fn update_def(
|
|
|
|
&mut self,
|
|
|
|
def_id: LocalDefId,
|
|
|
|
nominal_vis: Visibility,
|
|
|
|
parent_id: ParentId<'ra>,
|
|
|
|
) {
|
2023-03-22 12:58:49 +00:00
|
|
|
let Some(cheap_private_vis) = self.may_update(nominal_vis, parent_id) else { return };
|
2022-11-23 17:31:35 +00:00
|
|
|
let inherited_eff_vis = self.effective_vis_or_private(parent_id);
|
2023-02-18 08:11:00 +00:00
|
|
|
let tcx = self.r.tcx;
|
2022-11-18 22:52:49 +00:00
|
|
|
self.changed |= self.def_effective_visibilities.update(
|
2022-09-25 11:25:02 +00:00
|
|
|
def_id,
|
2023-05-10 12:35:00 +00:00
|
|
|
Some(nominal_vis),
|
2023-03-22 12:58:49 +00:00
|
|
|
|| cheap_private_vis.unwrap_or_else(|| self.r.private_vis_def(def_id)),
|
2022-11-23 17:31:35 +00:00
|
|
|
inherited_eff_vis,
|
2022-10-28 10:58:21 +00:00
|
|
|
parent_id.level(),
|
2023-02-18 08:11:00 +00:00
|
|
|
tcx,
|
2022-09-25 11:25:02 +00:00
|
|
|
);
|
2022-10-28 10:58:21 +00:00
|
|
|
}
|
|
|
|
|
2023-03-28 18:18:02 +00:00
|
|
|
fn update_field(&mut self, def_id: LocalDefId, parent_id: LocalDefId) {
|
2023-12-05 20:16:08 +00:00
|
|
|
self.update_def(def_id, self.r.tcx.local_visibility(def_id), ParentId::Def(parent_id));
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-10 06:19:40 +00:00
|
|
|
impl<'a, 'ra, 'tcx> Visitor<'a> for EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
|
|
|
|
fn visit_item(&mut self, item: &'a ast::Item) {
|
2022-08-14 14:04:30 +00:00
|
|
|
let def_id = self.r.local_def_id(item.id);
|
2022-09-22 13:19:53 +00:00
|
|
|
// Update effective visibilities of nested items.
|
2022-08-14 14:04:30 +00:00
|
|
|
// If it's a mod, also make the visitor walk all of its items
|
|
|
|
match item.kind {
|
2021-07-26 03:38:16 +00:00
|
|
|
// Resolved in rustc_privacy when types are available
|
|
|
|
ast::ItemKind::Impl(..) => return,
|
|
|
|
|
|
|
|
// Should be unreachable at this stage
|
2024-03-15 11:21:03 +00:00
|
|
|
ast::ItemKind::MacCall(..) | ast::ItemKind::DelegationMac(..) => panic!(
|
2021-07-26 03:38:16 +00:00
|
|
|
"ast::ItemKind::MacCall encountered, this should not anymore appear at this stage"
|
|
|
|
),
|
|
|
|
|
2022-08-14 14:04:30 +00:00
|
|
|
ast::ItemKind::Mod(..) => {
|
2022-11-23 22:30:58 +00:00
|
|
|
let prev_private_vis =
|
|
|
|
mem::replace(&mut self.current_private_vis, Visibility::Restricted(def_id));
|
2022-09-22 13:19:53 +00:00
|
|
|
self.set_bindings_effective_visibilities(def_id);
|
2021-07-26 03:38:16 +00:00
|
|
|
visit::walk_item(self, item);
|
2022-11-23 22:30:58 +00:00
|
|
|
self.current_private_vis = prev_private_vis;
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
|
Move `ast::Item::ident` into `ast::ItemKind`.
`ast::Item` has an `ident` field.
- It's always non-empty for these item kinds: `ExternCrate`, `Static`,
`Const`, `Fn`, `Mod`, `TyAlias`, `Enum`, `Struct`, `Union`,
`Trait`, `TraitAlias`, `MacroDef`, `Delegation`.
- It's always empty for these item kinds: `Use`, `ForeignMod`,
`GlobalAsm`, `Impl`, `MacCall`, `DelegationMac`.
There is a similar story for `AssocItemKind` and `ForeignItemKind`.
Some sites that handle items check for an empty ident, some don't. This
is a very C-like way of doing things, but this is Rust, we have sum
types, we can do this properly and never forget to check for the
exceptional case and never YOLO possibly empty identifiers (or possibly
dummy spans) around and hope that things will work out.
The commit is large but it's mostly obvious plumbing work. Some notable
things.
- `ast::Item` got 8 bytes bigger. This could be avoided by boxing the
fields within some of the `ast::ItemKind` variants (specifically:
`Struct`, `Union`, `Enum`). I might do that in a follow-up; this
commit is big enough already.
- For the visitors: `FnKind` no longer needs an `ident` field because
the `Fn` within how has one.
- In the parser, the `ItemInfo` typedef is no longer needed. It was used
in various places to return an `Ident` alongside an `ItemKind`, but
now the `Ident` (if present) is within the `ItemKind`.
- In a few places I renamed identifier variables called `name` (or
`foo_name`) as `ident` (or `foo_ident`), to better match the type, and
because `name` is normally used for `Symbol`s. It's confusing to see
something like `foo_name.name`.
2025-03-20 22:47:43 +00:00
|
|
|
ast::ItemKind::Enum(_, EnumDef { ref variants }, _) => {
|
2022-09-22 13:19:53 +00:00
|
|
|
self.set_bindings_effective_visibilities(def_id);
|
2021-07-26 03:38:16 +00:00
|
|
|
for variant in variants {
|
2022-08-14 14:04:30 +00:00
|
|
|
let variant_def_id = self.r.local_def_id(variant.id);
|
2021-07-26 03:38:16 +00:00
|
|
|
for field in variant.data.fields() {
|
2023-03-28 18:18:02 +00:00
|
|
|
self.update_field(self.r.local_def_id(field.id), variant_def_id);
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Move `ast::Item::ident` into `ast::ItemKind`.
`ast::Item` has an `ident` field.
- It's always non-empty for these item kinds: `ExternCrate`, `Static`,
`Const`, `Fn`, `Mod`, `TyAlias`, `Enum`, `Struct`, `Union`,
`Trait`, `TraitAlias`, `MacroDef`, `Delegation`.
- It's always empty for these item kinds: `Use`, `ForeignMod`,
`GlobalAsm`, `Impl`, `MacCall`, `DelegationMac`.
There is a similar story for `AssocItemKind` and `ForeignItemKind`.
Some sites that handle items check for an empty ident, some don't. This
is a very C-like way of doing things, but this is Rust, we have sum
types, we can do this properly and never forget to check for the
exceptional case and never YOLO possibly empty identifiers (or possibly
dummy spans) around and hope that things will work out.
The commit is large but it's mostly obvious plumbing work. Some notable
things.
- `ast::Item` got 8 bytes bigger. This could be avoided by boxing the
fields within some of the `ast::ItemKind` variants (specifically:
`Struct`, `Union`, `Enum`). I might do that in a follow-up; this
commit is big enough already.
- For the visitors: `FnKind` no longer needs an `ident` field because
the `Fn` within how has one.
- In the parser, the `ItemInfo` typedef is no longer needed. It was used
in various places to return an `Ident` alongside an `ItemKind`, but
now the `Ident` (if present) is within the `ItemKind`.
- In a few places I renamed identifier variables called `name` (or
`foo_name`) as `ident` (or `foo_ident`), to better match the type, and
because `name` is normally used for `Symbol`s. It's confusing to see
something like `foo_name.name`.
2025-03-20 22:47:43 +00:00
|
|
|
ast::ItemKind::Struct(_, ref def, _) | ast::ItemKind::Union(_, ref def, _) => {
|
2021-07-26 03:38:16 +00:00
|
|
|
for field in def.fields() {
|
2023-03-28 18:18:02 +00:00
|
|
|
self.update_field(self.r.local_def_id(field.id), def_id);
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-14 14:04:30 +00:00
|
|
|
|
|
|
|
ast::ItemKind::Trait(..) => {
|
2022-09-22 13:19:53 +00:00
|
|
|
self.set_bindings_effective_visibilities(def_id);
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ast::ItemKind::ExternCrate(..)
|
|
|
|
| ast::ItemKind::Use(..)
|
|
|
|
| ast::ItemKind::Static(..)
|
|
|
|
| ast::ItemKind::Const(..)
|
|
|
|
| ast::ItemKind::GlobalAsm(..)
|
|
|
|
| ast::ItemKind::TyAlias(..)
|
|
|
|
| ast::ItemKind::TraitAlias(..)
|
|
|
|
| ast::ItemKind::MacroDef(..)
|
2022-10-28 10:58:21 +00:00
|
|
|
| ast::ItemKind::ForeignMod(..)
|
2023-11-26 12:57:31 +00:00
|
|
|
| ast::ItemKind::Fn(..)
|
|
|
|
| ast::ItemKind::Delegation(..) => return,
|
2021-07-26 03:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|