Skip to content

Commit dd78c95

Browse files
assert more often in release in ast_lowering
1 parent ff8b11e commit dd78c95

File tree

1 file changed

+13
-13
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+13
-13
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
503503
span: Span,
504504
) -> LocalDefId {
505505
let parent = self.current_hir_id_owner.def_id;
506-
debug_assert_ne!(node_id, ast::DUMMY_NODE_ID);
506+
assert_ne!(node_id, ast::DUMMY_NODE_ID);
507507
assert!(
508508
self.opt_local_def_id(node_id).is_none(),
509509
"adding a def'n for node-id {:?} and def kind {:?} but a previous def'n exists: {:?}",
@@ -586,10 +586,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
586586
}
587587

588588
let item = f(self);
589-
debug_assert_eq!(owner_id, item.def_id());
589+
assert_eq!(owner_id, item.def_id());
590590
// `f` should have consumed all the elements in these vectors when constructing `item`.
591-
debug_assert!(self.impl_trait_defs.is_empty());
592-
debug_assert!(self.impl_trait_bounds.is_empty());
591+
assert!(self.impl_trait_defs.is_empty());
592+
assert!(self.impl_trait_bounds.is_empty());
593593
let info = self.make_owner_info(item);
594594

595595
self.attrs = current_attrs;
@@ -891,7 +891,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
891891
} else {
892892
let lowered_attrs = self.lower_attrs_vec(attrs, self.lower_span(target_span));
893893

894-
debug_assert_eq!(id.owner, self.current_hir_id_owner);
894+
assert_eq!(id.owner, self.current_hir_id_owner);
895895
let ret = self.arena.alloc_from_iter(lowered_attrs);
896896

897897
// this is possible if an item contained syntactical attribute,
@@ -915,10 +915,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
915915
}
916916

917917
fn alias_attrs(&mut self, id: HirId, target_id: HirId) {
918-
debug_assert_eq!(id.owner, self.current_hir_id_owner);
919-
debug_assert_eq!(target_id.owner, self.current_hir_id_owner);
918+
assert_eq!(id.owner, self.current_hir_id_owner);
919+
assert_eq!(target_id.owner, self.current_hir_id_owner);
920920
if let Some(&a) = self.attrs.get(&target_id.local_id) {
921-
debug_assert!(!a.is_empty());
921+
assert!(!a.is_empty());
922922
self.attrs.insert(id.local_id, a);
923923
}
924924
}
@@ -1397,7 +1397,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13971397
let id = if let Some(LifetimeRes::ElidedAnchor { start, end }) =
13981398
self.resolver.get_lifetime_res(t.id)
13991399
{
1400-
debug_assert_eq!(start.plus(1), end);
1400+
assert_eq!(start.plus(1), end);
14011401
start
14021402
} else {
14031403
self.next_node_id()
@@ -1805,16 +1805,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18051805
let res = match res {
18061806
LifetimeRes::Param { param, .. } => hir::LifetimeKind::Param(param),
18071807
LifetimeRes::Fresh { param, .. } => {
1808-
debug_assert_eq!(ident.name, kw::UnderscoreLifetime);
1808+
assert_eq!(ident.name, kw::UnderscoreLifetime);
18091809
let param = self.local_def_id(param);
18101810
hir::LifetimeKind::Param(param)
18111811
}
18121812
LifetimeRes::Infer => {
1813-
debug_assert_eq!(ident.name, kw::UnderscoreLifetime);
1813+
assert_eq!(ident.name, kw::UnderscoreLifetime);
18141814
hir::LifetimeKind::Infer
18151815
}
18161816
LifetimeRes::Static { .. } => {
1817-
debug_assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime));
1817+
assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime));
18181818
hir::LifetimeKind::Static
18191819
}
18201820
LifetimeRes::Error => hir::LifetimeKind::Error,
@@ -2244,7 +2244,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22442244
) -> hir::Stmt<'hir> {
22452245
let hir_id = self.next_id();
22462246
if let Some(a) = attrs {
2247-
debug_assert!(!a.is_empty());
2247+
assert!(!a.is_empty());
22482248
self.attrs.insert(hir_id.local_id, a);
22492249
}
22502250
let local = hir::LetStmt {

0 commit comments

Comments
 (0)