Skip to content

Commit c840c30

Browse files
committed
hir: add hir_id to hir::GenericParam
1 parent a6bde67 commit c840c30

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/librustc/hir/lowering.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -736,15 +736,16 @@ impl<'a> LoweringContext<'a> {
736736
// Add a definition for the in-band lifetime def.
737737
self.resolver.definitions().create_def_with_parent(
738738
parent_id.index,
739-
def_node_id,
739+
node_id,
740740
DefPathData::LifetimeParam(str_name),
741741
DefIndexAddressSpace::High,
742742
Mark::root(),
743743
span,
744744
);
745745

746746
hir::GenericParam {
747-
id: def_node_id,
747+
id: node_id,
748+
hir_id,
748749
name: hir_name,
749750
attrs: hir_vec![],
750751
bounds: hir_vec![],
@@ -1233,7 +1234,7 @@ impl<'a> LoweringContext<'a> {
12331234
)
12341235
}
12351236
ImplTraitContext::Universal(in_band_ty_params) => {
1236-
self.lower_node_id(def_node_id);
1237+
let LoweredNodeId { hir_id, .. } = self.lower_node_id(def_node_id);
12371238
// Add a definition for the in-band `Param`.
12381239
let def_index = self
12391240
.resolver
@@ -1249,6 +1250,7 @@ impl<'a> LoweringContext<'a> {
12491250
let ident = Ident::from_str(&pprust::ty_to_string(t)).with_span_pos(span);
12501251
in_band_ty_params.push(hir::GenericParam {
12511252
id: def_node_id,
1253+
hir_id,
12521254
name: ParamName::Plain(ident),
12531255
pure_wrt_drop: false,
12541256
attrs: hir_vec![],
@@ -1514,6 +1516,7 @@ impl<'a> LoweringContext<'a> {
15141516

15151517
self.output_lifetime_params.push(hir::GenericParam {
15161518
id: def_node_id,
1519+
hir_id,
15171520
name,
15181521
span: lifetime.span,
15191522
pure_wrt_drop: false,
@@ -2404,6 +2407,7 @@ impl<'a> LoweringContext<'a> {
24042407
};
24052408
let param = hir::GenericParam {
24062409
id: lt.id,
2410+
hir_id: lt.hir_id,
24072411
name: param_name,
24082412
span: lt.span,
24092413
pure_wrt_drop: attr::contains_name(&param.attrs, "may_dangle"),
@@ -2436,8 +2440,11 @@ impl<'a> LoweringContext<'a> {
24362440
.collect();
24372441
}
24382442

2443+
let LoweredNodeId { node_id, hir_id } = self.lower_node_id(param.id);
2444+
24392445
hir::GenericParam {
2440-
id: self.lower_node_id(param.id).node_id,
2446+
id: node_id,
2447+
hir_id,
24412448
name: hir::ParamName::Plain(ident),
24422449
pure_wrt_drop: attr::contains_name(&param.attrs, "may_dangle"),
24432450
attrs: self.lower_attrs(&param.attrs),

src/librustc/hir/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ pub enum GenericParamKind {
539539
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
540540
pub struct GenericParam {
541541
pub id: NodeId,
542+
pub hir_id: HirId,
542543
pub name: ParamName,
543544
pub attrs: HirVec<Attribute>,
544545
pub bounds: GenericBounds,

src/librustc/ich/impls_hir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ impl_stable_hash_for!(enum hir::TraitBoundModifier {
201201

202202
impl_stable_hash_for!(struct hir::GenericParam {
203203
id,
204+
hir_id,
204205
name,
205206
pure_wrt_drop,
206207
attrs,

0 commit comments

Comments
 (0)