You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[cfg()] runs before name resolution so no proc macro attribute named cfg could ever be called. We should make this a hard error at the declaration site to protect people from this confusion.
I have a PR in progress that resolves the penultimate item in #50911 (comment) and passes all attributes through name resolution, that includes cfg as well.
(Disallowing proc macros named cfg is both too much - #[foo::cfg] is ok, and not enough - use my_non_cfg_attr_macro as cfg;).
Activity
djrenren commentedon Aug 20, 2018
I think this would be a good issue for mentoring. I'm happy to help out.
Havvy commentedon Aug 20, 2018
The
testattribute seems to be similarly ignored.otavio commentedon Aug 20, 2018
I could give it a go. As a first time contributor please be patient 😉
djrenren commentedon Aug 20, 2018
@Havvy Yeah, though that's not by necessity, so I wanna do a crater run and see if we could give it normal resolution.
djrenren commentedon Aug 20, 2018
@otavio That's awesome! I'm happy to help in any way you need.
I recommend taking a look at
src/libsyntax_ext/proc_macro_registrar.rseddyb commentedon Aug 21, 2018
I'd check it during name resolution instead, so you can do
#[foo::cfg(...)]just fine, but not import it unqualified.cc @petrochenkov
petrochenkov commentedon Aug 21, 2018
I have a PR in progress that resolves the penultimate item in #50911 (comment) and passes all attributes through name resolution, that includes
cfgas well.(Disallowing proc macros named
cfgis both too much -#[foo::cfg]is ok, and not enough -use my_non_cfg_attr_macro as cfg;).djrenren commentedon Aug 21, 2018
@petrochenkov Ah yeah I hadn't thought about that! That's awesome.
Auto merge of #53913 - petrochenkov:biattr4, r=<try>
Auto merge of #53913 - petrochenkov:biattr4, r=alexcrichton