Skip to content

Commit a790f9b

Browse files
Add constness field to hir::ItemKind::Impl
1 parent 01cbe50 commit a790f9b

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

src/librustc_ast_lowering/item.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
365365
unsafety,
366366
polarity,
367367
defaultness,
368-
constness: _, // TODO
368+
constness,
369369
generics: ref ast_generics,
370370
of_trait: ref trait_ref,
371371
self_ty: ref ty,
@@ -422,6 +422,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
422422
unsafety,
423423
polarity,
424424
defaultness: self.lower_defaultness(defaultness, true /* [1] */),
425+
constness,
425426
generics,
426427
of_trait: trait_ref,
427428
self_ty: lowered_ty,

src/librustc_hir/hir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,7 @@ pub enum ItemKind<'hir> {
24402440
unsafety: Unsafety,
24412441
polarity: ImplPolarity,
24422442
defaultness: Defaultness,
2443+
constness: Constness,
24432444
generics: Generics<'hir>,
24442445

24452446
/// The trait being implemented, if any.

src/librustc_hir/intravisit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
570570
unsafety: _,
571571
defaultness: _,
572572
polarity: _,
573+
constness: _,
573574
ref generics,
574575
ref of_trait,
575576
ref self_ty,

src/librustc_hir/print.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ impl<'a> State<'a> {
631631
unsafety,
632632
polarity,
633633
defaultness,
634+
constness,
634635
ref generics,
635636
ref of_trait,
636637
ref self_ty,
@@ -647,6 +648,10 @@ impl<'a> State<'a> {
647648
self.s.space();
648649
}
649650

651+
if constness == ast::Constness::Const {
652+
self.word_nbsp("const");
653+
}
654+
650655
if let hir::ImplPolarity::Negative = polarity {
651656
self.s.word("!");
652657
}

src/librustdoc/doctree.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ pub struct Impl<'hir> {
203203
pub unsafety: hir::Unsafety,
204204
pub polarity: hir::ImplPolarity,
205205
pub defaultness: hir::Defaultness,
206+
pub constness: ast::Constness,
206207
pub generics: &'hir hir::Generics<'hir>,
207208
pub trait_: &'hir Option<hir::TraitRef<'hir>>,
208209
pub for_: &'hir hir::Ty<'hir>,

src/librustdoc/visit_ast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
562562
unsafety,
563563
polarity,
564564
defaultness,
565+
constness,
565566
ref generics,
566567
ref of_trait,
567568
self_ty,
@@ -576,6 +577,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
576577
unsafety,
577578
polarity,
578579
defaultness,
580+
constness,
579581
generics,
580582
trait_: of_trait,
581583
for_: self_ty,

0 commit comments

Comments
 (0)