Rollup merge of #82415 - petrochenkov:modin3, r=davidtwco

expand: Refactor module loading

This is an accompanying PR to https://github.com/rust-lang/rust/pull/82399, but they can be landed independently.
See individual commits for more details.

Anyone should be able to review this equally well because all people actually familiar with this code left the project.
This commit is contained in:
Dylan DPC 2021-03-08 13:13:19 +01:00 committed by GitHub
commit 4a4e3e667d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 298 additions and 295 deletions

View file

@ -302,8 +302,10 @@ fn configure_and_expand_inner<'a>(
..rustc_expand::expand::ExpansionConfig::default(crate_name.to_string())
};
let extern_mod_loaded = |k: &ast::Crate, ident: Ident| {
pre_expansion_lint(sess, lint_store, k, &*ident.name.as_str())
let extern_mod_loaded = |ident: Ident, attrs, items, span| {
let krate = ast::Crate { attrs, items, span, proc_macros: vec![] };
pre_expansion_lint(sess, lint_store, &krate, &ident.name.as_str());
(krate.attrs, krate.items)
};
let mut ecx = ExtCtxt::new(&sess, cfg, &mut resolver, Some(&extern_mod_loaded));