Rollup merge of #137977 - nnethercote:less-kw-Empty-1, r=spastorino
Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? ```@spastorino```
This commit is contained in:
commit
0defc4f27f
19 changed files with 125 additions and 83 deletions
|
@ -13,7 +13,7 @@ use rustc_middle::span_bug;
|
|||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::errors::report_lit_error;
|
||||
use rustc_span::source_map::{Spanned, respan};
|
||||
use rustc_span::{DUMMY_SP, DesugaringKind, Ident, Span, Symbol, kw, sym};
|
||||
use rustc_span::{DUMMY_SP, DesugaringKind, Ident, Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
use visit::{Visitor, walk_expr};
|
||||
|
||||
|
@ -484,7 +484,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
if legacy_args_idx.contains(&idx) {
|
||||
let parent_def_id = self.current_hir_id_owner.def_id;
|
||||
let node_id = self.next_node_id();
|
||||
self.create_def(parent_def_id, node_id, kw::Empty, DefKind::AnonConst, f.span);
|
||||
self.create_def(parent_def_id, node_id, None, DefKind::AnonConst, f.span);
|
||||
let mut visitor = WillCreateDefIdsVisitor {};
|
||||
let const_value = if let ControlFlow::Break(span) = visitor.visit_expr(&arg) {
|
||||
AstP(Expr {
|
||||
|
|
|
@ -494,7 +494,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
&mut self,
|
||||
parent: LocalDefId,
|
||||
node_id: ast::NodeId,
|
||||
name: Symbol,
|
||||
name: Option<Symbol>,
|
||||
def_kind: DefKind,
|
||||
span: Span,
|
||||
) -> LocalDefId {
|
||||
|
@ -774,7 +774,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
let _def_id = self.create_def(
|
||||
self.current_hir_id_owner.def_id,
|
||||
param,
|
||||
kw::UnderscoreLifetime,
|
||||
Some(kw::UnderscoreLifetime),
|
||||
DefKind::LifetimeParam,
|
||||
ident.span,
|
||||
);
|
||||
|
@ -2089,8 +2089,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
// We're lowering a const argument that was originally thought to be a type argument,
|
||||
// so the def collector didn't create the def ahead of time. That's why we have to do
|
||||
// it here.
|
||||
let def_id =
|
||||
self.create_def(parent_def_id, node_id, kw::Empty, DefKind::AnonConst, span);
|
||||
let def_id = self.create_def(parent_def_id, node_id, None, DefKind::AnonConst, span);
|
||||
let hir_id = self.lower_node_id(node_id);
|
||||
|
||||
let path_expr = Expr {
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_hir::def::{DefKind, Res};
|
|||
use rustc_hir::{self as hir, LangItem};
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_span::source_map::{Spanned, respan};
|
||||
use rustc_span::{DesugaringKind, Ident, Span, kw};
|
||||
use rustc_span::{DesugaringKind, Ident, Span};
|
||||
|
||||
use super::errors::{
|
||||
ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding,
|
||||
|
@ -523,7 +523,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
// We're generating a range end that didn't exist in the AST,
|
||||
// so the def collector didn't create the def ahead of time. That's why we have to do
|
||||
// it here.
|
||||
let def_id = self.create_def(parent_def_id, node_id, kw::Empty, DefKind::AnonConst, span);
|
||||
let def_id = self.create_def(parent_def_id, node_id, None, DefKind::AnonConst, span);
|
||||
let hir_id = self.lower_node_id(node_id);
|
||||
|
||||
let unstable_span = self.mark_span_with_reason(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue