Skip to content
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

Wrong suggestion in module declaration error message #38110

Closed
fabric-and-ink opened this issue Dec 1, 2016 · 3 comments
Closed

Wrong suggestion in module declaration error message #38110

fabric-and-ink opened this issue Dec 1, 2016 · 3 comments
Assignees

Comments

@fabric-and-ink
Copy link
Contributor

fabric-and-ink commented Dec 1, 2016

Maybe this bug is related to #36146.

Library structure

src/lib.rs
src/foo/mod.rs
src/foo/bar.rs

src/lib.rs:
pub mod foo;

src/foo/mod.rs:
pub mod bar;

src/foo/bar.rs
pub mod baz;

Error

Currently:

error: cannot declare a new module at this location
 --> foo\bar.rs:1:9
  |
1 | pub mod baz;
  |         ^^^
  |
note: maybe move this module `foo` to its own directory via `foo/mod.rs`
 --> foo\bar.rs:1:9
  |
1 | pub mod baz;
  |         ^^^

Should be:

  error: cannot declare a new module at this location
   --> foo\bar.rs:1:9
    |
  1 | pub mod baz;
    |         ^^^
    |
- note: maybe move this module `foo` to its own directory via `foo/mod.rs`
+ note: maybe move this module `bar` to its own directory via `bar/mod.rs`
   --> foo\bar.rs:1:9
    |
  1 | pub mod baz;
    |         ^^^

Additionally, I don't understand what to make of the repeated code excerpt.

@fabric-and-ink fabric-and-ink changed the title Wrong suggestion in module declaration error Wrong suggestion in module declaration error message Dec 1, 2016
@jseyfried jseyfried self-assigned this Dec 6, 2016
@GuillaumeGomez
Copy link
Member

@jseyfried: Still working on it?

@jseyfried
Copy link
Contributor

@GuillaumeGomez no, haven't started yet.

@GuillaumeGomez
Copy link
Member

I opened a PR for it.

arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 25, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 26, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 26, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 26, 2017
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 26, 2017
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

No branches or pull requests

3 participants