Skip to content

Commit be968c5

Browse files
hack the hack
1 parent 12d32a0 commit be968c5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_resolve/src/imports.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
645645
ImportKind::Single { target, bindings, .. },
646646
SideEffectBindings::Single { import_bindings },
647647
) => {
648-
debug!("{import_bindings:#?}");
649648
self.per_ns(|this, ns| {
650649
match import_bindings[ns] {
651650
Some(Some(binding)) => {
@@ -704,7 +703,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
704703
.resolution(import.parent_scope.module, key)
705704
.and_then(|r| r.binding())
706705
.is_some_and(|binding| binding.warn_ambiguity_recursive());
707-
debug!("defining binding from glob: {imported_binding:#?}");
708706
let _ = self.try_define_local(
709707
parent,
710708
key.ident.0,
@@ -1675,7 +1673,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16751673

16761674
let vis = match res.opt_def_id() {
16771675
Some(def_id) => {
1678-
self.greatest_vis_map.get(&def_id).copied().unwrap_or(binding.vis)
1676+
let vis =
1677+
self.greatest_vis_map.get(&def_id).copied().unwrap_or(binding.vis);
1678+
// macros exported through `macro_export` are not placed in this map, so
1679+
// hack the hack and make sure we still keep the best visibility.
1680+
if !vis.is_at_least(binding.vis, self.tcx()) { binding.vis } else { vis }
16791681
}
16801682
None => binding.vis,
16811683
};

0 commit comments

Comments
 (0)