Skip to content
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

Lazy anon const default substs #4

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5e7fed1
Add a regression test for issue-63355
JohnTitor Jun 30, 2021
5c9bd9c
Recover from a misplaced inner doc comment
Aaron1011 Jul 2, 2021
34ff259
Add help on reinitialization between move and access
ptrojahn May 19, 2021
ae33a97
Set personality with LLVMSetPersonalityFn
tmiasko Jul 7, 2021
f612ba1
Use existing declaration of rust_eh_personality
tmiasko Jul 7, 2021
fd406a8
Give a helpful error for the mistake `..==`
inquisitivecrystal Jun 26, 2021
b56079e
Add diagnostics test for mistyped inclusive ranges
inquisitivecrystal Jul 11, 2021
e32ecee
Remove unnecessary CrateNum from Cache.externs
jyn514 Jul 5, 2021
a30fa08
Remove trival `impl Clean for CrateNum`
jyn514 Jul 5, 2021
7c98b3c
Keep metadata when using gc-sections with profile-generate.
JamieCunliffe Jul 8, 2021
dc639c9
Warn about useless assignments of variables/fields to themselves
FabianWolff Jul 14, 2021
47ea2ae
Separate encoding paths.
cjgillot Jun 24, 2021
c2d43e1
Simplify metadata decoding.
cjgillot Jun 27, 2021
1a90004
Added diagnostic items to functions for Clippy
xFrednet Jul 15, 2021
d38f2b0
Added diagnostic items to structs and traits for Clippy
xFrednet Jul 15, 2021
0d3d6f0
fix typo in compile_fail doctest
RalfJung Jul 16, 2021
774a79e
Mark `Option::insert` as must_use
oxalica Jul 16, 2021
ce59f1a
Consider all fields when comparing DllImports, to remove nondetermini…
ricobbe Jul 12, 2021
9b874c4
Check that const parameters of trait methods have compatible types
FabianWolff Jul 3, 2021
6ffb6c4
rustc_middle: remove redundant clone
matthiaskrgr Jul 16, 2021
67002db
Corrected symbol order after adding diagnostic items
xFrednet Jul 17, 2021
6e78d6c
Make the CrateNum part of the ExpnId.
cjgillot Jul 10, 2021
078dd37
Use LocalExpnId where possible.
cjgillot Jun 25, 2021
2fe37c5
Choose encoding format in caller code.
cjgillot Jun 27, 2021
37a13de
Encode ExpnId using ExpnHash for incr. comp.
cjgillot Jun 27, 2021
dbd2d77
Drop orig_id.
cjgillot Jun 27, 2021
41c1f39
Drop ExpnData::krate.
cjgillot Jun 27, 2021
a51b131
Always hash spans in expn.
cjgillot Jun 27, 2021
0f8573e
Pass ExpnData by reference.
cjgillot Jul 12, 2021
dddaa6d
Rename expn_info -> expn_data.
cjgillot Jul 15, 2021
b35ceee
Simplify Expn creation.
cjgillot Jul 15, 2021
68511b5
Auto merge of #86676 - cjgillot:localexpn, r=petrochenkov
bors Jul 17, 2021
d954a8e
Some perf optimizations and logging
jackh726 Jul 16, 2021
fa839b1
Add needs_normalization
jackh726 Jul 16, 2021
c7331d6
Auto merge of #87203 - jackh726:logging, r=nikomatsakis
bors Jul 17, 2021
eb0b95b
Auto merge of #87129 - FabianWolff:issue-75356, r=varkor
bors Jul 17, 2021
77d1559
Auto merge of #85686 - ptrojahn:loop_reinitialize, r=estebank
bors Jul 18, 2021
ddd5448
Compute a better `lint_node_id` during expansion
Aaron1011 Jul 14, 2021
2bd15a2
Add missing `visit_expr_field`
Aaron1011 Jul 15, 2021
d6e3c11
Add additional missing lint handling logic
Aaron1011 Jul 15, 2021
7ca089c
Only use `assign_id!` for ast nodes that support attributes
Aaron1011 Jul 17, 2021
1c1c794
Add test for `#[allow]` for warnings on attribute macro
Aaron1011 Jul 17, 2021
76300d5
Rollup merge of #86763 - JohnTitor:test-63355, r=oli-obk
JohnTitor Jul 18, 2021
469935f
Rollup merge of #86814 - Aaron1011:inner-doc-recover, r=estebank
JohnTitor Jul 18, 2021
783efd2
Rollup merge of #86843 - FabianWolff:issue-86820, r=lcnr
JohnTitor Jul 18, 2021
eef5108
Rollup merge of #86889 - jyn514:crate-cleanup, r=camelid
JohnTitor Jul 18, 2021
81d0b70
Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, …
JohnTitor Jul 18, 2021
07faa2e
Rollup merge of #87170 - xFrednet:clippy-5393-add-diagnostic-items, r…
JohnTitor Jul 18, 2021
c1ee9a3
Rollup merge of #87183 - RalfJung:option-doctest, r=jyn514
JohnTitor Jul 18, 2021
810e478
Rollup merge of #87205 - matthiaskrgr:clippy_cln, r=oli-obk
JohnTitor Jul 18, 2021
3ab6b60
Auto merge of #87071 - inquisitivecrystal:inclusive-range, r=estebank
bors Jul 18, 2021
5a8a441
Auto merge of #87242 - JohnTitor:rollup-t9rmwpo, r=JohnTitor
bors Jul 18, 2021
81241cb
Move OnDiskCache to rustc_query_impl.
cjgillot Jun 28, 2021
5b92150
Remove deadlock virtual call.
cjgillot Jun 28, 2021
1807305
Auto merge of #86698 - cjgillot:modc, r=estebank
bors Jul 18, 2021
0fcd59a
update Miri
RalfJung Jul 18, 2021
331da58
Auto merge of #87252 - RalfJung:miri, r=RalfJung
bors Jul 18, 2021
dbd4fd5
feat(rustc_lint): add `dyn_drop`
notriddle Jul 3, 2021
83d3a94
Add `#![allow(dyn_drop)]` to test cases with `dyn Drop` in them
notriddle Jul 3, 2021
e054522
fix(clippy): add missing allow(dyn_drop)
notriddle Jul 18, 2021
5921685
Auto merge of #86950 - tmiasko:personality, r=nagisa
bors Jul 18, 2021
b548d9f
Auto merge of #87004 - JamieCunliffe:pgo-gc-sections, r=Mark-Simulacrum
bors Jul 18, 2021
10c0b00
Auto merge of #86848 - notriddle:notriddle/drop-dyn, r=varkor
bors Jul 19, 2021
0ecff8c
Auto merge of #87146 - Aaron1011:better-macro-lint, r=petrochenkov
bors Jul 19, 2021
83f0822
Auto merge of #87196 - oxalica:option-insert-must-use, r=joshtriplett
bors Jul 19, 2021
3372f27
require a `tcx` for `TypeVisitor`
lcnr Mar 13, 2021
1bc1691
make unevaluated const substs optional
lcnr Mar 15, 2021
2e13be1
add `tcx` to `fn walk`
lcnr Jul 17, 2021
80423d6
update `TypeFlags` to deal with missing ct substs
lcnr Jul 17, 2021
3ea3257
don't just compare `ty::Const`
lcnr Jul 19, 2021
d823155
check for cycles in `default_anon_const_substs`
lcnr Jul 19, 2021
4b8eae1
use `ty::Unevaluated` instead of def substs pair
lcnr Jul 19, 2021
ddae395
ignore const substs in `implicit_infer`
lcnr Jul 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use LocalExpnId where possible.
  • Loading branch information
cjgillot committed Jul 17, 2021
commit 078dd37f882a59d4277d80b829d729bfd2b5a5c2
10 changes: 5 additions & 5 deletions compiler/rustc_ast/src/node_id.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_span::{ExpnId, LocalExpnId};
use rustc_span::LocalExpnId;
use std::fmt;

rustc_index::newtype_index! {
Expand All @@ -24,12 +24,12 @@ pub const CRATE_NODE_ID: NodeId = NodeId::from_u32(0);
pub const DUMMY_NODE_ID: NodeId = NodeId::MAX;

impl NodeId {
pub fn placeholder_from_expn_id(expn_id: ExpnId) -> Self {
NodeId::from_u32(expn_id.expect_local().as_u32())
pub fn placeholder_from_expn_id(expn_id: LocalExpnId) -> Self {
NodeId::from_u32(expn_id.as_u32())
}

pub fn placeholder_to_expn_id(self) -> ExpnId {
LocalExpnId::from_u32(self.as_u32()).to_expn_id()
pub fn placeholder_to_expn_id(self) -> LocalExpnId {
LocalExpnId::from_u32(self.as_u32())
}
}

Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_builtin_macros/src/deriving/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ pub fn expand_deriving_clone(
Annotatable::Item(ref annitem) => match annitem.kind {
ItemKind::Struct(_, Generics { ref params, .. })
| ItemKind::Enum(_, Generics { ref params, .. }) => {
let container_id = cx.current_expansion.id.expn_data().parent;
if cx.resolver.has_derive_copy(container_id)
let container_id = cx.current_expansion.id.expn_data().parent.expect_local();
let has_derive_copy = cx.resolver.has_derive_copy(container_id);
if has_derive_copy
&& !params
.iter()
.any(|param| matches!(param.kind, ast::GenericParamKind::Type { .. }))
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl<'a> TraitDef<'a> {
.any(|param| matches!(param.kind, ast::GenericParamKind::Type { .. })),
_ => unreachable!(),
};
let container_id = cx.current_expansion.id.expn_data().parent;
let container_id = cx.current_expansion.id.expn_data().parent.expect_local();
let always_copy = has_no_type_params && cx.resolver.has_derive_copy(container_id);
let use_temporaries = is_packed && always_copy;

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/proc_macro_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ fn mk_decls(
&[sym::rustc_attrs, sym::proc_macro_internals],
None,
);
let span = DUMMY_SP.with_def_site_ctxt(expn_id);
let span = DUMMY_SP.with_def_site_ctxt(expn_id.to_expn_id());

let proc_macro = Ident::new(sym::proc_macro, span);
let krate = cx.item(span, proc_macro, Vec::new(), ast::ItemKind::ExternCrate(None));
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/standard_library_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub fn inject(
&[sym::prelude_import],
None,
);
let span = DUMMY_SP.with_def_site_ctxt(expn_id);
let call_site = DUMMY_SP.with_call_site_ctxt(expn_id);
let span = DUMMY_SP.with_def_site_ctxt(expn_id.to_expn_id());
let call_site = DUMMY_SP.with_call_site_ctxt(expn_id.to_expn_id());

let ecfg = ExpansionConfig::default("std_lib_injection".to_string());
let cx = ExtCtxt::new(sess, ecfg, resolver, None);
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_builtin_macros/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> {
for test in &mut tests {
// See the comment on `mk_main` for why we're using
// `apply_mark` directly.
test.ident.span = test.ident.span.apply_mark(expn_id, Transparency::Opaque);
test.ident.span =
test.ident.span.apply_mark(expn_id.to_expn_id(), Transparency::Opaque);
}
self.cx.test_cases.extend(tests);
}
Expand Down Expand Up @@ -223,7 +224,7 @@ fn generate_test_harness(
&[sym::test, sym::rustc_attrs],
None,
);
let def_site = DUMMY_SP.with_def_site_ctxt(expn_id);
let def_site = DUMMY_SP.with_def_site_ctxt(expn_id.to_expn_id());

// Remove the entry points
let mut cleaner = EntryPointCleaner { sess, depth: 0, def_site };
Expand Down
40 changes: 24 additions & 16 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_parse::{self, nt_to_tokenstream, parser, MACRO_ARGUMENTS};
use rustc_session::{parse::ParseSess, Limit, Session};
use rustc_span::def_id::{CrateNum, DefId};
use rustc_span::edition::Edition;
use rustc_span::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind};
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{FileName, MultiSpan, Span, DUMMY_SP};
Expand Down Expand Up @@ -813,15 +813,15 @@ impl SyntaxExtension {

pub fn expn_data(
&self,
parent: ExpnId,
parent: LocalExpnId,
call_site: Span,
descr: Symbol,
macro_def_id: Option<DefId>,
parent_module: Option<DefId>,
) -> ExpnData {
ExpnData::new(
ExpnKind::Macro(self.macro_kind(), descr),
parent,
parent.to_expn_id(),
call_site,
self.span,
self.allow_internal_unstable.clone(),
Expand All @@ -843,7 +843,11 @@ pub trait ResolverExpand {
fn next_node_id(&mut self) -> NodeId;

fn resolve_dollar_crates(&mut self);
fn visit_ast_fragment_with_placeholders(&mut self, expn_id: ExpnId, fragment: &AstFragment);
fn visit_ast_fragment_with_placeholders(
&mut self,
expn_id: LocalExpnId,
fragment: &AstFragment,
);
fn register_builtin_macro(&mut self, name: Symbol, ext: SyntaxExtensionKind);

fn expansion_for_ast_pass(
Expand All @@ -852,37 +856,41 @@ pub trait ResolverExpand {
pass: AstPass,
features: &[Symbol],
parent_module_id: Option<NodeId>,
) -> ExpnId;
) -> LocalExpnId;

fn resolve_imports(&mut self);

fn resolve_macro_invocation(
&mut self,
invoc: &Invocation,
eager_expansion_root: ExpnId,
eager_expansion_root: LocalExpnId,
force: bool,
) -> Result<Lrc<SyntaxExtension>, Indeterminate>;

fn check_unused_macros(&mut self);

/// Some parent node that is close enough to the given macro call.
fn lint_node_id(&self, expn_id: ExpnId) -> NodeId;
fn lint_node_id(&self, expn_id: LocalExpnId) -> NodeId;

// Resolver interfaces for specific built-in macros.
/// Does `#[derive(...)]` attribute with the given `ExpnId` have built-in `Copy` inside it?
fn has_derive_copy(&self, expn_id: ExpnId) -> bool;
fn has_derive_copy(&self, expn_id: LocalExpnId) -> bool;
/// Resolve paths inside the `#[derive(...)]` attribute with the given `ExpnId`.
fn resolve_derives(
&mut self,
expn_id: ExpnId,
expn_id: LocalExpnId,
force: bool,
derive_paths: &dyn Fn() -> DeriveResolutions,
) -> Result<(), Indeterminate>;
/// Take resolutions for paths inside the `#[derive(...)]` attribute with the given `ExpnId`
/// back from resolver.
fn take_derive_resolutions(&mut self, expn_id: ExpnId) -> Option<DeriveResolutions>;
fn take_derive_resolutions(&mut self, expn_id: LocalExpnId) -> Option<DeriveResolutions>;
/// Path resolution logic for `#[cfg_accessible(path)]`.
fn cfg_accessible(&mut self, expn_id: ExpnId, path: &ast::Path) -> Result<bool, Indeterminate>;
fn cfg_accessible(
&mut self,
expn_id: LocalExpnId,
path: &ast::Path,
) -> Result<bool, Indeterminate>;

/// Decodes the proc-macro quoted span in the specified crate, with the specified id.
/// No caching is performed.
Expand Down Expand Up @@ -913,7 +921,7 @@ impl ModuleData {

#[derive(Clone)]
pub struct ExpansionData {
pub id: ExpnId,
pub id: LocalExpnId,
pub depth: usize,
pub module: Rc<ModuleData>,
pub dir_ownership: DirOwnership,
Expand Down Expand Up @@ -958,7 +966,7 @@ impl<'a> ExtCtxt<'a> {
extern_mod_loaded,
root_path: PathBuf::new(),
current_expansion: ExpansionData {
id: ExpnId::root(),
id: LocalExpnId::ROOT,
depth: 0,
module: Default::default(),
dir_ownership: DirOwnership::Owned { relative: None },
Expand Down Expand Up @@ -995,19 +1003,19 @@ impl<'a> ExtCtxt<'a> {
/// Equivalent of `Span::def_site` from the proc macro API,
/// except that the location is taken from the span passed as an argument.
pub fn with_def_site_ctxt(&self, span: Span) -> Span {
span.with_def_site_ctxt(self.current_expansion.id)
span.with_def_site_ctxt(self.current_expansion.id.to_expn_id())
}

/// Equivalent of `Span::call_site` from the proc macro API,
/// except that the location is taken from the span passed as an argument.
pub fn with_call_site_ctxt(&self, span: Span) -> Span {
span.with_call_site_ctxt(self.current_expansion.id)
span.with_call_site_ctxt(self.current_expansion.id.to_expn_id())
}

/// Equivalent of `Span::mixed_site` from the proc macro API,
/// except that the location is taken from the span passed as an argument.
pub fn with_mixed_site_ctxt(&self, span: Span) -> Span {
span.with_mixed_site_ctxt(self.current_expansion.id)
span.with_mixed_site_ctxt(self.current_expansion.id.to_expn_id())
}

/// Returns span for the macro which originally caused the current expansion to happen.
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_session::parse::{feature_err, ParseSess};
use rustc_session::Limit;
use rustc_span::symbol::{sym, Ident};
use rustc_span::{ExpnId, FileName, Span};
use rustc_span::{FileName, LocalExpnId, Span};

use smallvec::{smallvec, SmallVec};
use std::ops::DerefMut;
Expand Down Expand Up @@ -508,7 +508,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
.map(|(path, item, _exts)| {
// FIXME: Consider using the derive resolutions (`_exts`)
// instead of enqueuing the derives to be resolved again later.
let expn_id = ExpnId::fresh_empty();
let expn_id = LocalExpnId::fresh_empty();
derive_invocations.push((
Invocation {
kind: InvocationKind::Derive { path, item },
Expand Down Expand Up @@ -993,7 +993,7 @@ struct InvocationCollector<'a, 'b> {

impl<'a, 'b> InvocationCollector<'a, 'b> {
fn collect(&mut self, fragment_kind: AstFragmentKind, kind: InvocationKind) -> AstFragment {
let expn_id = ExpnId::fresh_empty();
let expn_id = LocalExpnId::fresh_empty();
let vis = kind.placeholder_visibility();
self.invocations.push((
Invocation {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndSpacing};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{pluralize, PResult};
use rustc_span::hygiene::{ExpnId, Transparency};
use rustc_span::hygiene::{LocalExpnId, Transparency};
use rustc_span::symbol::MacroRulesNormalizedIdent;
use rustc_span::Span;

use smallvec::{smallvec, SmallVec};
use std::mem;

// A Marker adds the given mark to the syntax context.
struct Marker(ExpnId, Transparency);
struct Marker(LocalExpnId, Transparency);

impl MutVisitor for Marker {
fn token_visiting_enabled(&self) -> bool {
true
}

fn visit_span(&mut self, span: &mut Span) {
*span = span.apply_mark(self.0, self.1)
*span = span.apply_mark(self.0.to_expn_id(), self.1)
}
}

Expand Down
37 changes: 24 additions & 13 deletions compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use rustc_middle::bug;
use rustc_middle::hir::exports::Export;
use rustc_middle::middle::cstore::CrateStore;
use rustc_middle::ty;
use rustc_span::hygiene::{ExpnId, MacroKind};
use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind};
use rustc_span::source_map::{respan, Spanned};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::Span;
Expand All @@ -42,7 +42,7 @@ use tracing::debug;

type Res = def::Res<NodeId>;

impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, ExpnId) {
impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, LocalExpnId) {
fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> {
arenas.alloc_name_binding(NameBinding {
kind: NameBindingKind::Module(self.0),
Expand All @@ -54,7 +54,7 @@ impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, ExpnId) {
}
}

impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, ExpnId) {
impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, LocalExpnId) {
fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> {
arenas.alloc_name_binding(NameBinding {
kind: NameBindingKind::Res(self.0, false),
Expand All @@ -68,7 +68,7 @@ impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, ExpnId) {

struct IsMacroExport;

impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, ExpnId, IsMacroExport) {
impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, LocalExpnId, IsMacroExport) {
fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> {
arenas.alloc_name_binding(NameBinding {
kind: NameBindingKind::Res(self.0, true),
Expand Down Expand Up @@ -157,7 +157,12 @@ impl<'a> Resolver<'a> {
crate fn macro_def_scope(&mut self, expn_id: ExpnId) -> Module<'a> {
let def_id = match expn_id.expn_data().macro_def_id {
Some(def_id) => def_id,
None => return self.ast_transform_scopes.get(&expn_id).unwrap_or(&self.graph_root),
None => {
return expn_id
.as_local()
.and_then(|expn_id| self.ast_transform_scopes.get(&expn_id))
.unwrap_or(&self.graph_root);
}
};
self.macro_def_scope_from_def_id(def_id)
}
Expand Down Expand Up @@ -739,7 +744,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
if ptr::eq(parent, self.r.graph_root) {
if let Some(entry) = self.r.extern_prelude.get(&ident.normalize_to_macros_2_0())
{
if expansion != ExpnId::root()
if expansion != LocalExpnId::ROOT
&& orig_name.is_some()
&& entry.extern_crate_item.is_none()
{
Expand Down Expand Up @@ -769,7 +774,13 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
no_implicit_prelude: parent.no_implicit_prelude || {
self.r.session.contains_name(&item.attrs, sym::no_implicit_prelude)
},
..ModuleData::new(Some(parent), module_kind, def_id, expansion, item.span)
..ModuleData::new(
Some(parent),
module_kind,
def_id,
expansion.to_expn_id(),
item.span,
)
});
self.r.define(parent, ident, TypeNS, (module, vis, sp, expansion));
self.r.module_map.insert(local_def_id, module);
Expand Down Expand Up @@ -808,7 +819,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
parent,
module_kind,
parent.nearest_parent_mod,
expansion,
expansion.to_expn_id(),
item.span,
);
self.r.define(parent, ident, TypeNS, (module, vis, sp, expansion));
Expand Down Expand Up @@ -883,7 +894,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
parent,
module_kind,
parent.nearest_parent_mod,
expansion,
expansion.to_expn_id(),
item.span,
);
self.r.define(parent, ident, TypeNS, (module, vis, sp, expansion));
Expand Down Expand Up @@ -926,7 +937,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
parent,
ModuleKind::Block(block.id),
parent.nearest_parent_mod,
expansion,
expansion.to_expn_id(),
block.span,
);
self.r.block_map.insert(block.id, module);
Expand All @@ -946,7 +957,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
parent,
ModuleKind::Def(kind, def_id, ident.name),
def_id,
expansion,
expansion.to_expn_id(),
span,
);
self.r.define(parent, ident, TypeNS, (module, vis, span, expansion));
Expand Down Expand Up @@ -1112,7 +1123,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
})
};

let allow_shadowing = self.parent_scope.expansion == ExpnId::root();
let allow_shadowing = self.parent_scope.expansion == LocalExpnId::ROOT;
if let Some(span) = import_all {
let import = macro_use_import(self, span);
self.r.potentially_unused_imports.push(import);
Expand Down Expand Up @@ -1175,7 +1186,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
false
}

fn visit_invoc(&mut self, id: NodeId) -> ExpnId {
fn visit_invoc(&mut self, id: NodeId) -> LocalExpnId {
let invoc_id = id.placeholder_to_expn_id();
let old_parent_scope = self.r.invocation_parent_scopes.insert(invoc_id, self.parent_scope);
assert!(old_parent_scope.is_none(), "invocation data is reset for an invocation");
Expand Down
Loading