Skip to content

Commit c62171a

Browse files
assert more often in release in ast_lowering::index
1 parent dd78c95 commit c62171a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ pub(super) fn index_hir<'hir>(
7373
impl<'a, 'hir> NodeCollector<'a, 'hir> {
7474
#[instrument(level = "debug", skip(self))]
7575
fn insert(&mut self, span: Span, hir_id: HirId, node: Node<'hir>) {
76-
debug_assert_eq!(self.owner, hir_id.owner);
77-
debug_assert_ne!(hir_id.local_id.as_u32(), 0);
78-
debug_assert_ne!(hir_id.local_id, self.parent_node);
76+
assert_eq!(self.owner, hir_id.owner);
77+
assert_ne!(hir_id.local_id.as_u32(), 0);
78+
assert_ne!(hir_id.local_id, self.parent_node);
7979

8080
// Make sure that the DepNode of some node coincides with the HirId
8181
// owner of that node.
@@ -110,7 +110,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
110110
}
111111

112112
fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_node_id: HirId, f: F) {
113-
debug_assert_eq!(parent_node_id.owner, self.owner);
113+
assert_eq!(parent_node_id.owner, self.owner);
114114
let parent_node = self.parent_node;
115115
self.parent_node = parent_node_id.local_id;
116116
f(self);
@@ -147,7 +147,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
147147
}
148148

149149
fn visit_nested_body(&mut self, id: BodyId) {
150-
debug_assert_eq!(id.hir_id.owner, self.owner);
150+
assert_eq!(id.hir_id.owner, self.owner);
151151
let body = self.bodies[&id.hir_id.local_id];
152152
self.visit_body(body);
153153
}
@@ -162,7 +162,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
162162

163163
#[instrument(level = "debug", skip(self))]
164164
fn visit_item(&mut self, i: &'hir Item<'hir>) {
165-
debug_assert_eq!(i.owner_id, self.owner);
165+
assert_eq!(i.owner_id, self.owner);
166166
self.with_parent(i.hir_id(), |this| {
167167
if let ItemKind::Struct(_, _, struct_def) = &i.kind {
168168
// If this is a tuple or unit-like struct, register the constructor.
@@ -176,7 +176,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
176176

177177
#[instrument(level = "debug", skip(self))]
178178
fn visit_foreign_item(&mut self, fi: &'hir ForeignItem<'hir>) {
179-
debug_assert_eq!(fi.owner_id, self.owner);
179+
assert_eq!(fi.owner_id, self.owner);
180180
self.with_parent(fi.hir_id(), |this| {
181181
intravisit::walk_foreign_item(this, fi);
182182
});
@@ -195,15 +195,15 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
195195

196196
#[instrument(level = "debug", skip(self))]
197197
fn visit_trait_item(&mut self, ti: &'hir TraitItem<'hir>) {
198-
debug_assert_eq!(ti.owner_id, self.owner);
198+
assert_eq!(ti.owner_id, self.owner);
199199
self.with_parent(ti.hir_id(), |this| {
200200
intravisit::walk_trait_item(this, ti);
201201
});
202202
}
203203

204204
#[instrument(level = "debug", skip(self))]
205205
fn visit_impl_item(&mut self, ii: &'hir ImplItem<'hir>) {
206-
debug_assert_eq!(ii.owner_id, self.owner);
206+
assert_eq!(ii.owner_id, self.owner);
207207
self.with_parent(ii.hir_id(), |this| {
208208
intravisit::walk_impl_item(this, ii);
209209
});

0 commit comments

Comments
 (0)