Skip to content

Conversation

GuillaumeGomez
Copy link
Member

Fixes #39542.

r? @jonathandturner

Maybe you want to take a look @pnkfelix?

Copy link
Contributor

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"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups, thanks!

Copy link

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?

Copy link
Member Author

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.

Copy link
Contributor

@durka durka Feb 21, 2017

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.

@GuillaumeGomez GuillaumeGomez force-pushed the file-not-found-for-module-error branch from ed430c8 to 57bc7de Compare February 12, 2017 17:34
Copy link
Contributor

@durka durka Feb 13, 2017

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.

@GuillaumeGomez
Copy link
Member Author

@durka: I added the corresponding tests already. Take a look at the new files in compile-fail directory.

@durka
Copy link
Contributor

durka commented Feb 13, 2017

Yeah but you are missing #![feature(inclusive_range_syntax)].

@GuillaumeGomez
Copy link
Member Author

It's not needed as far as I can tell... ? At least when I test, I have no missing feature issue.

@durka
Copy link
Contributor

durka commented Feb 13, 2017 via email

@sophiajt
Copy link
Contributor

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.

@GuillaumeGomez
Copy link
Member Author

cc @rust-lang/compiler

Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: really exists. So

Copy link
Contributor

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

Copy link
Contributor

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/

Copy link
Contributor

@jseyfried jseyfried Feb 16, 2017

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/

Copy link
Contributor

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 }),

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

@GuillaumeGomez GuillaumeGomez force-pushed the file-not-found-for-module-error branch from 57bc7de to 3235835 Compare February 17, 2017 20:45
@GuillaumeGomez
Copy link
Member Author

@jseyfried: Is it ok for you now? ;)

Copy link
Contributor

@jseyfried jseyfried Feb 19, 2017

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".

Copy link
Contributor

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.

Copy link
Contributor

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".

Copy link
Contributor

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 ",")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one "." here.

Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely!

@GuillaumeGomez GuillaumeGomez force-pushed the file-not-found-for-module-error branch from 3235835 to 1e27c61 Compare February 20, 2017 17:35
@GuillaumeGomez
Copy link
Member Author

Updated.

Copy link
Contributor

@jseyfried jseyfried left a 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

Copy link
Contributor

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.

Copy link
Contributor

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

@GuillaumeGomez GuillaumeGomez force-pushed the file-not-found-for-module-error branch from 1e27c61 to a9f22d7 Compare February 20, 2017 22:28
@GuillaumeGomez
Copy link
Member Author

Ok, I fixed the two last nits. If you find anything else, don't hesitate to r-!

@bors: r=jseyfried

@bors
Copy link
Collaborator

bors commented Feb 20, 2017

📌 Commit a9f22d7 has been approved by jseyfried

Copy link
Contributor

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)

Copy link
Contributor

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)

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@jseyfried
Copy link
Contributor

@bors r-
I usually wait for Travis to pass before directing bors.

@GuillaumeGomez GuillaumeGomez force-pushed the file-not-found-for-module-error branch from a9f22d7 to 88c81c5 Compare February 21, 2017 10:22
@GuillaumeGomez
Copy link
Member Author

@jseyfried: Outch, my string replacement failed badly... Updated.

@GuillaumeGomez GuillaumeGomez force-pushed the file-not-found-for-module-error branch from 88c81c5 to b6818be Compare February 21, 2017 14:52
@GuillaumeGomez
Copy link
Member Author

Tests seem ok this time so let's r+ it. Thanks @jseyfried!

@bors: r=jseyfried

@bors
Copy link
Collaborator

bors commented Feb 21, 2017

📌 Commit b6818be has been approved by jseyfried

@bors
Copy link
Collaborator

bors commented Feb 21, 2017

⌛ Testing commit b6818be with merge ab89a78...

@bors
Copy link
Collaborator

bors commented Feb 21, 2017

💔 Test failed - status-appveyor

@alexcrichton
Copy link
Member

alexcrichton commented Feb 21, 2017 via email

@bors
Copy link
Collaborator

bors commented Feb 21, 2017

⌛ Testing commit b6818be with merge 0f34b53...

bors added a commit that referenced this pull request Feb 21, 2017
…, r=jseyfried

File not found for module error

Fixes #39542.

r? @jonathandturner

Maybe you want to take a look @pnkfelix?
@bors
Copy link
Collaborator

bors commented Feb 21, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: jseyfried
Pushing 0f34b53 to master...

@bors bors merged commit b6818be into rust-lang:master Feb 21, 2017
@GuillaumeGomez GuillaumeGomez deleted the file-not-found-for-module-error branch February 22, 2017 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants