commit
4dcaa80651
3 changed files with 7 additions and 7 deletions
|
|
@ -71,11 +71,11 @@ pub struct DisallowedMacros {
|
|||
|
||||
// When a macro is disallowed in an early pass, it's stored
|
||||
// and emitted during the late pass. This happens for attributes.
|
||||
earlies: AttrStorage,
|
||||
early_macro_cache: AttrStorage,
|
||||
}
|
||||
|
||||
impl DisallowedMacros {
|
||||
pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf, earlies: AttrStorage) -> Self {
|
||||
pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf, early_macro_cache: AttrStorage) -> Self {
|
||||
let (disallowed, _) = create_disallowed_map(
|
||||
tcx,
|
||||
&conf.disallowed_macros,
|
||||
|
|
@ -88,7 +88,7 @@ impl DisallowedMacros {
|
|||
disallowed,
|
||||
seen: FxHashSet::default(),
|
||||
derive_src: None,
|
||||
earlies,
|
||||
early_macro_cache,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ impl_lint_pass!(DisallowedMacros => [DISALLOWED_MACROS]);
|
|||
impl LateLintPass<'_> for DisallowedMacros {
|
||||
fn check_crate(&mut self, cx: &LateContext<'_>) {
|
||||
// once we check a crate in the late pass we can emit the early pass lints
|
||||
if let Some(attr_spans) = self.earlies.clone().0.get() {
|
||||
if let Some(attr_spans) = self.early_macro_cache.clone().0.get() {
|
||||
for span in attr_spans {
|
||||
self.check(cx, *span, None);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ impl _ExternalStruct {
|
|||
pub fn _foo(self) {}
|
||||
}
|
||||
|
||||
pub fn _exernal_foo() {}
|
||||
pub fn _external_foo() {}
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@ fn main() {
|
|||
//~^ used_underscore_items
|
||||
}
|
||||
|
||||
// should not lint exteranl crate.
|
||||
// should not lint external crate.
|
||||
// user cannot control how others name their items
|
||||
fn external_item_call() {
|
||||
let foo_struct3 = external_item::_ExternalStruct {};
|
||||
foo_struct3._foo();
|
||||
|
||||
external_item::_exernal_foo();
|
||||
external_item::_external_foo();
|
||||
}
|
||||
|
||||
// should not lint foreign functions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue