Skip to content

Duplicate error E0584 in codebase #73116

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

Activity

cofibrant

cofibrant commented on Jun 8, 2020

@cofibrant
Contributor

@rustbot claim

self-assigned this
on Jun 8, 2020
added a commit that references this issue on Jun 9, 2020
95479d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @cofibrant@Tiv0w@rustbot

    Issue actions

      Duplicate error E0584 in codebase · Issue #73116 · rust-lang/rust