-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Dont check stability for items that are not pub to universe. #38689
Dont check stability for items that are not pub to universe. #38689
Conversation
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
Oops I left out a regression test. (And it might be good to try to generalize the specific test to some other scenarios.... will do this in about two hours after i get through some meetings.) |
(weird, I guess I must have something subtly wrong with my check. Thank goodness for test suites.) |
Marking as beta-accepted. Small patch, regression. cc @rust-lang/compiler |
@@ -432,6 +432,18 @@ struct Checker<'a, 'tcx: 'a> { | |||
} | |||
|
|||
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { | |||
fn skip_stability_check_due_to_privacy(self, def_id: DefId) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping this could be used to skip the "missing annotation" error in the original crate, within this same file, ensuring that the logic is self-consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow.
The check you are referring to is fn check_missing_stability
, right?
Is there an example you can show me of input code that is currently emitting a "missing annotation" error that you believe should be skipped via this check?
test? |
Includes special case handling for trait methods. Fix rust-lang#38412.
751cd72
to
ab8e925
Compare
@arielb1 okay has good test now! :) |
Note that if there's a way to do this without special-casing trait methods (which is what the But I figured this was the simplest fix for the short term that we could backport. Separately we might consider revising what |
Strictly speaking the fix is incorrect because stability annotations are based on reachability and not local |
Alternatively, the ICE can just be removed, since it's no longer an error to encounter unmarked API 😄 |
(I lean slightly towards landing this over removing the ICE, in terms of what seems safest to push into the beta. But I don't have a real strong feeling about it. If other members of T-compiler think removing the ICE is the way to go, then we can try that.) |
@petrochenkov also, just to clarify: Your point about this fix being technically incorrect is because it is imposing too strong a constraint on the code, right? I ask because I'm having a little trouble envisaging the scenario where something would have stability attributes and not be locally declared |
I'm fine with landing this PR for now, but I'm not really following closely. |
On the contrary, the constraints are not strong enough.
still should give and ICE with this patch because |
Sure enough, ignoring the absence of stability markers, at least for items whose resolution was an error, looks like a good idea. |
@petrochenkov ah thank you for the example input. |
@pnkfelix do you then plan to revise the PR? |
@bors: p=1 (for when this is approved, we'll want to backport) |
@bors r=petrochenkov |
Discussed in @rust-lang/compiler meeting. Consensus was to land this PR for the beta, since it seems less risky, but follow-up with @petrochenkov's example afterwards (probably removing the ICE). @petrochenkov, maybe you can file an issue with your example? @bors r+ |
📌 Commit ab8e925 has been approved by |
📌 Commit ab8e925 has been approved by |
(the answer to @nikomatsakis 's Q above is that I did and do not plan to revise this particular PR. However I will open an issue to make sure that we address the fact that there remains an ICE, just a much rarer one, even with this PR applied, as noted by @petrochenkov ) |
…, r=nikomatsakis Dont check stability for items that are not pub to universe. Dont check stability for items that are not pub to universe. In other words, skip it for private and even `pub(restricted)` items, because stability checks are only relevant to things visible in other crates. Fix #38412.
☀️ Test successful - status-appveyor, status-travis |
@pnkfelix this applies cleanly to beta but results in a build failure, could you take a look at backporting this to the beta branch? |
…to_privacy, r=compiler-errors stability: remove skip_stability_check_due_to_privacy This was added in rust-lang#38689 to deal with rust-lang#38412. However, even after removing the check, the relevant tests still pass. Let's see if CI finds any other tests that rely on this. If not, it seems like logic elsewhere in the compiler changed so this is not required any more.
…to_privacy, r=compiler-errors stability: remove skip_stability_check_due_to_privacy This was added in rust-lang#38689 to deal with rust-lang#38412. However, even after removing the check, the relevant tests still pass. Let's see if CI finds any other tests that rely on this. If not, it seems like logic elsewhere in the compiler changed so this is not required any more.
Rollup merge of rust-lang#133157 - RalfJung:skip_stability_check_due_to_privacy, r=compiler-errors stability: remove skip_stability_check_due_to_privacy This was added in rust-lang#38689 to deal with rust-lang#38412. However, even after removing the check, the relevant tests still pass. Let's see if CI finds any other tests that rely on this. If not, it seems like logic elsewhere in the compiler changed so this is not required any more.
Dont check stability for items that are not pub to universe.
In other words, skip it for private and even
pub(restricted)
items, because stability checks are only relevant to things visible in other crates.Fix #38412.