Skip to content

Conversation

tnuha
Copy link
Contributor

@tnuha tnuha commented Aug 9, 2025

The FIXME block in Ty::has_significant_drop is outdated as related queries can now handle type inference.

// FIXME(#86868): We should be canonicalizing, or else moving this to a method of inference
// context, or *something* like that, but for now just avoid passing inference
// variables to queries that can't cope with them. Instead, conservatively
// return "true" (may change drop order).
if query_ty.has_infer() {
return true;
}
// This doesn't depend on regions, so try to minimize distinct
// query keys used.
let erased = tcx.normalize_erasing_regions(typing_env, query_ty);
tcx.has_significant_drop_raw(typing_env.as_query_input(erased))

Closes #86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types

@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 Aug 9, 2025
@compiler-errors
Copy link
Member

Let's double check this with crater.

@bors2 try

@rust-bors
Copy link

rust-bors bot commented Aug 10, 2025

⌛ Trying commit 75ec279 with merge 1383df0

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 10, 2025
remove FIXME block from `has_significant_drop`, can handle inference
@rust-bors
Copy link

rust-bors bot commented Aug 10, 2025

☀️ Try build successful (CI)
Build commit: 1383df0 (1383df06117fd218068d1f39fd5326256dd4a348, parent: ca77504943887037504c7fc0b9bf06dab3910373)

@compiler-errors
Copy link
Member

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-145181 created and queued.
🤖 Automatically detected try build 1383df0
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 10, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-145181 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@compiler-errors
Copy link
Member

[...] as related queries can now handle type inference.

I think the more likely thing here is that we're now being more responsible and only calling has_significant_drop on types that don't have infer vars.

@tnuha
Copy link
Contributor Author

tnuha commented Aug 10, 2025

I did actually try this- the inference block I removed is certainly being hit in a few cases. I can rerun that experiment to find exactly which if you'd like.

Are you thinking the related queries still don't cope with infer vars? If so, do you know of a way to test this? (locally, not with craterbot ofc)

@tnuha
Copy link
Contributor Author

tnuha commented Aug 10, 2025

@compiler-errors https://github.com/rust-lang/rust/blob/master/tests/incremental/issue-86753.rs is an example for where has_significant_drop is called with an infer var, although admittedly a complex one. Works fine with the block removed.

I do see an argument for favoring canonicalization regardless- I just see this as an avenue for reducing complexity. Whatever seems to be the most appropriate.

@craterbot
Copy link
Collaborator

🎉 Experiment pr-145181 is completed!
📊 12 regressed and 6 fixed (679566 total)
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Aug 11, 2025
@tnuha
Copy link
Contributor Author

tnuha commented Aug 23, 2025

r? @compiler-errors

@rustbot rustbot assigned compiler-errors and unassigned BoxyUwU Aug 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 23, 2025

compiler-errors is not on the review rotation at the moment.
They may take a while to respond.

@compiler-errors
Copy link
Member

r? lcnr

@rustbot rustbot assigned lcnr and unassigned compiler-errors Sep 14, 2025
@tnuha tnuha force-pushed the remove-fixme-from-has-sigdrop branch from 75ec279 to fa7e474 Compare September 15, 2025 19:55
@rustbot
Copy link
Collaborator

rustbot commented Sep 15, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@tnuha
Copy link
Contributor Author

tnuha commented Sep 16, 2025

@craterbot check

@craterbot
Copy link
Collaborator

🔒 Error: you're not allowed to interact with this bot.

🔑 If you are a member of a Rust team and need access, please update rust-lang/team to grant your team or yourself access to the crater permission.
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@lcnr lcnr changed the title remove FIXME block from has_significant_drop, can handle inference remove FIXME block from has_significant_drop, it never encounters inference variables Sep 16, 2025
@lcnr
Copy link
Contributor

lcnr commented Sep 16, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 16, 2025

📌 Commit fa7e474 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 16, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 16, 2025
…rop, r=lcnr

remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389

Closes rust-lang#86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
bors added a commit that referenced this pull request Sep 16, 2025
Rollup of 4 pull requests

Successful merges:

 - #143613 (Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default)
 - #145181 (remove FIXME block from `has_significant_drop`, it never encounters inference variables)
 - #146552 (StateTransform: Do not renumber resume local.)
 - #146588 (tests/run-make: Update list of statically linked musl targets)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 16, 2025
…rop, r=lcnr

remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389

Closes rust-lang#86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
bors added a commit that referenced this pull request Sep 16, 2025
Rollup of 3 pull requests

Successful merges:

 - #145181 (remove FIXME block from `has_significant_drop`, it never encounters inference variables)
 - #146259 (Suggest removing Box::new instead of unboxing it)
 - #146588 (tests/run-make: Update list of statically linked musl targets)

r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 17, 2025
…rop, r=lcnr

remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389

Closes rust-lang#86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
bors added a commit that referenced this pull request Sep 17, 2025
Rollup of 9 pull requests

Successful merges:

 - #144871 (Stabilize `btree_entry_insert` feature)
 - #145181 (remove FIXME block from `has_significant_drop`, it never encounters inference variables)
 - #145838 (don't apply temporary lifetime extension rules to non-extended `super let`)
 - #146259 (Suggest removing Box::new instead of unboxing it)
 - #146410 (Iterator repeat: no infinite loop for `last` and `count`)
 - #146460 (Add tidy readme)
 - #146581 (Detect attempt to use var-args in closure)
 - #146588 (tests/run-make: Update list of statically linked musl targets)
 - #146647 (Move `#[rustc_coherence_is_core]` to the `crate_level` file)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 17, 2025
…rop, r=lcnr

remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389

Closes rust-lang#86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 17, 2025
…rop, r=lcnr

remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389

Closes rust-lang#86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
bors added a commit that referenced this pull request Sep 17, 2025
Rollup of 14 pull requests

Successful merges:

 - #142807 (libtest: expose --fail-fast as an unstable command-line option)
 - #144871 (Stabilize `btree_entry_insert` feature)
 - #145071 (Update the minimum external LLVM to 20)
 - #145181 (remove FIXME block from `has_significant_drop`, it never encounters inference variables)
 - #145660 (initial implementation of the darwin_objc unstable feature)
 - #145838 (don't apply temporary lifetime extension rules to non-extended `super let`)
 - #146259 (Suggest removing Box::new instead of unboxing it)
 - #146410 (Iterator repeat: no infinite loop for `last` and `count`)
 - #146460 (Add tidy readme)
 - #146552 (StateTransform: Do not renumber resume local.)
 - #146564 (Remove Rvalue::Len again.)
 - #146581 (Detect attempt to use var-args in closure)
 - #146588 (tests/run-make: Update list of statically linked musl targets)
 - #146631 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 3))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f21a9c9 into rust-lang:master Sep 17, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 17, 2025
rust-timer added a commit that referenced this pull request Sep 17, 2025
Rollup merge of #145181 - Borgerr:remove-fixme-from-has-sigdrop, r=lcnr

remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389

Closes #86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Sep 22, 2025
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#142807 (libtest: expose --fail-fast as an unstable command-line option)
 - rust-lang/rust#144871 (Stabilize `btree_entry_insert` feature)
 - rust-lang/rust#145071 (Update the minimum external LLVM to 20)
 - rust-lang/rust#145181 (remove FIXME block from `has_significant_drop`, it never encounters inference variables)
 - rust-lang/rust#145660 (initial implementation of the darwin_objc unstable feature)
 - rust-lang/rust#145838 (don't apply temporary lifetime extension rules to non-extended `super let`)
 - rust-lang/rust#146259 (Suggest removing Box::new instead of unboxing it)
 - rust-lang/rust#146410 (Iterator repeat: no infinite loop for `last` and `count`)
 - rust-lang/rust#146460 (Add tidy readme)
 - rust-lang/rust#146552 (StateTransform: Do not renumber resume local.)
 - rust-lang/rust#146564 (Remove Rvalue::Len again.)
 - rust-lang/rust#146581 (Detect attempt to use var-args in closure)
 - rust-lang/rust#146588 (tests/run-make: Update list of statically linked musl targets)
 - rust-lang/rust#146631 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 3))

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Development

Successfully merging this pull request may close these issues.

refactor queries that don't accept inference variables to use canonicalization
7 participants