Skip to content

meta not indicated as reserved crate name when shadowing module #73948

Closed
@yodaldevoid

Description

@yodaldevoid

Taken from this internals thread: https://internals.rust-lang.org/t/is-the-module-name-meta-forbidden/9587

A module named meta is shadowed leading to misleading error messages. meta was reserved as a built-in crate name in 2018 edition, but the error message does not indicate this.

I tried this code:

mod meta {
    pub struct Thing;
}

use meta::Thing;

fn main() {}

Above code compiled with rustc --edition 2018 {file}

This is expected to indicated that meta is a reserved crate name.

Instead, the following error is reported:

error[E0463]: can't find crate for `meta`
 --> testy.rs:5:5
  |
5 | use meta::Thing;
  |     ^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.

Meta

rustc --version --verbose:

rustc 1.44.1 (c7087fe00 2020-06-17)
binary: rustc
commit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7
commit-date: 2020-06-17
host: x86_64-unknown-linux-gnu
release: 1.44.1
LLVM version: 9.0

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

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions