Skip to content

Bad error message for "relative paths are not supported in visibilities" error #95638

Closed
@asquared31415

Description

@asquared31415

Given the following code:

mod a {
  pub(in a) fn foo() {}
}

fn main() {}

When compiled using Edition 2018 or 2021

error: relative paths are not supported in visibilities on 2018 edition
 --> src/main.rs:2:10
  |
2 |   pub(in a) fn foo() {}
  |          ^ help: try: `crate::a`

error: aborting due to previous error

This error message is misleading and should likely be changed to "only supported in 2015 edition" or "not supported in 2018 edition or later"

error: relative paths are not supported in visibilities in 2018 edition or later
 --> src/main.rs:2:10
  |
2 |   pub(in a) fn foo() {}
  |          ^ help: try: `crate::a`

error: aborting due to previous error

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-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