Skip to content

Commit f76bb9d

Browse files
committed
Remove an argument that was always the same
1 parent afa859f commit f76bb9d

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
492492
let mut generic_args = ThinVec::new();
493493
for (idx, arg) in args.iter().cloned().enumerate() {
494494
if legacy_args_idx.contains(&idx) {
495-
let parent_def_id = self.current_hir_id_owner.def_id;
496495
let node_id = self.next_node_id();
497-
self.create_def(parent_def_id, node_id, None, DefKind::AnonConst, f.span);
496+
self.create_def(node_id, None, DefKind::AnonConst, f.span);
498497
let mut visitor = WillCreateDefIdsVisitor {};
499498
let const_value = if let ControlFlow::Break(span) = visitor.visit_expr(&arg) {
500499
AstP(Expr {

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ enum GenericArgsMode {
494494
impl<'a, 'hir> LoweringContext<'a, 'hir> {
495495
fn create_def(
496496
&mut self,
497-
parent: LocalDefId,
498497
node_id: ast::NodeId,
499498
name: Option<Symbol>,
500499
def_kind: DefKind,
@@ -509,7 +508,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
509508
self.tcx.hir_def_key(self.local_def_id(node_id)),
510509
);
511510

512-
let def_id = self.tcx.at(span).create_def(parent, name, def_kind).def_id();
511+
let def_id =
512+
self.tcx.at(span).create_def(self.current_hir_id_owner.def_id, name, def_kind).def_id();
513513

514514
debug!("create_def: def_id_to_node_id[{:?}] <-> {:?}", def_id, node_id);
515515
self.resolver.node_id_to_def_id.insert(node_id, def_id);
@@ -781,7 +781,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
781781
LifetimeRes::Fresh { param, kind, .. } => {
782782
// Late resolution delegates to us the creation of the `LocalDefId`.
783783
let _def_id = self.create_def(
784-
self.current_hir_id_owner.def_id,
785784
param,
786785
Some(kw::UnderscoreLifetime),
787786
DefKind::LifetimeParam,
@@ -2084,15 +2083,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20842083
} else {
20852084
// Construct an AnonConst where the expr is the "ty"'s path.
20862085

2087-
let parent_def_id = self.current_hir_id_owner.def_id;
20882086
let node_id = self.next_node_id();
20892087
let span = self.lower_span(span);
20902088

20912089
// Add a definition for the in-band const def.
20922090
// We're lowering a const argument that was originally thought to be a type argument,
20932091
// so the def collector didn't create the def ahead of time. That's why we have to do
20942092
// it here.
2095-
let def_id = self.create_def(parent_def_id, node_id, None, DefKind::AnonConst, span);
2093+
let def_id = self.create_def(node_id, None, DefKind::AnonConst, span);
20962094
let hir_id = self.lower_node_id(node_id);
20972095

20982096
let path_expr = Expr {

compiler/rustc_ast_lowering/src/pat.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,14 +517,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
517517
span: Span,
518518
base_type: Span,
519519
) -> &'hir hir::ConstArg<'hir> {
520-
let parent_def_id = self.current_hir_id_owner.def_id;
521520
let node_id = self.next_node_id();
522521

523522
// Add a definition for the in-band const def.
524523
// We're generating a range end that didn't exist in the AST,
525524
// so the def collector didn't create the def ahead of time. That's why we have to do
526525
// it here.
527-
let def_id = self.create_def(parent_def_id, node_id, None, DefKind::AnonConst, span);
526+
let def_id = self.create_def(node_id, None, DefKind::AnonConst, span);
528527
let hir_id = self.lower_node_id(node_id);
529528

530529
let unstable_span = self.mark_span_with_reason(

0 commit comments

Comments
 (0)