Skip to content

Commit 9e951c9

Browse files
hack the hack
1 parent 6823b44 commit 9e951c9

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
@@ -644,7 +644,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
644644
ImportKind::Single { target, bindings, .. },
645645
SideEffectBindings::Single { import_bindings },
646646
) => {
647-
debug!("{import_bindings:#?}");
648647
self.per_ns(|this, ns| {
649648
match import_bindings[ns] {
650649
Some(Some(binding)) => {
@@ -703,7 +702,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
703702
.resolution(import.parent_scope.module, key)
704703
.and_then(|r| r.binding())
705704
.is_some_and(|binding| binding.warn_ambiguity_recursive());
706-
debug!("defining binding from glob: {imported_binding:#?}");
707705
let _ = self.try_define_local(
708706
parent,
709707
key.ident.0,
@@ -1681,7 +1679,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16811679

16821680
let vis = match res.opt_def_id() {
16831681
Some(def_id) => {
1684-
self.greatest_vis_map.get(&def_id).copied().unwrap_or(binding.vis)
1682+
let vis =
1683+
self.greatest_vis_map.get(&def_id).copied().unwrap_or(binding.vis);
1684+
// macros exported through `macro_export` are not placed in this map, so
1685+
// hack the hack and make sure we still keep the best visibility.
1686+
if !vis.is_at_least(binding.vis, self.tcx()) { binding.vis } else { vis }
16851687
}
16861688
None => binding.vis,
16871689
};

0 commit comments

Comments
 (0)