Fixed non-declarative-nor-opaque macros effective privacy.
cc @petrochenkov
This commit is contained in:
parent
255f107cac
commit
a4de27aeec
1 changed files with 8 additions and 14 deletions
|
@ -832,21 +832,15 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
|
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef<'tcx>) {
|
||||||
// HACK (or fix?): a
|
// Non-opaque macros cannot make other items more accessible than they already are.
|
||||||
// ```rust,ignore (dummy example)
|
if attr::find_transparency(&self.tcx.sess, &md.attrs, md.ast.macro_rules).0
|
||||||
// mod private {
|
!= Transparency::Opaque
|
||||||
// #[rustc_macro_transparency(semitransparent)]
|
|
||||||
// pub macro m { … }
|
|
||||||
// }
|
|
||||||
// ```
|
|
||||||
// is *not* `Public`ly reachable and yet this shortcut would express
|
|
||||||
// that.
|
|
||||||
// FIXME!
|
|
||||||
if md.ast.macro_rules
|
|
||||||
&& attr::find_transparency(&self.tcx.sess, &md.attrs, md.ast.macro_rules).0
|
|
||||||
!= Transparency::Opaque
|
|
||||||
{
|
{
|
||||||
self.update(md.hir_id, Some(AccessLevel::Public));
|
// `#[macro_export]`-ed `macro_rules!` are `Public` since they
|
||||||
|
// ignore their containing path to always appear at the crate root.
|
||||||
|
if md.ast.macro_rules {
|
||||||
|
self.update(md.hir_id, Some(AccessLevel::Public));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue