Uh oh!
There was an error while loading. Please reload this page.
parser: simplify directory ownership semantics - #37602
Conversation
jseyfried
commented
Nov 5, 2016
cc @rust-lang/lang @matklad |
543ceb5 to
9828456Comparenikomatsakis
commented
Nov 8, 2016
Started a crater run. |
Results: https://gist.github.com/nikomatsakis/ad150e91da19d7a86d8501a11f2b0a0c
Root regressions to be investigated:
|
nikomatsakis
commented
Nov 8, 2016
@jseyfried so at least a few of those are real regr. We have to decide now: to warning period or what. cc @rust-lang/lang -- this PR makes some changes to rationalize various aspects of when a module "has a directory" and not (i.e., when you can do |
brson
commented
Nov 8, 2016
@nikomatsakis the openssl errors are rust-lang/cargo#3268 |
aturon
commented
Nov 8, 2016
@nikomatsakis This looks like a good case for applying the general guidelines. In general I'm 👍 going forward with these changes. How hard is a warning period to do in this case? If it's relatively easy, we should do it. |
brson
commented
Nov 8, 2016
I'd encourage you to make any breakage here a transitionary warning. We must continue to do our utmost to reduce breakage pain for users. Small breakage adds up. |
jseyfried
commented
Nov 8, 2016
It looks like all the breakage is due to |
nikomatsakis
commented
Nov 9, 2016
Definitely we should do a warning period. |
19030ba to
0b060acCompareI started a warning cycle in the above commit. Since it's not easy to lint from the parser, it is just an ordinary warning with a note about future compatibility. |
There was a problem hiding this comment.
Hmm. I think we could do an actual lint here -- can't we leave a little note on the AST or something and then issue the lint later, in the lint pass?
At minimum, though, can you open a "forward compat" issue with the appropriate labels and structure and mention it in this message? Roughly follow the protocol described in RFC 1589
There was a problem hiding this comment.
Sure, I'll make it a real lint.
nikomatsakis
commented
Nov 17, 2016
ping @jseyfried -- still planning to make it a real lint? |
0b060ac to
75eecc5Comparejseyfried
commented
Nov 19, 2016
@nikomatsakis just fininshed (got sidetracked by some higher-priority stuff) |
petrochenkov
commented
Nov 19, 2016
The lint is temporary, but still could you rename it to follow lint naming conventions? |
75eecc5 to
533068fComparejseyfried
commented
Nov 19, 2016
@petrochenkov yeah, renamed to |
bors
commented
Nov 21, 2016
☔ The latest upstream changes (presumably #37824) made this pull request unmergeable. Please resolve the merge conflicts. |
nikomatsakis
commented
Nov 22, 2016
@jseyfried r=me after rebase |
533068f to
fa8c53bComparejseyfried
commented
Nov 22, 2016
@bors r=nikomatsakis |
bors
commented
Nov 22, 2016
📌 Commit fa8c53b has been approved by |
bors
commented
Nov 22, 2016
parser: simplify directory ownership semantics This PR simplifies the semantics of "directory ownership". After this PR, - a non-inline module without a `#[path]` attribute (e.g. `mod foo;`) is allowed iff its parent module/block (whichever is nearer) is a directory owner, - an non-inline module is a directory owner iff its corresponding file is named `mod.rs` (c.f. [comment](#32401 (comment))), - a block is never a directory owner (c.f. #31534), and - an inline module is a directory owner iff either - its parent module/block is a directory owner (again, c.f. #31534), or - it has a `#[path]` attribute (c.f. #36789). These semantics differ from today's in three orthogonal ways: - `#[path = "foo.rs"] mod foo;` is no longer a directory owner. This is a [breaking-change]. - #36789 is generalized to apply to modules that are not directory owners in addition to blocks. - A macro-expanded non-inline module is only allowed where an ordinary non-inline module would be allowed. Today, we incorrectly allow macro-expanded non-inline modules in modules that are not directory owners (but not in blocks). This is a [breaking-change]. Fixes#32401. r? @nikomatsakis
bors
commented
Nov 22, 2016
briansmith
commented
Nov 29, 2016
Sorry, I don't understand what I need to do to change in ring here. I don't want to name all the modules' files mod.rs because it's ridiculous to have dozens of files with the same name in one project. Of course some of them have submodules. What's the alternative? |
eddyb
commented
Nov 29, 2016
@briansmith You can declare the module hierarchy recursively, even the entire crate's modules in |
This PR simplifies the semantics of "directory ownership". After this PR,
#[path]attribute (e.g.mod foo;) is allowed iff its parent module/block (whichever is nearer) is a directory owner,mod.rs(c.f. comment),#[path]attribute (c.f. Allow more non-inline modules in blocks #36789).These semantics differ from today's in three orthogonal ways:
#[path = "foo.rs"] mod foo;is no longer a directory owner. This is a [breaking-change].Fixes#32401.
r? @nikomatsakis