rollup merge of #20482: kmcallister/macro-reform
Conflicts: src/libflate/lib.rs src/libstd/lib.rs src/libstd/macros.rs src/libsyntax/feature_gate.rs src/libsyntax/parse/parser.rs src/libsyntax/show_span.rs src/test/auxiliary/macro_crate_test.rs src/test/compile-fail/lint-stability.rs src/test/run-pass/intrinsics-math.rs src/test/run-pass/tcp-connect-timeouts.rs
This commit is contained in:
commit
7975fd9cee
314 changed files with 3452 additions and 1605 deletions
|
@ -194,13 +194,13 @@ pub trait Folder : Sized {
|
|||
noop_fold_local(l, self)
|
||||
}
|
||||
|
||||
fn fold_mac(&mut self, _macro: Mac) -> Mac {
|
||||
fn fold_mac(&mut self, _mac: Mac) -> Mac {
|
||||
panic!("fold_mac disabled by default");
|
||||
// NB: see note about macros above.
|
||||
// if you really want a folder that
|
||||
// works on macros, use this
|
||||
// definition in your trait impl:
|
||||
// fold::noop_fold_mac(_macro, self)
|
||||
// fold::noop_fold_mac(_mac, self)
|
||||
}
|
||||
|
||||
fn fold_explicit_self(&mut self, es: ExplicitSelf) -> ExplicitSelf {
|
||||
|
@ -1104,7 +1104,7 @@ pub fn noop_fold_mod<T: Folder>(Mod {inner, view_items, items}: Mod, folder: &mu
|
|||
}
|
||||
}
|
||||
|
||||
pub fn noop_fold_crate<T: Folder>(Crate {module, attrs, config, exported_macros, span}: Crate,
|
||||
pub fn noop_fold_crate<T: Folder>(Crate {module, attrs, config, mut exported_macros, span}: Crate,
|
||||
folder: &mut T) -> Crate {
|
||||
let config = folder.fold_meta_items(config);
|
||||
|
||||
|
@ -1135,6 +1135,10 @@ pub fn noop_fold_crate<T: Folder>(Crate {module, attrs, config, exported_macros,
|
|||
}, Vec::new(), span)
|
||||
};
|
||||
|
||||
for def in exported_macros.iter_mut() {
|
||||
def.id = folder.new_id(def.id);
|
||||
}
|
||||
|
||||
Crate {
|
||||
module: module,
|
||||
attrs: attrs,
|
||||
|
@ -1472,8 +1476,8 @@ mod test {
|
|||
fn fold_ident(&mut self, _: ast::Ident) -> ast::Ident {
|
||||
token::str_to_ident("zz")
|
||||
}
|
||||
fn fold_mac(&mut self, macro: ast::Mac) -> ast::Mac {
|
||||
fold::noop_fold_mac(macro, self)
|
||||
fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac {
|
||||
fold::noop_fold_mac(mac, self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue