Skip to content
Permalink
Browse files

Make rustc_macro a Rust 2018 crate

  • Loading branch information...
Zoxc committed Mar 5, 2019
1 parent 1675212 commit 12a491fbe27eaed8200190aae017759e80cabad5
@@ -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
@@ -2,6 +2,7 @@
name = "rustc_macros"
version = "0.1.0"
authors = ["The Rust Project Developers"]
edition = "2018"

[lib]
proc-macro = true
@@ -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"
@@ -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,
@@ -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);
@@ -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;

0 comments on commit 12a491f

Please sign in to comment.
You can’t perform that action at this time.