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

Don't require Drop for [PhantomData<T>; N] where N and T are generic, if T requires Drop #115527

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Sep 4, 2023

fixes #115403
fixes #115410

This was accidentally regressed in #114134, because it was accidentally stabilized in #102204 (cc @rust-lang/lang, seems like an innocent stabilization, considering this PR is more of a bugfix than a feature).

While we have a whole month to beta backport this change before the regression hits stable, I'd still prefer not to go through an FCP on this PR (which fixes a regression), if T-lang wants an FCP, I can can open an issue about the change itself.

@oli-obk oli-obk added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 4, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cjgillot (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 4, 2023
@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 4, 2023

cc @fee1-dead

@fee1-dead
Copy link
Member

cc @lcnr you assigned yourself on my PR

@lcnr
Copy link
Contributor

lcnr commented Sep 5, 2023

r? @lcnr

@rustbot rustbot assigned lcnr and unassigned cjgillot Sep 5, 2023
@lcnr lcnr 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2023
@lcnr
Copy link
Contributor

lcnr commented Sep 7, 2023

this breaks

struct NeedsDrop;

impl Drop for NeedsDrop {
    fn drop(&mut self) {
        println!("dropping");
    }
}

struct Foo<const N: usize>([NeedsDrop; N]);

struct Bar(Foo<0>);

const fn should_not_drop(x: Bar) {}

fn main() {
    should_not_drop(Bar(Foo([])));
}

@oli-obk oli-obk force-pushed the drop_maybe_uninit_in_const branch 2 times, most recently from a72f9da to d268d53 Compare September 7, 2023 14:15

debug!("needs_drop_raw({:?}) = {:?}", query, res);
res
}

/// HACK: in order to mistakenly assume that `[PhantomData<T>; N]` requires drop glue
Copy link
Contributor

Choose a reason for hiding this comment

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

something someething missing negation 😁

Suggested change
/// HACK: in order to mistakenly assume that `[PhantomData<T>; N]` requires drop glue
/// HACK: in order to not mistakenly assume that `[PhantomData<T>; N]` requires drop glue

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

r=me after adding the test for the above regression

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 7, 2023

huh I had that test locally... I fail at git

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 7, 2023

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Sep 7, 2023

📌 Commit 320bb81 has been approved by lcnr

It is now in the queue for this repository.

@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 Sep 7, 2023
@bors
Copy link
Contributor

bors commented Sep 7, 2023

⌛ Testing commit 320bb81 with merge 1e746d7...

@bors
Copy link
Contributor

bors commented Sep 7, 2023

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 1e746d7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 7, 2023
@bors bors merged commit 1e746d7 into rust-lang:master Sep 7, 2023
12 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 7, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1e746d7): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% [2.9%, 2.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 628.819s -> 627.948s (-0.14%)
Artifact size: 318.09 MiB -> 318.11 MiB (0.00%)

@oli-obk oli-obk deleted the drop_maybe_uninit_in_const branch September 7, 2023 22:32
@Mark-Simulacrum
Copy link
Member

note: this was also picked up in crater (https://crater-reports.s3.amazonaws.com/beta-1.73-1.2/beta-2023-09-10/reg/construe-0.0.3/log.txt), looks like it's already beta-nominated though.

@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Sep 14, 2023
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 16, 2023
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.74.0, 1.73.0 Sep 16, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 17, 2023
…k-Simulacrum

[beta] backport

This PR backports:

- rust-lang#115785: Only suggest turbofish in patterns if we may recover
- rust-lang#115527: Don't require `Drop` for `[PhantomData<T>; N]` where `N` and `T` are generic, if `T` requires `Drop`
- rust-lang#115389: fix(resolve): update def if binding is warning ambiguity
- rust-lang#115215: Remove assert that checks type equality

r? `@Mark-Simulacrum`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
9 participants