Skip to content

Simplify type_of_opaque.#153581

Open
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rm-cycle_stash
Open

Simplify type_of_opaque.#153581
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rm-cycle_stash

Conversation

@nnethercote
Copy link
Contributor

There is a bunch of complexity supporting the "cannot check whether the hidden type of opaque type satisfies auto traits" error that shows up in tests/ui/impl-trait/auto-trait-leak.rs. This is an obscure error that shows up in a single test. If we are willing to downgrade that error message to a cycle error, we can do the following.

  • Simplify the type_of_opaque return value.
  • Remove the cycle_stash query modifier.
  • Remove the CyclePlaceholder type.
  • Remove the SelectionError::OpaqueTypeAutoTraitLeakageUnknown variant.
  • Remove a FromCycleError impl.
  • Remove report_opaque_type_auto_trait_leakage.
  • Remove the StashKey::Cycle variant.
  • Remove the CycleErrorHandling::Stash variant.

That's a lot! I think this is a worthwhile trade-off.

r? @oli-obk

There is a bunch of complexity supporting the "cannot check whether the
hidden type of opaque type satisfies auto traits" error that shows up in
`tests/ui/impl-trait/auto-trait-leak.rs`. This is an obscure error that
shows up in a single test. If we are willing to downgrade that error
message to a cycle error, we can do the following.

- Simplify the `type_of_opaque` return value.
- Remove the `cycle_stash` query modifier.
- Remove the `CyclePlaceholder` type.
- Remove the `SelectionError::OpaqueTypeAutoTraitLeakageUnknown`
  variant.
- Remove a `FromCycleError` impl.
- Remove `report_opaque_type_auto_trait_leakage`.
- Remove the `StashKey::Cycle` variant.
- Remove the `CycleErrorHandling::Stash` variant.

That's a lot! I think this is a worthwhile trade-off.
@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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 Mar 9, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2026

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

@nnethercote
Copy link
Contributor Author

cc @Zoxc @Zalathar @zetanumbers

This overlaps with #153247, and implements the suggestion in this comment. Zoxc gave me the go ahead to take this over via Zulip DM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants