fix: vec! macro resolution via alloc::vec self-import - #1
Open
ravi-ciroos wants to merge 1 commit into
Open
Conversation
`use alloc::vec::{self, Vec};` relies on the `self` import also
bringing the `vec!` macro into scope alongside the `vec` module.
On some rustc versions this only resolves the module (type
namespace), so unqualified `vec![...]` calls in this file fail
with "cannot find macro `vec` in this scope".
Import `Drain` by name instead of the `vec` module, and fully
qualify the two `vec!` invocations (`alloc::vec!` / `$crate::alloc::vec!`)
so macro resolution no longer depends on the `self`-import quirk.
Signed-off-by: Ravi Chamarthy <ravi@ciroos.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
use alloc::vec::{self, Vec};relies on theselfimport also bringing thevec!macro into scope alongside thevecmodule. On some rustc versions this only resolves the module (type namespace), so unqualifiedvec![...]calls in this file fail with "cannot find macrovecin this scope".Import
Drainby name instead of thevecmodule, and fully qualify the twovec!invocations (alloc::vec!/$crate::alloc::vec!) so macro resolution no longer depends on theself-import quirk.