Use absolute paths in procedural macros#23784
Use absolute paths in procedural macros#23784alice-i-cecile merged 6 commits intobevyengine:mainfrom
Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
I like the notion of this in general, but can you explain why the FQ types are better than the core types here? Shouldn't core always be available?
I'm following the precedent set by |
| Ok(quote! { | ||
| impl #impl_generics #bevy_asset_path::VisitAssetDependencies for #struct_name #type_generics #where_clause { | ||
| fn visit_dependencies(&self, #visit: &mut impl FnMut(#bevy_asset_path::UntypedAssetId)) { | ||
| fn visit_dependencies(&self, #visit: &mut impl ::core::ops::FnMut(#bevy_asset_path::UntypedAssetId)) { |
There was a problem hiding this comment.
Would it make sense to introduce an FQFnMut here, similar to other FQ types used elsewhere?
There was a problem hiding this comment.
I'm not sure what the policy should be for adding new FQ types; adding every type in core/std would be excessive, so just the ones we use? I added FQIterator and FQInto because they appeared a few times (Iterator 6 times, Into 9 times). I could add FQFnMut, since FnMut appears 3 times, but I would also need to add FQFn (appears once) and FQFnOnce (doesn't appear) for parity.
I'd like to keep changes to the fq_std module small in this PR, as the focus is fixing hygiene issues. I think the module could be improved (FQBox in particular) in a later PR focused on code quality.
Objective
Solution
Testing
cargo run -p ci -- compileNotes
Vecas::std::vec::Vecin theAsBindGroupderive becausebevy_renderrequiresstd. Ifbevy_rendersupportsno_stdin the future, this will need to be changed to use the__macro_exportsstrategy used bybevy_ecsandbevy_reflect. Perhapsbevy_macro_utilsitself could exportno_stdcompatible paths foralloctypes likeVecandBoxto avoid repeating the same strategy in every crate which generatesalloctypes in macros.::core::primitive::boolvsbool) since evenserdedoesn't, but I can do so in this PR if desired.