

























I'm gratified to see the new Range types finished (see https://lwn.net/Articles/1068418/ about Rust's RFC 3550 where I described why this was done)
As befits a language which has been stable for more than a decade, people have a lot of faith that it's worth putting in a lot of work now to deliver a better future, the Range types are in that category but surprisingly the new assert_matches! is also the same -- because it's an important new macro BUT it doesn't want to get in your face if you don't want it, for example because you wrote your own macro with the same name but different behaviour.
Historically Rust's stdlib macros are "too magic" and so all the macros in the standard library are just available to everybody, nothing else does that, if I make a new stdlib type, or trait, or function, or constant, none of those magically exists in everybody's code without them requesting it (implicitly with a prelude, or explicitly) but a macro does or rather did.
So the work to land assert_matches! ended up including all the significant effort to fix this, paper over any cracks as a result and check all that works in the real world, rather than just shrug and say well it's a macro and historically all macros were visible so I guess it's fine... This is how you build a future you can proud of, rather than one where everything needs a long list of caveats.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。