Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMany feature gates are not checked in macros #18102
Comments
brson
added
I-wrong
I-nominated
labels
Oct 16, 2014
This comment has been minimized.
This comment has been minimized.
|
Notably, this compiles today when it shouldn't: fn main() {
let a = ('a', 1u);
println!("{}", a.0);
} |
This comment has been minimized.
This comment has been minimized.
|
P-backcompat-lang, 1.0 |
pnkfelix
added
P-backcompat-lang
and removed
I-nominated
labels
Oct 16, 2014
pnkfelix
added this to the 1.0 milestone
Oct 16, 2014
This comment has been minimized.
This comment has been minimized.
|
Note that we may be able to use a technique similar to that for the stability lint: #17286 |
This comment has been minimized.
This comment has been minimized.
|
This is a duplicate of #12122 |
This comment has been minimized.
This comment has been minimized.
|
While somewhat similar I don't think that this is a dupe of #12122. The definition of a macro should be subject to the feature gates in the defining crate, but the usage of a macro should be subject to the feature gates in the consumer crate. #12122 indicates that we don't check macro definitions, and this indicates that we don't check macro invocations. |
nrc
referenced this issue
Oct 20, 2014
Closed
are feature gates for tuple indexing and slicing properly enforced? #18180
This comment has been minimized.
This comment has been minimized.
|
I think the best we can do right now is check after the expansion of macros, in the stable channel. Outside of the stable channel, this might cause some undesirable noise when the used features are supposed to be "internal implementation details" of a lib, but I think that sort of claim is baloney because the feature could disappear at any moment. It ought to require work on the macro user's part if it could stop working at any moment due to a compiler upgrade. |
brson commentedOct 16, 2014
Feature gates are generally checked before expansion so feature gates are defeated by code inside macros.