-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visibility tokens on types in extern { ... }
blocks are no longer given to procedural macros
#69315
Comments
I'll be able to look at this during the weekend, but it would be great if someone could come up with a minimal reproduction before that. |
Ok, wanted to get a gut-check to see if it was known what was happening. Did some reduction and it looks like the macro no longer gets the Given this input: pub mod wasm {
#[the_macro::the_macro]
extern "C" {
pub type Memory;
}
}
fn main() {
let _: wasm::Memory;
} then with this macro: extern crate proc_macro;
use proc_macro::*;
#[proc_macro_attribute]
pub fn the_macro(_attr: TokenStream, body: TokenStream) -> TokenStream {
let g = match body.clone().into_iter().nth(2) {
Some(TokenTree::Group(g)) => g,
_ => panic!("unexpected input"),
};
let tokens = g.stream().into_iter().collect::<Vec<_>>();
assert_eq!(tokens[0].to_string(), "pub");
return body;
} it fails with:
On stable it yields the expected If the |
extern { ... }
blocks are no longer given to procedural macros
(updated the issue title to reflect what appears to be the actual bug) |
Fixed by #69334. |
print vis & defaultness for nested items Fixes #69315 which was injected by #69194. r? @petrochenkov cc @alexcrichton
I had rustwasm/wasm-bindgen#2009 opened up on a project recently but this looks to be a regression I think. This regressed between nightly-2020-02-19 and nightly-2020-02-20, and bisecting further by commit reveals #69271 as the culprit. I'm not sure which of the PRs in that rollup though are the culprit here.
This can be reproduced by running
cargo check
from thecrates/js-sys
folder in the wasm-bindgen repository. Unfortunately this one probably isn't super easy to reproduce, so I'm hoping that someone more knowledgeable can hopefully take a look at this and have a better idea about what's going on.There's definitely macros going on in
#[wasm_bindgen]
(theMemory
type is synthesized by a macro), which leads me to think that #69211 may be the culprit? (cc @petrochenkov)The text was updated successfully, but these errors were encountered: