Skip to content

Duplicate error E0584 in codebase #73116

Closed
@Tiv0w

Description

@Tiv0w

What I encountered

Hi, while learning Rust I got the following error:

error[E0584]: file for module `utils` found at both utils.rs and utils/mod.rs
--> src/main.rs:4:1
  |
4 | mod utils;
  | ^^^^^^^^^^
  |
  = help: delete or rename one of them to remove the ambiguity

I understand the issue quite well and know how to fix it, but I wanted to know whether I should use utils.rs or utils/mod.rs as best practice.


So I tried to rustc --explain E0584 for more information.

Unfortunately, the explanation was the wrong one:

Wrong explanation block

A doc comment that is not attached to anything has been encountered.

Erroneous code example:

``
trait Island {
    fn lost();

    /// I'm lost!
}
``

A little reminder: a doc comment has to be placed before the item it's supposed
to document. So if you want to document the `Island` trait, you need to put a
doc comment before it, not inside it. Same goes for the `lost` method: the doc
comment needs to be before it:

``
/// I'm THE island!
trait Island {
    /// I'm lost!
    fn lost();
}
``


The problem

I just used the GitHub search in repository and it seems like there are 2 errors E0584, so the "multiple file for module " error is shadowed in the explanation.


Meta

rustc --version:

rustc 1.44.0 (49cae5576 2020-06-01)

This issue has been assigned to @doctorn via this comment.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions