Skip to content

Commit d5c0728

Browse files
committed
Remove had_parse_errors from hir::Mod
1 parent aa9899b commit d5c0728

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

compiler/rustc_ast_lowering/src/item.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
9090
fn lower_crate(&mut self, c: &Crate) {
9191
debug_assert_eq!(self.resolver.node_id_to_def_id[&CRATE_NODE_ID], CRATE_DEF_ID);
9292
self.with_lctx(CRATE_NODE_ID, |lctx| {
93-
let module = lctx.lower_mod(&c.items, &c.spans, Ok(()));
93+
let module = lctx.lower_mod(&c.items, &c.spans);
9494
lctx.lower_attrs(hir::CRATE_HIR_ID, &c.attrs);
9595
hir::OwnerNode::Crate(module)
9696
})
@@ -118,15 +118,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
118118
&mut self,
119119
items: &[P<Item>],
120120
spans: &ModSpans,
121-
had_parse_errors: Result<(), ErrorGuaranteed>,
122121
) -> &'hir hir::Mod<'hir> {
123122
self.arena.alloc(hir::Mod {
124123
spans: hir::ModSpans {
125124
inner_span: self.lower_span(spans.inner_span),
126125
inject_use_span: self.lower_span(spans.inject_use_span),
127126
},
128127
item_ids: self.arena.alloc_from_iter(items.iter().flat_map(|x| self.lower_item_ref(x))),
129-
had_parse_errors,
130128
})
131129
}
132130

@@ -237,8 +235,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
237235
})
238236
}
239237
ItemKind::Mod(_, mod_kind) => match mod_kind {
240-
ModKind::Loaded(items, _, spans, had_parse_errors) => {
241-
hir::ItemKind::Mod(self.lower_mod(items, spans, *had_parse_errors))
238+
ModKind::Loaded(items, _, spans, _) => {
239+
hir::ItemKind::Mod(self.lower_mod(items, spans))
242240
}
243241
ModKind::Unloaded => panic!("`mod` items should have been loaded by now"),
244242
},

compiler/rustc_hir/src/hir.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3075,7 +3075,6 @@ pub enum ClosureBinder {
30753075
pub struct Mod<'hir> {
30763076
pub spans: ModSpans,
30773077
pub item_ids: &'hir [ItemId],
3078-
pub had_parse_errors: Result<(), ErrorGuaranteed>,
30793078
}
30803079

30813080
#[derive(Copy, Clone, Debug, HashStable_Generic)]

tests/ui/stats/input-stats.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ hir-stats Name Accumulated Size Count Item Size
120120
hir-stats ----------------------------------------------------------------
121121
hir-stats ForeignItemRef 24 ( 0.3%) 1 24
122122
hir-stats Lifetime 24 ( 0.3%) 1 24
123+
hir-stats Mod 32 ( 0.4%) 1 32
123124
hir-stats ExprField 40 ( 0.4%) 1 40
124-
hir-stats Mod 40 ( 0.4%) 1 40
125125
hir-stats TraitItemRef 56 ( 0.6%) 2 28
126126
hir-stats GenericArg 64 ( 0.7%) 4 16
127127
hir-stats - Type 16 ( 0.2%) 1
@@ -163,7 +163,7 @@ hir-stats - Struct 64 ( 0.7%) 1
163163
hir-stats - InlineAsm 64 ( 0.7%) 1
164164
hir-stats - Lit 128 ( 1.4%) 2
165165
hir-stats - Block 384 ( 4.3%) 6
166-
hir-stats Item 968 (10.8%) 11 88
166+
hir-stats Item 968 (10.9%) 11 88
167167
hir-stats - Enum 88 ( 1.0%) 1
168168
hir-stats - Trait 88 ( 1.0%) 1
169169
hir-stats - Impl 88 ( 1.0%) 1
@@ -174,5 +174,5 @@ hir-stats - Use 352 ( 3.9%) 4
174174
hir-stats Path 1_240 (13.9%) 31 40
175175
hir-stats PathSegment 1_920 (21.5%) 40 48
176176
hir-stats ----------------------------------------------------------------
177-
hir-stats Total 8_928 180
177+
hir-stats Total 8_920 180
178178
hir-stats

0 commit comments

Comments
 (0)