Skip to content

fix: vec! macro resolution via alloc::vec self-import - #1

Open
ravi-ciroos wants to merge 1 commit into
mainfrom
fix/vec-macro-scope
Open

fix: vec! macro resolution via alloc::vec self-import#1
ravi-ciroos wants to merge 1 commit into
mainfrom
fix/vec-macro-scope

Conversation

@ravi-ciroos

Copy link
Copy Markdown
Owner

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.

`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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant