Current syntax of pattern types as used in the standard library

⚓ Rust    📅 2026-03-20    👤 surdeus    👁️ 1      

surdeus

I'm writing some code that walks through Rust code using rust-analyzer's APIs.

My code should be able to walk through the standard library just as well, but that contains a lot of unstable and not public things that I would not have to deal with in common Rust code.

Now I'm trying to wrap my head around the pattern_type!() macro, which I think I understand is a placeholder for the syntax of pattern types where whey will become stable.

I think I've understood the idea of pattern types in general, but then for example in the documentation for std::marker::Freeze trait, I find it is implemented for *const T is !null.

I thought pattern types accepted a pattern on the right. What's !null instead in this case?

3 posts - 2 participants

Read full topic

🏷️ Rust_feed