Closed
Description
The following procedural macro works with nightly-2017-12-02 but fails with nightly-2017-12-03. I don't have an intuition for which is the correct behavior but just wanted to make sure this is intentional.
bb42071...f9b0897. #46343 seems relevant and is in the right range so cc @jseyfried and @nrc.
This is relevant to dtolnay/proc-macro-hack#15.
#!/bin/bash
set -x
cargo new mac
echo >>mac/Cargo.toml '
[lib]
name = "mac"
proc-macro = true
'
echo >mac/src/lib.rs '
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_derive(Hygiene, attributes(hygiene))]
pub fn hygiene(_: TokenStream) -> TokenStream {
let macro_rules = "
macro_rules! hygiene {
() => { x }
}
";
macro_rules.parse().unwrap()
}
'
cargo new repro --bin
echo >>repro/Cargo.toml 'mac = { path = "../mac" }'
echo >repro/src/main.rs '
#[macro_use] extern crate mac;
fn main() {
let x = 0usize;
#[derive(Hygiene)]
#[hygiene(print = "x")]
struct S;
println!("{:?}", hygiene!());
}
'
cargo run --manifest-path repro/Cargo.toml
Metadata
Metadata
Assignees
Labels
Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.In the final comment period and will be merged soon unless new substantive objections are raised.Performance or correctness regression from stable to beta.