-
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
Implement non-mod.rs mod statements #46531
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
There's a special |
You can also add the ui directory to the places where tidy searches for feature gate tests. Look into |
You can use |
That said, what @est31 said sounds better. =) |
src/libsyntax/parse/mod.rs
Outdated
Owned, | ||
Owned { | ||
// None if `mod.rs`, `Some(path)` if we're in | ||
// `foo.rs` and there's a corresponding `foo/...` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment makes it sound like we check for the existence of such a directory, but we don't right? Maybe "Some("foo")
if we're in the top-level of foo.rs
"?
btw this PR motivated me to move over some of the currently existing feature gate tests: #46532 |
src/libsyntax/feature_gate.rs
Outdated
for &span in &*self.context.parse_sess.non_modrs_mods.borrow() { | ||
gate_feature_post!( | ||
&self, non_modrs_mods, span, | ||
"mod declarations in non-mod.rs files are experimental"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we want to add some extra notes here, given that this is a common source of confusion? Something like:
on stable builds, rename
foo.rs
tofoo/mod.rs
to enable submodules
not sure how hard that would be to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good to me -- I'd like to see a ui
test for what happens when there is a mod foo
with no matching file (what kind of error do we give)
I've added one, but currently it just suggests to try creating the file, and once the file is created it will give you the stability error. |
| | ||
11 | pub mod baz; | ||
| ^^^ | ||
= help: name the file either bar/baz.rs or bar/baz/mod.rs inside the directory "$DIR/auxiliary/foo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@bors r+ |
📌 Commit 5a821e3 has been approved by |
⌛ Testing commit 5a821e3a7738ee9d04ac1fd8c91956309f425f7d with merge c41ec675c6e876c7f032cb9179af6750638f65be... |
💔 Test failed - status-appveyor |
Looks like the |
@cramertj The quotes shouldn't matter. However, if the original output is |
@kennytm Hm... it seems like the slashes are going the right direction, though. It's in MSYS. The diff is this part:
It looks like the replacement just isn't happening. |
@cramertj just to clarify, the original needs to be backslashes. |
⌛ Testing commit af87dd4131b44e5c0f94aacb3270d08794c9ed2f with merge 2b9c672a1d2cc46ceb916b6b3d164f754eb5a3b0... |
💔 Test failed - status-travis |
Failed pretty-printing tests:
|
@cramertj do you know what might be causing that? (I don't know, not without looking into it) |
No, but I'll investigate this afternoon. |
☔ The latest upstream changes (presumably #46613) made this pull request unmergeable. Please resolve the merge conflicts. |
After some discussion on IRC -- our hypothesis is that the pretty typeck runner is putting files in the wrong place. Most likely outcome is that we will skip pretty printing for this test, but @cramertj is going to confirm the hypothesis. |
Rebased and ignored pretty-printing, as this is issue #37195. |
af87dd4
to
1d5977b
Compare
@bors r+ |
📌 Commit 1d5977b has been approved by |
Implement non-mod.rs mod statements Fixes #45385, cc #44660 This will fail tidy right now because it doesn't recognize my UI tests as feature-gate tests. However, I'm not sure if compile-fail will work out either because compile-fail usually requires there to be error patterns in the top-level file, which isn't possible with this feature. What's the recommended way to handle this?
☀️ Test successful - status-appveyor, status-travis |
Fixes #45385, cc #44660
This will fail tidy right now because it doesn't recognize my UI tests as feature-gate tests. However, I'm not sure if compile-fail will work out either because compile-fail usually requires there to be error patterns in the top-level file, which isn't possible with this feature. What's the recommended way to handle this?