Rollup merge of #138924 - nnethercote:less-kw-Empty-3, r=compiler-errors
Reduce `kw::Empty` usage, part 3 Remove some more `kw::Empty` uses, in support of #137978. r? `@davidtwco`
This commit is contained in:
@@ -131,7 +131,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
let expn_id = self.cstore().expn_that_defined_untracked(def_id, self.tcx.sess);
|
||||
return Some(self.new_module(
|
||||
parent,
|
||||
ModuleKind::Def(def_kind, def_id, self.tcx.item_name(def_id)),
|
||||
ModuleKind::Def(def_kind, def_id, Some(self.tcx.item_name(def_id))),
|
||||
expn_id,
|
||||
self.def_span(def_id),
|
||||
// FIXME: Account for `#[no_implicit_prelude]` attributes.
|
||||
@@ -594,7 +594,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
// HACK(eddyb) unclear how good this is, but keeping `$crate`
|
||||
// in `source` breaks `tests/ui/imports/import-crate-var.rs`,
|
||||
// while the current crate doesn't have a valid `crate_name`.
|
||||
if crate_name != kw::Empty {
|
||||
if let Some(crate_name) = crate_name {
|
||||
// `crate_name` should not be interpreted as relative.
|
||||
module_path.push(Segment::from_ident_and_id(
|
||||
Ident { name: kw::PathRoot, span: source.ident.span },
|
||||
@@ -603,7 +603,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
source.ident.name = crate_name;
|
||||
}
|
||||
if rename.is_none() {
|
||||
ident.name = crate_name;
|
||||
ident.name = sym::dummy;
|
||||
}
|
||||
|
||||
self.r.dcx().emit_err(errors::CrateImported { span: item.span });
|
||||
@@ -775,7 +775,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
ItemKind::Mod(.., ref mod_kind) => {
|
||||
let module = self.r.new_module(
|
||||
Some(parent),
|
||||
ModuleKind::Def(def_kind, def_id, ident.name),
|
||||
ModuleKind::Def(def_kind, def_id, Some(ident.name)),
|
||||
expansion.to_expn_id(),
|
||||
item.span,
|
||||
parent.no_implicit_prelude
|
||||
@@ -811,7 +811,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
ItemKind::Enum(_, _) | ItemKind::Trait(..) => {
|
||||
let module = self.r.new_module(
|
||||
Some(parent),
|
||||
ModuleKind::Def(def_kind, def_id, ident.name),
|
||||
ModuleKind::Def(def_kind, def_id, Some(ident.name)),
|
||||
expansion.to_expn_id(),
|
||||
item.span,
|
||||
parent.no_implicit_prelude,
|
||||
|
||||
Reference in New Issue
Block a user