Auto merge of #142267 - workingjubilee:debug-assert-less-in-ast-lower… · rust-lang/rust@a729c24 (original) (raw)

`@@ -503,7 +503,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

`

503

503

`span: Span,

`

504

504

`) -> LocalDefId {

`

505

505

`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);

`

507

507

`assert!(

`

508

508

`self.opt_local_def_id(node_id).is_none(),

`

509

509

`"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> {

`

586

586

`}

`

587

587

``

588

588

`let item = f(self);

`

589

``

`-

debug_assert_eq!(owner_id, item.def_id());

`

``

589

`+

assert_eq!(owner_id, item.def_id());

`

590

590

`` // 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());

`

593

593

`let info = self.make_owner_info(item);

`

594

594

``

595

595

`self.attrs = current_attrs;

`

`@@ -891,7 +891,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

`

891

891

`} else {

`

892

892

`let lowered_attrs = self.lower_attrs_vec(attrs, self.lower_span(target_span));

`

893

893

``

894

``

`-

debug_assert_eq!(id.owner, self.current_hir_id_owner);

`

``

894

`+

assert_eq!(id.owner, self.current_hir_id_owner);

`

895

895

`let ret = self.arena.alloc_from_iter(lowered_attrs);

`

896

896

``

897

897

`// this is possible if an item contained syntactical attribute,

`

`@@ -915,10 +915,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

`

915

915

`}

`

916

916

``

917

917

`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);

`

920

920

`if let Some(&a) = self.attrs.get(&target_id.local_id) {

`

921

``

`-

debug_assert!(!a.is_empty());

`

``

921

`+

assert!(!a.is_empty());

`

922

922

`self.attrs.insert(id.local_id, a);

`

923

923

`}

`

924

924

`}

`

`@@ -1397,7 +1397,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

`

1397

1397

`let id = if let Some(LifetimeRes::ElidedAnchor { start, end }) =

`

1398

1398

`self.resolver.get_lifetime_res(t.id)

`

1399

1399

`{

`

1400

``

`-

debug_assert_eq!(start.plus(1), end);

`

``

1400

`+

assert_eq!(start.plus(1), end);

`

1401

1401

` start

`

1402

1402

`} else {

`

1403

1403

`self.next_node_id()

`

`@@ -1805,16 +1805,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

`

1805

1805

`let res = match res {

`

1806

1806

`LifetimeRes::Param { param, .. } => hir::LifetimeKind::Param(param),

`

1807

1807

`LifetimeRes::Fresh { param, .. } => {

`

1808

``

`-

debug_assert_eq!(ident.name, kw::UnderscoreLifetime);

`

``

1808

`+

assert_eq!(ident.name, kw::UnderscoreLifetime);

`

1809

1809

`let param = self.local_def_id(param);

`

1810

1810

` hir::LifetimeKind::Param(param)

`

1811

1811

`}

`

1812

1812

`LifetimeRes::Infer => {

`

1813

``

`-

debug_assert_eq!(ident.name, kw::UnderscoreLifetime);

`

``

1813

`+

assert_eq!(ident.name, kw::UnderscoreLifetime);

`

1814

1814

` hir::LifetimeKind::Infer

`

1815

1815

`}

`

1816

1816

`LifetimeRes::Static { .. } => {

`

1817

``

`-

debug_assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime));

`

``

1817

`+

assert!(matches!(ident.name, kw::StaticLifetime | kw::UnderscoreLifetime));

`

1818

1818

` hir::LifetimeKind::Static

`

1819

1819

`}

`

1820

1820

`LifetimeRes::Error => hir::LifetimeKind::Error,

`

`@@ -2244,7 +2244,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {

`

2244

2244

`) -> hir::Stmt<'hir> {

`

2245

2245

`let hir_id = self.next_id();

`

2246

2246

`if let Some(a) = attrs {

`

2247

``

`-

debug_assert!(!a.is_empty());

`

``

2247

`+

assert!(!a.is_empty());

`

2248

2248

`self.attrs.insert(hir_id.local_id, a);

`

2249

2249

`}

`

2250

2250

`let local = hir::LetStmt {

`