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

Track stability of path components #15702

Closed
brson opened this issue Jul 16, 2014 · 26 comments
Closed

Track stability of path components #15702

brson opened this issue Jul 16, 2014 · 26 comments
Labels
A-maybe-future-edition Something we may consider for a future edition. A-stability Area: issues related to #[stable] and #[unstable] attributes themselves. C-bug Category: This is a bug. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@brson
Copy link
Contributor

brson commented Jul 16, 2014

The current stability check only checks a few uses: functions and methods. There is much more needed for the coverage to be complete. In particular, every path contains multiple components which should all be checked. Simply checking paths would improve the accuracy of the analysis greatly.

This requires modifying resolve to record the def_id's of path components, not just the entire path.

cc @aturon

@brson brson added the A-libs label Jul 16, 2014
@aturon
Copy link
Member

aturon commented Jul 16, 2014

cc #8962

@aturon
Copy link
Member

aturon commented Jul 16, 2014

cc #8967 as well.

We will also need to think carefully about the user experience for the lint for mostly-stable libraries. We may want opt-out at the crate level, or a way of coalescing warnings.

@lifthrasiir
Copy link
Contributor

Nominating for 1.0. This is an important feature that possibly affects several libraries over the course of stabilization after 1.0 (I've already hit this twice with rust-encoding, see above). Also note that this doesn't have a simple workaround with an exception of function.

@pnkfelix
Copy link
Member

P-high, not 1.0.

(This is highly desired, but it is not going to block a release.)

@pnkfelix pnkfelix added P-medium Medium priority and removed I-nominated labels Nov 20, 2014
@brson
Copy link
Contributor Author

brson commented Jan 6, 2015

Renominating because the ability to correctly detect the stability level of user code has a high impact on the guarantees we can provide.

@pnkfelix
Copy link
Member

pnkfelix commented Jan 8, 2015

Assigning 1.0 milestone (it is considered polish, rather than a deep backwards compat issue).

@pnkfelix pnkfelix added this to the 1.0 milestone Jan 8, 2015
@aturon
Copy link
Member

aturon commented Feb 12, 2015

@alexcrichton did your patch address this? For some reason it seemed it would be harder, but I don't really know.

@alexcrichton
Copy link
Member

Unfortunately no, my patch didn't address this. For any path we still only track the stability of the last component.

@pnkfelix
Copy link
Member

pnkfelix commented Apr 2, 2015

We need to investigate how much of the stdlib is potentially affected by this to decide what to do next (and how to do it).

@steveklabnik steveklabnik removed this from the 1.0 milestone May 21, 2015
@alexcrichton
Copy link
Member

Unfortunately not having this bug fixed means that paths like std::intrinsics::copy are now stable. The intrinsics module is unstable but the function is stable because it's reexported in std::ptr.

If we fix this we probably need to have at least a cycle of warnings before turning on the infrastructure.

@brson brson added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. P-low Low priority labels Jul 14, 2016
@alexcrichton
Copy link
Member

cc @jseyfried, @petrochenkov, do either of you know if recent work has made this easy to knock out?

Also removing @aturon as assignee as it's not actively being worked on

@alexcrichton alexcrichton removed the P-medium Medium priority label Jul 14, 2016
@petrochenkov
Copy link
Contributor

I don't think this can be done now, too much breakage (?).

do either of you know if recent work has made this easy to knock out?

Nothing that I know about.
Stability checks can be moved to resolve in a similar way like path privacy checks were moved there. This will help to check reexport stability as well. This has a cost of turning resolve into hodgepodge of various random checks. Giving path segments node ids and recording def_id's of path components is probably too heavy of a hammer too (unless it's needed for something else).

@jseyfried
Copy link
Contributor

jseyfried commented Jul 14, 2016

Perhaps we could have resolve construct a map from paths to a list of the resolutions of the path's components (i.e. a list of Defs or DefIds) and use that map during the stability checking pass.

@alexcrichton
Copy link
Member

I wouldn't necessarily be too worried about the breakage here as we could turn these new stability violations into warnings for quite some time. We basically just want to communicate to people that the API they are accidentally using is actually stable somewhere else, and it's in their own best interest to use that instead.

If it's very difficult to implement in the compiler, though, this could just be something the libs team keeps in mind when stabilizing APIs and we can avoid having unstable modules with stable contents as much as possible.

SimonSapin added a commit to SimonSapin/rust that referenced this issue Nov 26, 2019
`std::panic` is already stable.

`core::panic::PanicInfo` and `core::panic::Location` are stable
and can be used through that path because of a bug
in stability checking: rust-lang#15702
Centril added a commit to Centril/rust that referenced this issue Dec 16, 2019
Stabilize the `core::panic` module

`std::panic` is already stable.

`core::panic::PanicInfo` and `core::panic::Location` are stable and can be used through that path because of a bug in stability checking: rust-lang#15702
@thomcc
Copy link
Member

thomcc commented Jun 20, 2021

@rustbot label: +lang-team-202x-edition

(I think this got forgotten for 2021, but adding the label so it doesn't get missed for 2024 or whatever)

@rustbot
Copy link
Collaborator

rustbot commented Jun 20, 2021

Error: Label lang-team-202x-edition can only be set by Rust team members

Please let @rust-lang/release know if you're having trouble with this bot.

@thomcc
Copy link
Member

thomcc commented Jun 20, 2021

Oh well, was worth a shot.

@RalfJung RalfJung added the A-maybe-future-edition Something we may consider for a future edition. label Jun 20, 2021
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Feb 28, 2023
add missing feature in core/tests

rust-lang#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example.

Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that.

r? `@thomcc`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 28, 2023
add missing feature in core/tests

rust-lang#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example.

Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that.

r? ``@thomcc``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 1, 2023
add missing feature in core/tests

rust-lang#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example.

Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that.

r? ```@thomcc```
@BoxyUwU
Copy link
Member

BoxyUwU commented May 7, 2023

can this be closed since #95956 landed?

@RalfJung
Copy link
Member

RalfJung commented May 8, 2023

Looks like it, yeah.

We do have some items with allowed_through_unstable_modules. Is there any plan to clean that up, e.g. deprecate these items or have them considered proper unstable in a future edition?

thomcc pushed a commit to tcdi/postgrestd that referenced this issue May 31, 2023
add missing feature in core/tests

rust-lang/rust#104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to rust-lang/rust#15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example.

Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that.

r? ```@thomcc```
@tmandry
Copy link
Member

tmandry commented Jun 28, 2023

Closing as done – please reopen if you disagree.

We do have some items with allowed_through_unstable_modules. Is there any plan to clean that up, e.g. deprecate these items or have them considered proper unstable in a future edition?

I'm not sure I understand this – my understanding is that the item is intended to be reachable through some other stable path, which should be fine? What needs cleaning up in that case?

@tmandry tmandry closed this as completed Jun 28, 2023
@RalfJung
Copy link
Member

std::intrinsics::transmute is usable on stable, which was never intended. Are there any plans to fix that?

@thomcc
Copy link
Member

thomcc commented Jun 28, 2023

I think it would be a breaking change to "fix" intrinsics::transmute, unless done via some edition-based cleverness. (I've seen it get used just via rust-analyzer auto-import, so it's not even people being overly clever/cheeky)

@tmandry
Copy link
Member

tmandry commented Jul 5, 2023

Thanks for the pointers – I've opened #113387 to track this.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 23, 2024
…olnay

Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition

cc rust-lang/libs-team#272

Any use of `RustcEncodable` and `RustcDecodable` now triggers a deny-by-default lint. The derives have been removed from the 2024 prelude. I specifically chose **not** to document this in the module-level documentation, as the presence in existing preludes is not documented (which I presume is intentional).

This does not implement the proposed change for `rustfix`, which I will be looking into shortly.

With regard to the items in the preludes being stable, this should not be an issue because rust-lang#15702 has been resolved.

r? libs-api
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 23, 2024
…olnay

Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition

cc rust-lang/libs-team#272

Any use of `RustcEncodable` and `RustcDecodable` now triggers a deny-by-default lint. The derives have been removed from the 2024 prelude. I specifically chose **not** to document this in the module-level documentation, as the presence in existing preludes is not documented (which I presume is intentional).

This does not implement the proposed change for `rustfix`, which I will be looking into shortly.

With regard to the items in the preludes being stable, this should not be an issue because rust-lang#15702 has been resolved.

r? libs-api
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 26, 2024
Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition

cc rust-lang/libs-team#272

Any use of `RustcEncodable` and `RustcDecodable` now triggers a deny-by-default lint. The derives have been removed from the 2024 prelude. I specifically chose **not** to document this in the module-level documentation, as the presence in existing preludes is not documented (which I presume is intentional).

This does not implement the proposed change for `rustfix`, which I will be looking into shortly.

With regard to the items in the preludes being stable, this should not be an issue because rust-lang#15702 has been resolved.

r? libs-api
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 27, 2024
Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition

cc rust-lang/libs-team#272

Any use of `RustcEncodable` and `RustcDecodable` now triggers a deny-by-default lint. The derives have been removed from the 2024 prelude. I specifically chose **not** to document this in the module-level documentation, as the presence in existing preludes is not documented (which I presume is intentional).

This does not implement the proposed change for `rustfix`, which I will be looking into shortly.

With regard to the items in the preludes being stable, this should not be an issue because rust-lang#15702 has been resolved.

r? libs-api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-maybe-future-edition Something we may consider for a future edition. A-stability Area: issues related to #[stable] and #[unstable] attributes themselves. C-bug Category: This is a bug. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests