Skip to content

Commit

Permalink
Make rustc_macro a Rust 2018 crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 5, 2019
1 parent 1675212 commit 12a491f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
11 changes: 2 additions & 9 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,8 @@ pub mod util {
pub mod bug;
}

// A private module so that macro-expanded idents like
// `::rustc::lint::Lint` will also work in `rustc` itself.
//
// `libstd` uses the same trick.
#[doc(hidden)]
mod rustc {
pub use crate::lint;
pub use crate::ich;
}
// Allows macros to refer to this crate as `::rustc`
extern crate self as rustc;

// FIXME(#27438): right now the unit tests of librustc don't refer to any actual
// functions generated in librustc_data_structures (all
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "rustc_macros"
version = "0.1.0"
authors = ["The Rust Project Developers"]
edition = "2018"

[lib]
proc-macro = true
Expand All @@ -10,4 +11,4 @@ proc-macro = true
synstructure = "0.10.1"
syn = { version = "0.15.22", features = ["full"] }
proc-macro2 = "0.4.24"
quote = "0.6.10"
quote = "0.6.10"
5 changes: 3 additions & 2 deletions src/librustc_macros/src/hash_stable.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use synstructure;
use syn::{self, Meta, NestedMeta};
use syn::{self, Meta, NestedMeta, parse_quote};
use proc_macro2::{self, Ident};
use quote::quote;

struct Attributes {
ignore: bool,
Expand Down Expand Up @@ -46,7 +47,7 @@ fn parse_attributes(field: &syn::Field) -> Attributes {
attrs
}

pub fn hash_stable_derive(mut s: synstructure::Structure) -> proc_macro2::TokenStream {
pub fn hash_stable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
let generic: syn::GenericParam = parse_quote!('__ctx);
s.add_bounds(synstructure::AddBounds::Generics);
s.add_impl_generic(generic);
Expand Down
10 changes: 2 additions & 8 deletions src/librustc_macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#![feature(proc_macro_hygiene)]
#![deny(rust_2018_idioms)]

#[macro_use]
extern crate syn;
#[macro_use]
extern crate synstructure;
#[macro_use]
extern crate quote;
extern crate proc_macro;
extern crate proc_macro2;
use synstructure::decl_derive;

mod hash_stable;

Expand Down

0 comments on commit 12a491f

Please sign in to comment.