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

Open
brson opened this Issue Jul 16, 2014 · 17 comments

Comments

Projects
None yet
@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

This comment has been minimized.

Copy link
Member

aturon commented Jul 16, 2014

cc #8962

@aturon

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

lifthrasiir commented Nov 18, 2014

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.

@nrc nrc added the I-nominated label Nov 18, 2014

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Nov 20, 2014

P-high, not 1.0.

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

@pnkfelix pnkfelix added P-medium and removed I-nominated labels Nov 20, 2014

@brson

This comment has been minimized.

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.

@brson brson added the I-nominated label Jan 6, 2015

@pnkfelix

This comment has been minimized.

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

@pnkfelix pnkfelix removed the I-nominated label Jan 8, 2015

@aturon

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 14, 2015

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

@pnkfelix

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 24, 2015

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.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 14, 2016

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

@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Jul 14, 2016

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 14, 2016

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

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Apr 17, 2018

Still relevant in rustc 1.25.0. This compiles even though the intrinsics module and the Float trait are both unstable.

extern crate core;
fn main() {
    unsafe { std::intrinsics::copy(&0, &mut 0, 1); }
    core::num::Float::is_nan(1.0);
}
@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Apr 17, 2018

Now I think this was the correct solution:

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.

SimonSapin added a commit to SimonSapin/super-metroid that referenced this issue Apr 21, 2018

Don’t use the unstable `SliceExt` trait
It is being removed in rust-lang/rust#49896. The fact that its methods could still be used on the stable channel is a bug: rust-lang/rust#15702
@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Feb 13, 2019

maybe we can file this under "maturity" (and try to aim a fix for the next edition...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.