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

Deprecate intrinsics::drop_in_place and collections::Bound, which accidentally weren't deprecated #82122

Merged
merged 1 commit into from
Mar 17, 2021

Conversation

bstrie
Copy link
Contributor

@bstrie bstrie commented Feb 14, 2021

Fixes #82080.

I've taken the liberty of updating the since values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations).

As mentioned in the issue I'm pretty sure that using a type alias for Bound is semantically equivalent to the re-export; the reference implies that type aliases only observably differ from types when used on unit structs or tuple structs, whereas Bound is an enum.

@rust-highfive
Copy link
Collaborator

r? @dtolnay

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 14, 2021
@bstrie
Copy link
Contributor Author

bstrie commented Feb 14, 2021

Note that this might not necessarily "fix" #82080 if you happen to think that rustc_deprecated should "just work" on re-exports, but this is a far more expedient fix to the current problem.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Feb 14, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Feb 14, 2021

📌 Commit dfae9f0077de752ec9c00f6625c65cab202366b3 has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2021
@dtolnay
Copy link
Member

dtolnay commented Feb 14, 2021

It looks like tidy failed in CI:

2021-02-14T23:40:28.5030915Z tidy check
2021-02-14T23:40:28.8226072Z * 624 error codes
2021-02-14T23:40:28.8227914Z * highest error code: E0781
2021-02-14T23:40:28.8228436Z Checking which error codes lack tests...
2021-02-14T23:40:29.0131586Z Found 436 error codes
2021-02-14T23:40:29.0132273Z Found 0 error codes with no tests
2021-02-14T23:40:29.0132741Z Done!
2021-02-14T23:40:30.1846989Z tidy error: /checkout/library/core/src/intrinsics.rs:72: undocumented unsafe
2021-02-14T23:40:32.0135064Z some tidy checks failed

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 14, 2021
@jyn514
Copy link
Member

jyn514 commented Feb 15, 2021

Note that this might not necessarily "fix" #82080 if you happen to think that rustc_deprecated should "just work" on re-exports, but this is a far more expedient fix to the current problem.

Could you open a separate issue for making rustc_deprecated work on re-exports (since it sounds like 82080 is mostly tracking drop_in_place)?

@dtolnay
Copy link
Member

dtolnay commented Feb 15, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Feb 15, 2021

📌 Commit c813b38ec04eae0108cfb14312be8e4348dc0d27 has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 15, 2021
@bstrie
Copy link
Contributor Author

bstrie commented Feb 15, 2021

I've opened #82123 to track fixing the behavior of #[rustc_deprecated].

@rust-log-analyzer

This comment has been minimized.

@bstrie
Copy link
Contributor Author

bstrie commented Feb 15, 2021

Oof, I'll take a look at that.

@jyn514
Copy link
Member

jyn514 commented Feb 15, 2021

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 15, 2021
@bstrie
Copy link
Contributor Author

bstrie commented Feb 15, 2021

Ok, when I first saw that this patch was changing the output of some UI tests I was concerned that codegen was secretly referring to intrinsics::drop_in_place somewhere, and that this was just exposing that. However I tried deleting intrinsics::drop_in_place and found that the tests all passed, so my new hypothesis is just that the diagnostic output is smartly recognizing that there are two distinct drop_in_place symbols and is just trying to disambiguate by referring to the fully-qualified path of ptr::drop_in_place. Does that sound plausible? If so, I've blessed those UI tests.

@jyn514
Copy link
Member

jyn514 commented Feb 15, 2021

However I tried deleting intrinsics::drop_in_place and found that the tests all passed, so my new hypothesis is just that the diagnostic output is smartly recognizing that there are two distinct drop_in_place symbols and is just trying to disambiguate by referring to the fully-qualified path of ptr::drop_in_place. Does that sound plausible?

That sounds right, yeah, I think that's what was implemented in #73996.

@rust-log-analyzer

This comment has been minimized.

@bstrie
Copy link
Contributor Author

bstrie commented Feb 15, 2021

Ok, so I assume that the mir output being diffed here is only for human consumption, and that the new fully-qualified path being shown for ptr::drop_in_place is just an artifact of the textual representation and not actually any sort of codegen regression?

But fascinatingly, one of the failing MIR tests does contain an explicit reference to intrinsics::drop_in_place... but it's failing because this PR causes it to start referring to ptr::drop_in_place, somehow???

While we're at it, I'm just grepping for intrinsics::drop_in_place now and there's a bunch of codegen tests with that exact string. Why? The lang item has long since been directly on ptr::drop_in_place, so codegen should always be referring to that. True enough, these tests start failing when I run the test suite locally. Is it okay to bless these?

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 9, 2021
@Dylan-DPC-zz
Copy link

@jyn514 this was in the error as well:

[RUSTC-TIMING] semver_parser test:false 3.186
error: use of deprecated type alias `std::collections::Bound`: moved to `std::ops::Bound`
   |
30 | use std::collections::Bound;
   |     ^^^^^^^^^^^^^^^^^^^^^^^

@bstrie bstrie added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 16, 2021
@bstrie
Copy link
Contributor Author

bstrie commented Mar 16, 2021

I've updated Clippy; ready for re-approval.

@Dylan-DPC-zz
Copy link

@bors r=dtolnay

@bors
Copy link
Contributor

bors commented Mar 16, 2021

📌 Commit 49aa79e has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 16, 2021
@bors
Copy link
Contributor

bors commented Mar 17, 2021

⌛ Testing commit 49aa79e with merge 36f1f04...

@bors
Copy link
Contributor

bors commented Mar 17, 2021

☀️ Test successful - checks-actions
Approved by: dtolnay
Pushing 36f1f04 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 17, 2021
@bors bors merged commit 36f1f04 into rust-lang:master Mar 17, 2021
@rustbot rustbot added this to the 1.52.0 milestone Mar 17, 2021
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #82122!

Tested on commit 36f1f04.
Direct link to PR: #82122

💔 miri on windows: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).
💔 miri on linux: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Mar 17, 2021
Tested on commit rust-lang/rust@36f1f04.
Direct link to PR: <rust-lang/rust#82122>

💔 miri on windows: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).
💔 miri on linux: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).
bors added a commit to rust-lang/miri that referenced this pull request Mar 17, 2021
Replace deprecated `collections::Bound` with `ops::Bound`

Fixes rust-lang/rust#83242 , which resulted from rust-lang/rust#82122 .
bors added a commit to rust-lang/miri that referenced this pull request Mar 17, 2021
Replace deprecated `collections::Bound` with `ops::Bound`

Cc rust-lang/rust#83242 , which resulted from rust-lang/rust#82122 .
#[doc(hidden)]
pub use crate::ops::Bound;
pub type Bound<T> = crate::ops::Bound<T>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this is technically a breaking change if someone did use std::collections::Bound::*; (like Miri did)

Copy link
Contributor Author

@bstrie bstrie Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I assumed miri had broken due to denying deprecation warnings. I wasn't aware that type aliases to enums couldn't glob-import; it looks like even concrete importing like use collections::Bound::Unbounded isn't supported. :\ This is a distressing limitation of type alises that I wasn't aware of; I trusted that the limitations laid out in the reference were exhaustive. I'm not sure what to do about this. At the very least I'll file an issue about supporting this, since it really does seem like a bug in type aliases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've filed #83248 to track importing variants through type aliases. I'll also ping the libs team on Zulip to see what they think should be done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trusted that the limitations laid out in the reference were exhaustive.

Which part of the reference is that? Might be worth reporting a bug (or submitting a PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page of the reference: https://doc.rust-lang.org/reference/items/type-aliases.html , at the bottom where it talks about where type aliases cannot be used. I'll submit a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference PR at rust-lang/reference#984

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 19, 2021
Revert the second deprecation of collections::Bound

Per the review at rust-lang#82122 (comment) and the decision at https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/unavoidable.20breakage.20when.20deprecating.20an.20enum.3F , revert this small portion of rust-lang#82122 for the time being. This doesn't affect the other components of that patch, i.e. `intrinsics::drop_in_place` is still deprecated-for-real, and uses of `collections::Bound` remain removed from the repo.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 19, 2021
Revert the second deprecation of collections::Bound

Per the review at rust-lang#82122 (comment) and the decision at https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/unavoidable.20breakage.20when.20deprecating.20an.20enum.3F , revert this small portion of rust-lang#82122 for the time being. This doesn't affect the other components of that patch, i.e. `intrinsics::drop_in_place` is still deprecated-for-real, and uses of `collections::Bound` remain removed from the repo.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 25, 2021
Deprecate `intrinsics::drop_in_place` and `collections::Bound`, which accidentally weren't deprecated

Fixes rust-lang#82080.

I've taken the liberty of updating the `since` values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations).

As mentioned in the issue I'm *pretty* sure that using a type alias for `Bound` is semantically equivalent to the re-export; [the reference implies](https://doc.rust-lang.org/reference/items/type-aliases.html) that type aliases only observably differ from types when used on unit structs or tuple structs, whereas `Bound` is an enum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Actually deprecate collections::Bound
10 participants