Skip to content

Commit f21182f

Browse files
committed
Add new v0 demangling tags for pattern types
1 parent 8e15996 commit f21182f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#![no_std]
2727
#![deny(missing_docs)]
2828
#![cfg_attr(docsrs, feature(doc_cfg))]
29+
#![expect(elided_lifetimes_in_paths)]
30+
#![expect(explicit_outlives_requirements)]
31+
#![expect(unreachable_pub)]
2932

3033
#[cfg(any(test, feature = "std"))]
3134
#[macro_use]

src/v0.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,11 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {
10181018
b'B' => {
10191019
self.print_backref(Self::print_type)?;
10201020
}
1021+
b'W' => {
1022+
self.print_type()?;
1023+
self.print(" is ")?;
1024+
self.print_pat()?;
1025+
}
10211026
_ => {
10221027
// Go back to the tag, so `print_path` also sees it.
10231028
let _ = self.parser.as_mut().map(|p| p.next -= 1);
@@ -1079,6 +1084,27 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {
10791084
Ok(())
10801085
}
10811086

1087+
fn print_pat(&mut self) -> fmt::Result {
1088+
let tag = parse!(self, next);
1089+
1090+
match tag {
1091+
b'R' => {
1092+
self.print_const(false)?;
1093+
self.print("..=")?;
1094+
self.print_const(false)?;
1095+
}
1096+
b'O' => {
1097+
parse!(self, push_depth);
1098+
self.print_pat()?;
1099+
self.pop_depth();
1100+
}
1101+
b'N' => self.print("!null")?,
1102+
_ => invalid!(self),
1103+
}
1104+
1105+
Ok(())
1106+
}
1107+
10821108
fn print_const(&mut self, in_value: bool) -> fmt::Result {
10831109
let tag = parse!(self, next);
10841110

0 commit comments

Comments
 (0)