]> git.lizzy.rs Git - rust.git/commit
resolve: Fix access to extern and stdlib prelude from opaque macros
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 6 Jul 2019 16:45:23 +0000 (19:45 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 10 Jul 2019 21:12:08 +0000 (00:12 +0300)
commit0ec6ea7333a8918a96f40110e014f2bbbd72281f
treef74a3a467a2314be5d1d10237289a4f19d3612d2
parentf92394209455bf14594f279249c2e592809180cd
resolve: Fix access to extern and stdlib prelude from opaque macros

Ok, it's hard to explain what happens, but identifier's hygienic contexts need to be "adjusted" to modules/scopes before they are resolved in them.
To be resolved in all kinds on preludes the identifier needs to be adjusted to the root expansion (aka "no expansion").

Previously this was done for the `macro m() { ::my_crate::foo }` case, but forgotten for all other cases.
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/test/ui/hygiene/auxiliary/stdlib-prelude.rs [new file with mode: 0644]
src/test/ui/hygiene/stdlib-prelude-from-opaque-early.rs [new file with mode: 0644]
src/test/ui/hygiene/stdlib-prelude-from-opaque-late.rs [new file with mode: 0644]