Description
As a user I'm really excited for std::assert_matches!
, but I'm a little worried about the level of breakage it introduces and I'm hoping to discuss possible paths forward.
The Fuchsia roll to update rustc is currently blocked by ambiguous macro resolution errors with code that glob-imports matches::assert_matches!
. It seems that a locally defined glob import does not take precedence over macros defined in std.
This implies a workaround of changing all the glob imports to use matches::assert_matches
, but this does not account for submodules which use super::*;
. Unfortunately it seems that the test_case crate wraps the function body in a submodule and adds a use super::*
to the new module.
What this means in practice is that every function using the test_case crate must have an explicit import added or have the macro referenced via a fully qualified name. AIUI this change counts as an acceptable breakage and so I'm still putting together a diff which will resolve all of our roll blockers.
What I'm wondering though is whether knowing about this source of breakage offers a path to a smoother release. If so, we could revert the change and prepare to roll it out more gently.
Two options that came up in private discussions:
- remove assert_matches from the prelude until the 2021 edition
- this wouldn't make it immediately available but it would prevent the breakage
- make local glob imports take precedence over std/prelude macros
- this would make it immediately available but may not be possible within language constraints
Any other suggestions for how to make this change less disruptive? cc @m-ou-se @tmandry @joshtriplett