File tree Expand file tree Collapse file tree 4 files changed +9
-20
lines changed Expand file tree Collapse file tree 4 files changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -141,15 +141,8 @@ pub mod util {
141
141
pub mod bug;
142
142
}
143
143
144
- // A private module so that macro-expanded idents like
145
- // `::rustc::lint::Lint` will also work in `rustc` itself.
146
- //
147
- // `libstd` uses the same trick.
148
- #[ doc( hidden) ]
149
- mod rustc {
150
- pub use crate :: lint;
151
- pub use crate :: ich;
152
- }
144
+ // Allows macros to refer to this crate as `::rustc`
145
+ extern crate self as rustc;
153
146
154
147
// FIXME(#27438): right now the unit tests of librustc don't refer to any actual
155
148
// functions generated in librustc_data_structures (all
Original file line number Diff line number Diff line change 2
2
name = " rustc_macros"
3
3
version = " 0.1.0"
4
4
authors = [" The Rust Project Developers" ]
5
+ edition = " 2018"
5
6
6
7
[lib ]
7
8
proc-macro = true
@@ -10,4 +11,4 @@ proc-macro = true
10
11
synstructure = " 0.10.1"
11
12
syn = { version = " 0.15.22" , features = [" full" ] }
12
13
proc-macro2 = " 0.4.24"
13
- quote = " 0.6.10"
14
+ quote = " 0.6.10"
Original file line number Diff line number Diff line change 1
1
use synstructure;
2
- use syn:: { self , Meta , NestedMeta } ;
2
+ use syn:: { self , Meta , NestedMeta , parse_quote } ;
3
3
use proc_macro2:: { self , Ident } ;
4
+ use quote:: quote;
4
5
5
6
struct Attributes {
6
7
ignore : bool ,
@@ -46,7 +47,7 @@ fn parse_attributes(field: &syn::Field) -> Attributes {
46
47
attrs
47
48
}
48
49
49
- pub fn hash_stable_derive ( mut s : synstructure:: Structure ) -> proc_macro2:: TokenStream {
50
+ pub fn hash_stable_derive ( mut s : synstructure:: Structure < ' _ > ) -> proc_macro2:: TokenStream {
50
51
let generic: syn:: GenericParam = parse_quote ! ( ' __ctx) ;
51
52
s. add_bounds ( synstructure:: AddBounds :: Generics ) ;
52
53
s. add_impl_generic ( generic) ;
Original file line number Diff line number Diff line change 1
1
#![ feature( proc_macro_hygiene) ]
2
+ #![ deny( rust_2018_idioms) ]
2
3
3
- #[ macro_use]
4
- extern crate syn;
5
- #[ macro_use]
6
- extern crate synstructure;
7
- #[ macro_use]
8
- extern crate quote;
9
- extern crate proc_macro;
10
- extern crate proc_macro2;
4
+ use synstructure:: decl_derive;
11
5
12
6
mod hash_stable;
13
7
You can’t perform that action at this time.
0 commit comments