Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 55d9fe3

Browse files
committedMar 15, 2025
hygiene: Downgrade is_decode_placeholder asserts to debug asserts
1 parent b62bbea commit 55d9fe3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎compiler/rustc_span/src/hygiene.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -448,28 +448,28 @@ impl HygieneData {
448448
}
449449

450450
fn normalize_to_macros_2_0(&self, ctxt: SyntaxContext) -> SyntaxContext {
451-
assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
451+
debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
452452
self.syntax_context_data[ctxt.0 as usize].opaque
453453
}
454454

455455
fn normalize_to_macro_rules(&self, ctxt: SyntaxContext) -> SyntaxContext {
456-
assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
456+
debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
457457
self.syntax_context_data[ctxt.0 as usize].opaque_and_semitransparent
458458
}
459459

460460
fn outer_expn(&self, ctxt: SyntaxContext) -> ExpnId {
461-
assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
461+
debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
462462
self.syntax_context_data[ctxt.0 as usize].outer_expn
463463
}
464464

465465
fn outer_mark(&self, ctxt: SyntaxContext) -> (ExpnId, Transparency) {
466-
assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
466+
debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
467467
let data = &self.syntax_context_data[ctxt.0 as usize];
468468
(data.outer_expn, data.outer_transparency)
469469
}
470470

471471
fn parent_ctxt(&self, ctxt: SyntaxContext) -> SyntaxContext {
472-
assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
472+
debug_assert!(!self.syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
473473
self.syntax_context_data[ctxt.0 as usize].parent
474474
}
475475

@@ -579,7 +579,7 @@ impl HygieneData {
579579
transparency: Transparency,
580580
) -> SyntaxContext {
581581
let syntax_context_data = &mut self.syntax_context_data;
582-
assert!(!syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
582+
debug_assert!(!syntax_context_data[ctxt.0 as usize].is_decode_placeholder());
583583
let mut opaque = syntax_context_data[ctxt.0 as usize].opaque;
584584
let mut opaque_and_semitransparent =
585585
syntax_context_data[ctxt.0 as usize].opaque_and_semitransparent;
@@ -926,7 +926,7 @@ impl SyntaxContext {
926926

927927
pub(crate) fn dollar_crate_name(self) -> Symbol {
928928
HygieneData::with(|data| {
929-
assert!(!data.syntax_context_data[self.0 as usize].is_decode_placeholder());
929+
debug_assert!(!data.syntax_context_data[self.0 as usize].is_decode_placeholder());
930930
data.syntax_context_data[self.0 as usize].dollar_crate_name
931931
})
932932
}

0 commit comments

Comments
 (0)
Failed to load comments.