-
Notifications
You must be signed in to change notification settings - Fork 13k
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
remove pointless allowed_through_unstable_modules on TryFromSliceError #135489
Conversation
…able_modules to more items
The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. |
The point of adding this atrribute was to make the "since" version on the rustdoc page show up correctly: https://doc.rust-lang.org/nightly/core/array/struct.TryFromSliceError.html
Usually, we want to show the stability of the "most unstable" path component in rustdoc, this is important for example for But by that logic
This seems plausible to me, and there are probably very few crates that still use MSRV 1.34.0 and name this type dicectly, so I'm fine with removing this again. |
It is news to me that rustdoc actually uses the attribute when computing the information shown there, but maybe it does? Cc @notriddle I am not sure if there is some other way to get rustdoc to show the correct information here, but whatever we do should be rustdoc-only and not affect how rustc behaves on current stable releases. But it's probably not worth worrying about this tiny mistake only affecting a single version released five years ago...
TBH I find that page confusing since it is not at all clear that the "Since 1.81.0" refers to the path rather than the item. |
I don't think the https://github.com/rust-lang/rust/blob/master/src/librustdoc/passes/propagate_stability.rs If the item was inlined, it'll pick the version number from the import, but
Assuming we want the number there to refer to the item, where should the stability of the path be specified? We don't want someone to copy a path into their code, with a "stable since 1.0" badge on it, only to actually try it in the 1.73 compiler and get rug-pulled when it turns out not to actually be stable. That's pretty bad for people's confidence in the docs. The clearest, most explicit option of flat-out adding another attribute, like this?
It's unambiguous, but it's also not great for progressive disclosure, because that's a pretty complex concept that most people don't need to care about. |
Odd. Then why does https://doc.rust-lang.org/nightly/core/array/struct.TryFromSliceError.html show 1.34? It seems to ignore the stability of the path components... but clearly those are not ignored, as demonstrated by
Good question. Maybe it should say explicitly that the item is stable since X, but only available under this particular path since Y. I don't know how to best make that concise though. For the common case where both of these are the same version, we can keep the current display of course, so hopefully the "progressive disclosure" concern is remedied by this fact? The "path stability" flag could also have some hover / long-press text explaining what this is about. Anyway that's a separate discussion from this PR. |
You're right. It affects the version number in this case. rust/src/librustdoc/passes/propagate_stability.rs Lines 121 to 128 in 341f603
Items inherit stability from their parent module if they don't have this attribute and if their stability version is lower than the parent module's. That includes the version number. My mistake. I was too focused on inlining through |
r? libs |
@bors r+ rollup |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#133605 (Add extensive set of drop order tests) - rust-lang#135489 (remove pointless allowed_through_unstable_modules on TryFromSliceError) - rust-lang#135757 (Add NuttX support for AArch64 and ARMv7-A targets) - rust-lang#135799 (rustdoc-json: Rename `Path::name` to `path`, and give it the path again.) - rust-lang#135865 (For E0223, suggest associated functions that are similar to the path, even if the base type has multiple inherent impl blocks.) - rust-lang#135890 (Implement `VecDeque::pop_front_if` & `VecDeque::pop_back_if`) - rust-lang#135914 (Remove usages of `QueryNormalizer` in the compiler) - rust-lang#135936 (fix reify-intrinsic test) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#135489 - RalfJung:TryFromSliceError, r=tgross35 remove pointless allowed_through_unstable_modules on TryFromSliceError This got added in rust-lang#132482 but the PR does not explain why. `@lukas-code` do you still remember? Also Cc `@Noratrieb` as reviewer of that PR. If I understand the issue description correctly, all paths under which this type is exported are stable now: `core::array::TryFromSliceError` and `std::array::TryFromSliceError`. If that is the case, we shouldn't have the attribute; it's a terrible hack that should only be used when needed to maintain backward compatibility. Getting some historic information right is IMO *not* sufficient justification to risk accidentally exposing this type via more unstable paths today or in the future.
This got added in #132482 but the PR does not explain why. @lukas-code do you still remember? Also Cc @Noratrieb as reviewer of that PR.
If I understand the issue description correctly, all paths under which this type is exported are stable now:
core::array::TryFromSliceError
andstd::array::TryFromSliceError
. If that is the case, we shouldn't have the attribute; it's a terrible hack that should only be used when needed to maintain backward compatibility. Getting some historic information right is IMO not sufficient justification to risk accidentally exposing this type via more unstable paths today or in the future.