-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edition hygiene in lints #52038
Comments
Bumping this to the release candidate milestone for 2018 |
@nikomatsakis and I talked about this and didn't reach a whole lot of conclusions and/or solutions. Some of this issue is just about edition hygiene in general, but other parts of it are about lints themselves. Some problematic test cases we could think of are: // 2015 crate
macro_rules! foo {
() => (fn async() {})
}
// 2018 crate
foo!(); // what happens? or // 2015 crate
macro_rules! foo {
($x:ident) => (fn $x() {})
}
// 2018 crate
foo!(async); // what happens? or // 2015
macro_rules! foo {
() => {
fn bar() {
use ::x::y; // can this resolve to `crate::x::y` when invoked in a 2018 crate?
}
}
} it's not entirely clear what the compiler should be doing here unfortunately! @nikomatsakis that while #50999 is one strategy there's one other primary strategy (which I didn't quite follow well enough to write down here). The quick notes on the two strategies were "pick a best spot" or "pick another spot", presumably for figuring out which edition is relevant in macro-expanded code. What we did conclude, however, was that this issue doesn't actually seem very pressing. Basically none of the prominent macros in the ecosystem will run into this issue and we've received no known reports about this issue. In that sense our thinking currently is punt on this until it comes up. When it comes up there's likely a fix we can apply backwards-compatibly, and additionally if this comes up in the wild it will help us to select amongst the various strategies for resolving this issue. As a result I'm going to remove this from all milestones. |
Triage: By now this seems very unlikely to ever be implemented. The effort to implement this is big, but the benefit is small. Let's close as won't fix rather than keep this open forever. |
Edition lints should be hygienic, that is, if a macro is declared in a 2018 crate and used in a 2015 crate, then the expanded macro should not trigger any lints.
There is a PR, #50999, but there are questions about the details of hygiene (see also #50122 and #50376).
The next step is probably to define and write-up the high-level approach.
cc @nikomatsakis @petrochenkov
The text was updated successfully, but these errors were encountered: