Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core::error::Error has incorrect stabilization version #130765

Closed
balt-dev opened this issue Sep 23, 2024 · 3 comments · Fixed by #130798
Closed

core::error::Error has incorrect stabilization version #130765

balt-dev opened this issue Sep 23, 2024 · 3 comments · Fixed by #130798
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@balt-dev
Copy link

Location

https://doc.rust-lang.org/nightly/core/error/trait.Error.html

Summary

Within this page, the stabilization version of Error is set as 1.0.0, when Error in core has only just recently been stabilized.

@balt-dev balt-dev added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Sep 23, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 23, 2024
@jieyouxu jieyouxu added T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 24, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Sep 24, 2024

This might be a bit tricky because you can't just change the feature gate on core::error::Error:

AFAICT std::error::Error is an re-export of core::error::Error, which is stability-gated by

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::error::Error;

But the core::error::Error trait itself is currently also gated by

#[stable(feature = "rust1", since = "1.0.0")]
pub trait Error: Debug + Display { ... }

If I change the stability attribute on core::error::Error to be gated via error_in_core, it unfortunately propagates that to the re-export std::error::Error which means that while core::error::Error docs will appear as 1.81.0, std docs for std::error::Error will then show up as stabilised in 1.81.0 which is not quite correct either.

Stabilization of error_in_core actually changes the core::error the module to be stable thereby making core::error::Error stable-as-publicly-reachable, not core::error::Error which is already stable-in-itself just not stable-as-publicly-reachable.

Haven't looked into this too closely, it could be a couple of things in rustc stability attribute handling -> rustdoc rendering together that leads to this behavior.

@a1phyr
Copy link
Contributor

a1phyr commented Sep 24, 2024

Note that core::error has the right version: https://doc.rust-lang.org/nightly/core/error/index.html

@lukas-code
Copy link
Member

lukas-code commented Sep 24, 2024

I've put up a PR to change the displayed stability/version number in rustdoc: #130798

@bors bors closed this as completed in 9737f92 Sep 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 25, 2024
Rollup merge of rust-lang#130798 - lukas-code:doc-stab, r=notriddle

rustdoc: inherit parent's stability where applicable

It is currently not possible for a re-export to have a different stability (rust-lang#30827). Therefore the standard library uses a hack when moving items like `std::error::Error` or `std::net::IpAddr` into `core` by marking the containing module (`core::error` / `core::net`) as unstable or stable in a later version than the items the module contains.

Previously, rustdoc would always show the *stability as declared* for an item rather than the *stability as publicly reachable* (i.e. the features required to actually access the item), which could be confusing when viewing the docs. This PR changes it so that we show the stability of the first unstable parent or the most recently stabilized parent instead, to hopefully make things less confusing.

fixes rust-lang#130765

screenshots:
![error in std](https://github.com/user-attachments/assets/2ab9bdb9-ed81-4e45-a832-ac7d3ba1be3f) ![error in core](https://github.com/user-attachments/assets/46f46182-5642-4ac5-b92e-0b99a8e2496d)
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Sep 25, 2024
rustdoc: inherit parent's stability where applicable

It is currently not possible for a re-export to have a different stability (rust-lang/rust#30827). Therefore the standard library uses a hack when moving items like `std::error::Error` or `std::net::IpAddr` into `core` by marking the containing module (`core::error` / `core::net`) as unstable or stable in a later version than the items the module contains.

Previously, rustdoc would always show the *stability as declared* for an item rather than the *stability as publicly reachable* (i.e. the features required to actually access the item), which could be confusing when viewing the docs. This PR changes it so that we show the stability of the first unstable parent or the most recently stabilized parent instead, to hopefully make things less confusing.

fixes rust-lang/rust#130765

screenshots:
![error in std](https://github.com/user-attachments/assets/2ab9bdb9-ed81-4e45-a832-ac7d3ba1be3f) ![error in core](https://github.com/user-attachments/assets/46f46182-5642-4ac5-b92e-0b99a8e2496d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants