fix: use fully-qualified module paths in exported macros - #131
fix: use fully-qualified module paths in exported macros#131Adam Cooper (super-cooper) wants to merge 1 commit into
Conversation
Corrects symbols that will be in-lined by macros such that they use their fully-qualified module paths instead of just their name. As an example: `FuncPtr` becomes `$crate::interface::injector::FuncPtr`. This is expected in Rust macros, as consuming crates will not compile unless the in-lined type is `use`d, even though it's not directly referenced. This creates confusing compilation errors for consuming crates, and clutter at the top of any modules that fix these errors. This patch also includes tests to insure all possible invocations of exported macros will compile without any `use` statements.
|
Adam Cooper (@super-cooper) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
@microsoft-github-policy-service agree |
|
Thanks for providing the change. Looks like the change will cause some regressions if user already put |
|
Jingyu Ma (@mazong1123) thanks for the review! I had missed that in my local testing since it only shows up as a warning. I think it should be safe to just remove that wildcard import from the test. For users who have that in their test code, it should show up as a warning for them as well and would be safe to remove. It would break their lint as well if they have warnings set to "deny," but I personally wouldn't consider this a regression. If it's ok with you, I will make the change. |
Is there a way to fix those warnings? Wondering if there's a way to make it better before moving to this direction. Thanks! |
|
I don't think so... It's kind of the nature of the change. For what it's worth, the warnings are only emitted for modules that |
Corrects symbols that will be in-lined by macros such that they use their fully-qualified module paths instead of just their name.
As an example:
FuncPtrbecomes$crate::interface::injector::FuncPtr.This is expected in Rust macros, as consuming crates will not compile unless the in-lined type is
used, even though it's not directly referenced. This creates confusing compilation errors for consuming crates, and clutter at the top of any modules that fix these errors.This patch also includes tests to insure all possible invocations of exported macros will compile without any
usestatements.