Skip to content

Commit a95c71e

Browse files
committed
Fixed "::::" appearing in module_path!()
1 parent c637cab commit a95c71e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,19 @@ pub fn expand_item(it: P<ast::Item>, fld: &mut MacroExpander)
412412
let mut new_items = match it.node {
413413
ast::ItemMac(..) => expand_item_mac(it, fld),
414414
ast::ItemMod(_) | ast::ItemForeignMod(_) => {
415-
fld.cx.mod_push(it.ident);
415+
let valid_ident =
416+
it.ident.name != parse::token::special_idents::invalid.name;
417+
418+
if valid_ident {
419+
fld.cx.mod_push(it.ident);
420+
}
416421
let macro_escape = contains_macro_escape(new_attrs.as_slice());
417422
let result = with_exts_frame!(fld.cx.syntax_env,
418423
macro_escape,
419424
noop_fold_item(it, fld));
420-
fld.cx.mod_pop();
425+
if valid_ident {
426+
fld.cx.mod_pop();
427+
}
421428
result
422429
},
423430
_ => {

0 commit comments

Comments
 (0)