Skip to content

Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…#154431

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
TaKO8Ki:fix-explicit-reference-cast-unrelated-leaf
Mar 28, 2026
Merged

Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…#154431
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
TaKO8Ki:fix-explicit-reference-cast-unrelated-leaf

Conversation

@TaKO8Ki
Copy link
Copy Markdown
Member

@TaKO8Ki TaKO8Ki commented Mar 26, 2026

Fixes #154403

The explicit reference cast suggestion in was enabled based on main_trait_predicate being From/TryFrom, but it then extracted the source type from leaf_trait_predicate.

That is only valid when the leaf obligation is also part of the From/TryFrom conversion family.

@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 Mar 26, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 26, 2026

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 11 candidates

Copy link
Copy Markdown
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

LL | for<'a> F: Output<'a>,
| ^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper`

error[E0277]: the trait bound `for<'a> _: From<<{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41} as Output<'a>>::Type>` is not satisfied
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to address here but maybe we could improve diagnostics, it's kinda verbose.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 27, 2026

📌 Commit 741a3a7 has been approved by JohnTitor

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 27, 2026
rust-bors bot pushed a commit that referenced this pull request Mar 27, 2026
Rollup of 10 pull requests

Successful merges:

 - #154070 (Unstable book options parser)
 - #154371 (Use LocalDefId for more tcx method calls)
 - #154405 (Improve doc comment unicode guidance)
 - #154431 (Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…)
 - #153528 (Fix LegacyKeyValueFormat report from docker build: mips)
 - #154246 (Add test for issue #101532: dead code warnings in const _)
 - #154421 (Rustdoc rejects html emits with json output)
 - #154428 (bootstrap: `-Zjson-target-spec` for synthetic targets)
 - #154437 (bootstrap.example.toml: Hint how to allow `build.warnings`)
 - #154454 (fix: [rustfmt] prevent panic when rewritng associated item delegations)

Failed merges:

 - #154450 (Use the normal arg-parsing machinery for `-Zassert-incr-state`)
rust-bors bot pushed a commit that referenced this pull request Mar 27, 2026
Rollup of 10 pull requests

Successful merges:

 - #154070 (Unstable book options parser)
 - #154371 (Use LocalDefId for more tcx method calls)
 - #154405 (Improve doc comment unicode guidance)
 - #154431 (Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…)
 - #153528 (Fix LegacyKeyValueFormat report from docker build: mips)
 - #154246 (Add test for issue #101532: dead code warnings in const _)
 - #154421 (Rustdoc rejects html emits with json output)
 - #154428 (bootstrap: `-Zjson-target-spec` for synthetic targets)
 - #154437 (bootstrap.example.toml: Hint how to allow `build.warnings`)
 - #154454 (fix: [rustfmt] prevent panic when rewritng associated item delegations)

Failed merges:

 - #154450 (Use the normal arg-parsing machinery for `-Zassert-incr-state`)
@rust-bors rust-bors bot merged commit 4f6837e into rust-lang:main Mar 28, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 28, 2026
rust-timer added a commit that referenced this pull request Mar 28, 2026
Rollup merge of #154431 - TaKO8Ki:fix-explicit-reference-cast-unrelated-leaf, r=JohnTitor

Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…

Fixes #154403

The explicit reference cast suggestion in was enabled based on `main_trait_predicate` being `From`/`TryFrom`, but it then extracted the source type from `leaf_trait_predicate`.

That is only valid when the leaf obligation is also part of the `From`/`TryFrom` conversion family.
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.

[ICE]: expected type for param #1 in...

3 participants