Attach deprecation lint proc_macro_derive_resolution_fallback to a specific node id

This commit is contained in:
Vadim Petrochenkov 2018-07-21 21:14:22 +03:00
parent 942b384d61
commit 79b5ebf576
3 changed files with 49 additions and 17 deletions

View file

@ -52,3 +52,16 @@ pub fn check_derive(_: TokenStream) -> TokenStream {
}
".parse().unwrap()
}
#[proc_macro_derive(CheckDeriveLint)]
pub fn check_derive_lint(_: TokenStream) -> TokenStream {
"
type AliasDeriveLint = FromOutside; // OK
struct OuterDeriveLint;
#[allow(proc_macro_derive_resolution_fallback)]
mod inner_derive_lint {
type Alias = FromOutside; // `FromOutside` shouldn't be available from here
type Inner = OuterDeriveLint; // `OuterDeriveLint` shouldn't be available from here
}
".parse().unwrap()
}

View file

@ -31,4 +31,7 @@ struct S;
//~| WARN this was previously accepted
struct Z;
#[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed
struct W;
fn main() {}