Skip to content

"error: module has missing stability attribute" is insufficiently explained #103668

Closed as not planned
@jruderman

Description

@jruderman

Given the following code (playground):

#![feature(slice_from_ptr_range)]
#![feature(slice_ptr_get)]
#![feature(staged_api)]
#![feature(stmt_expr_attributes)]
#![feature(strict_provenance)]

fn foo() {}
fn bar() {}

The current output points to the entire file and doesn't tell me what I did wrong:

error: module has missing stability attribute
 --> src/lib.rs:1:1
  |
1 | / #![feature(slice_from_ptr_range)]
2 | | #![feature(slice_ptr_get)]
3 | | #![feature(staged_api)]
4 | | #![feature(stmt_expr_attributes)]
... |
7 | | fn foo() {}
8 | | fn bar() {}
  | |___________^

If I understand the feature correctly, the output should be:

error: expected at least one pub item in this module to be marked as stable or unstable
note: expected because of `#![feature(staged_api)]` on line 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-stabilityArea: `#[stable]`, `#[unstable]` etc.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.F-staged_api`#![feature(staged_api)]`P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-internal-featuresThis issue requires the use of internal features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions