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
This looks like an unintended side-effect of #50030 that allowed arbitrary paths in meta-items (including nested ones), but fn name() for meta-items still returns the last segment ignoring everything else.
cc @flip1995@topecongiro
Most of attributes, including cfg want nested meta-item paths to be single-segment.
So, looks like fn name should return Option<Name> and all its callers need to be taught to deal with None somehow - report an error, or pass it further, etc.
Activity
eddyb commentedon Aug 19, 2018
What happens if you also have
cfg(a), does that interact withcfg(something::a)?[-]--print=cfg ignores namespace[/-][+]cfg(...) ignores namespace[/+][-]cfg(...) ignores namespace[/-][+]#[cfg(...)] ignores namespace[/+]kennytm commentedon Aug 19, 2018
@eddyb Oh no,
cfg(something::a)is the same ascfg(a). Edited the issue.kennytm commentedon Aug 19, 2018
This behavior exists since 1.27. On 1.26 or before,
#[cfg(module::path)]is simply a syntax error.petrochenkov commentedon Aug 19, 2018
This looks like an unintended side-effect of #50030 that allowed arbitrary paths in meta-items (including nested ones), but
fn name()for meta-items still returns the last segment ignoring everything else.cc @flip1995 @topecongiro
Most of attributes, including
cfgwant nested meta-item paths to be single-segment.So, looks like
fn nameshould returnOption<Name>and all its callers need to be taught to deal withNonesomehow - report an error, or pass it further, etc.eddyb commentedon Aug 19, 2018
I'd suggest having a flag on "meta-item parsing" to say whether it should allow paths at all - most of the builtin attributes don't need paths.
petrochenkov commentedon Oct 15, 2018
The
cfgissue specifically was fixed in #53893.