Skip to content

Commit 405f7de

Browse files
committed
Remove another duplicate def-creation
1 parent ff85c3e commit 405f7de

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ use rustc_ast::ptr::P as AstP;
1414
use rustc_ast::*;
1515
use rustc_data_structures::stack::ensure_sufficient_stack;
1616
use rustc_hir as hir;
17-
use rustc_hir::def::{DefKind, Res};
17+
use rustc_hir::def::Res;
1818
use rustc_hir::HirId;
1919
use rustc_middle::span_bug;
2020
use rustc_session::errors::report_lit_error;
2121
use rustc_span::source_map::{respan, Spanned};
22-
use rustc_span::symbol::{kw, sym, Ident, Symbol};
22+
use rustc_span::symbol::{sym, Ident, Symbol};
2323
use rustc_span::DUMMY_SP;
2424
use rustc_span::{DesugaringKind, Span};
2525
use thin_vec::{thin_vec, ThinVec};
@@ -377,18 +377,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
377377
let mut generic_args = ThinVec::new();
378378
for (idx, arg) in args.into_iter().enumerate() {
379379
if legacy_args_idx.contains(&idx) {
380-
let parent_def_id = self.current_hir_id_owner;
381380
let node_id = self.next_node_id();
382381

383-
// Add a definition for the in-band const def.
384-
self.create_def(
385-
parent_def_id.def_id,
386-
node_id,
387-
kw::Empty,
388-
DefKind::AnonConst,
389-
f.span,
390-
);
391-
392382
let anon_const = AnonConst { id: node_id, value: arg };
393383
generic_args.push(AngleBracketedArg::Arg(GenericArg::Const(anon_const)));
394384
} else {

compiler/rustc_ast_lowering/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2417,6 +2417,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24172417
}
24182418
}
24192419

2420+
#[instrument(level = "debug", skip(self))]
24202421
fn lower_anon_const(&mut self, c: &AnonConst) -> &'hir hir::AnonConst {
24212422
// Some ast::AnonConst's turn into ConstArgKind::Path's, so we create their def
24222423
// only when we're sure they're going to stay as an AnonConst.

0 commit comments

Comments
 (0)