Skip to content

fix: Catch #[rustc_reservation_impl = "reason"]#22282

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
ChayimFriedman2:reserve-impl
May 4, 2026
Merged

fix: Catch #[rustc_reservation_impl = "reason"]#22282
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
ChayimFriedman2:reserve-impl

Conversation

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 commented May 4, 2026

And not just #[rustc_reservation_impl].

This has caused a bug that took me way too long to debug. Basically, with the reservation impl From<!> for T overlapping with From<T> for T, the solver couldn't deduce from the bound Ty: From<?var> that var = Ty. Up until now this only caused some unknown types, but with the "type annotations needed" it started becoming visible, and annoying.

This is not the first time that we forget some attribute can be applied in more than one reason; perhaps we should unify handling for all ast::Meta kinds that have a path.

Fixes #22263.

And not just `#[rustc_reservation_impl]`.

This has caused a bug that took me way too long to debug. Basically, with the reservation impl `From<!> for T` overlapping with `From<T> for T`, the solver couldn't deduce from the bound `Ty: From<?var>` that `var = Ty`. Up until now this only caused some unknown types, but with the "type annotations needed" it started becoming visible, and annoying.

This is not the first time that we forget some attribute can be applied in more than one reason; perhaps we should unify handling for all `ast::Meta` kinds that have a path.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 4, 2026
@ChayimFriedman2 ChayimFriedman2 enabled auto-merge May 4, 2026 17:44
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 4, 2026
Merged via the queue into rust-lang:master with commit cd24e6e May 4, 2026
18 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the reserve-impl branch May 4, 2026 18:06
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"type annotations needed" on #[derive(serde::Deserialize)]

2 participants