Skip to content

E0711 emitted even when staged_api is not enabled #106589

Closed
@Ezrashaw

Description

@Ezrashaw

I tried this code:

// #![feature(staged_api)] // note: `staged_api` not enabled

#![stable(feature = "foo", since = "1.0.0")]

// error: feature `foo` is declared unstable
#[unstable(feature = "foo", issue = "none")]
fn foo_unstable() {}

I expected to see this happen:

error[E0734]: stability attributes may not be used outside of the standard library
 --> src/lib.rs:6:1
  |
6 | #[unstable(feature = "foo", issue = "none")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0734]: stability attributes may not be used outside of the standard library
 --> src/lib.rs:3:1
  |
3 | #![stable(feature = "foo", since = "1.0.0")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Two errors emitted about the use of stability attributes outside the standard library (without staged_api).

Instead, this happened:

error[E0734]: stability attributes may not be used outside of the standard library
 --> src/lib.rs:6:1
  |
6 | #[unstable(feature = "foo", issue = "none")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0734]: stability attributes may not be used outside of the standard library
 --> src/lib.rs:3:1
  |
3 | #![stable(feature = "foo", since = "1.0.0")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

+error[E0711]: feature `foo` is declared unstable, but was previously declared stable
+ --> src/lib.rs:6:1
+  |
+6 | #[unstable(feature = "foo", issue = "none")]
+  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

An extra error relating to stability semantics which should not be emitted because stability attributes are not allowed here. Some permutations of this error exist: is staged_api enabled? are we on stable? etc.

Meta

Occurs on latest stable and nightly.

@rustbot claim

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