-
Notifications
You must be signed in to change notification settings - Fork 13.8k
File not found for module error #39765
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
File not found for module error #39765
Conversation
src/libsyntax/diagnostic_list.rs
Outdated
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.
Typo: "ile not found for module"
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.
Oups, thanks!
src/libsyntax/diagnostic_list.rs
Outdated
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.
Shouldn't the other newly added errors be registered as well?
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.
Don't know how to trigger this one and not enough time to investigate. Someone will do it later on if I don't myself.
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 error occurs for mod foo;
when both foo.rs
and foo/mod.rs
exist. There's a test: cfail/mod_file_disambig.
ed430c8
to
57bc7de
Compare
src/libsyntax/diagnostic_list.rs
Outdated
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.
Feature flags will be needed in these examples, also the cfail tests for inclusive ranges.
@durka: I added the corresponding tests already. Take a look at the new files in |
Yeah but you are missing |
It's not needed as far as I can tell... ? At least when I test, I have no missing feature issue. |
Huh... I guess since this error is generated in the parser it occurs before
the unstable feature check. So it's okay I guess.
…On Mon, Feb 13, 2017 at 11:54 AM, Guillaume Gomez ***@***.***> wrote:
It's not needed as far as I can tell... ? At least when I test, I have no
missing feature issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#39765 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAC3n2GC6GEfxqv3beixvW_uCblHhPn5ks5rcIrIgaJpZM4L-f60>
.
|
I'm cool with this change, but you probably want to ping someone on the compiler team to double-check the logic. I haven't done much with the module system, yet. |
cc @rust-lang/compiler |
src/libsyntax/diagnostic_list.rs
Outdated
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.
Do we want to call mod foo;
a "module import"?
I've heard it called an "out-of-line module", but never heard "module import" except to refer to a use
import of a module.
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.
How would you reword it then?
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.
I would call it a "module item" or an "out-of-line module".
src/libsyntax/diagnostic_list.rs
Outdated
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.
nit: really exists. So
src/libsyntax/diagnostic_list.rs
Outdated
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.
or file_that_doesnt_exist/mod.rs
src/libsyntax/diagnostic_list.rs
Outdated
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.
nit: s/which/that/, s/comment/document/
src/libsyntax/diagnostic_list.rs
Outdated
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.
nit: s/used on/followed by/, s/like/including/
src/libsyntax/parse/parser.rs
Outdated
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.
nit: add a newline before the }),
src/libsyntax/parse/parser.rs
Outdated
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.
nit: block indenting is more idiomatic here.
src/libsyntax/parse/parser.rs
Outdated
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.
nit: we could use map_err
here instead of match
.
src/test/compile-fail/E0586.rs
Outdated
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.
nit: no trailing new newline
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.
Done.
src/libsyntax/parse/parser.rs
Outdated
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.
Do we need this variant? I think it would be simpler to just emit the error directly in the relevant parsing function.
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.
I try to centralize the errors. Making them easier to spot and modify.
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.
I think UselessDocComment
and InclusiveRangeWithNoEnd
would be more appropriate as methods on the Parser
, since they don't have anything to do with with the first two variants (except that they are errors during parsing).
Then, the enum could be named ModulePathError
-- clearer and more precise.
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.
The point isn't to group same kind of errors but to centralize them.
57bc7de
to
3235835
Compare
@jseyfried: Is it ok for you now? ;) |
src/libsyntax/diagnostic_list.rs
Outdated
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.
We're not "import"ing here -- I would say "define", "declare", or "use" instead.
Also I would say "a module named file_that_doesnt_exist
" instead of "a file_that_doesnt_exist
module".
src/libsyntax/diagnostic_list.rs
Outdated
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.
The user can have file_that_doesnt_exist.rs
or file_that_doesnt_exist/mod.rs
-- we need to mention both options here.
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.
Also, I would say "in the same directory" instead of "at the same level".
src/libsyntax/diagnostic_list.rs
Outdated
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.
need to be followed by items**,** including
(add "by" and ",")
src/libsyntax/diagnostic_list.rs
Outdated
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.
Just one "." here.
src/libsyntax/parse/parser.rs
Outdated
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.
If we're not getting rid of span_fatal_err
, shouldn't we use it here?
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.
Absolutely!
3235835
to
1e27c61
Compare
Updated. |
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.
r=me modulo comments
src/libsyntax/diagnostic_list.rs
Outdated
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.
nit: you need to have a file_that_doesnt_exist.rs
or file_that_doesnt_exist/mod.rs
file in the same directory.
or: you need to have a file named file_that_doesnt_exist.rs
or file_that_doesnt_exist/mod.rs
in the same directory.
src/libsyntax/parse/parser.rs
Outdated
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.
optional nit: Error
would be a more idiomatic name
1e27c61
to
a9f22d7
Compare
Ok, I fixed the two last nits. If you find anything else, don't hesitate to r-! @bors: r=jseyfried |
📌 Commit a9f22d7 has been approved by |
src/libsyntax/parse/parser.rs
Outdated
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.
Errors
-> Error
(won't pass travis)
src/libsyntax/parse/parser.rs
Outdated
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.
nit: indent (one extra space)
src/libsyntax/parse/parser.rs
Outdated
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.
Also here (Errors
-> Error
), etc.
src/libsyntax/parse/parser.rs
Outdated
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.
typo
@bors r- |
a9f22d7
to
88c81c5
Compare
@jseyfried: Outch, my string replacement failed badly... Updated. |
88c81c5
to
b6818be
Compare
Tests seem ok this time so let's r+ it. Thanks @jseyfried! @bors: r=jseyfried |
📌 Commit b6818be has been approved by |
⌛ Testing commit b6818be with merge ab89a78... |
💔 Test failed - status-appveyor |
@bors: retry
* network failure
…On Tue, Feb 21, 2017 at 2:53 PM, bors ***@***.***> wrote:
💔 Test failed - status-appveyor
<https://ci.appveyor.com/project/rust-lang/rust/build/1.0.2054>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#39765 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95OAISJpoL3yPH4ZYO08TutVSLEPlks5re06ugaJpZM4L-f60>
.
|
…, r=jseyfried File not found for module error Fixes #39542. r? @jonathandturner Maybe you want to take a look @pnkfelix?
☀️ Test successful - status-appveyor, status-travis |
Fixes #39542.
r? @jonathandturner
Maybe you want to take a look @pnkfelix?