fix: Use ProofTreeVisitor for unsized coercion#22096
Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom Apr 19, 2026
Merged
fix: Use ProofTreeVisitor for unsized coercion#22096ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
ProofTreeVisitor for unsized coercion#22096ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
Conversation
ShoyuVanilla
commented
Apr 19, 2026
| fn test(f: impl Foo, g: &(impl Foo + ?Sized)) { | ||
| let _: &dyn Foo = &f; | ||
| let _: &dyn Foo = g; | ||
| //^ expected &'? (dyn Foo + 'static), got &'? (impl Foo + ?Sized) |
Member
Author
There was a problem hiding this comment.
rustc succeeds the unsized coercion here, but emits fulfillment error on impl Foo + ?Sized is not being Sized 🤔
Contributor
There was a problem hiding this comment.
And we fail the coercion?
Member
Author
There was a problem hiding this comment.
Currently we do, but not anymore with this PR
Member
Author
There was a problem hiding this comment.
I'm not sure which way would be better; keeping this with an ignored attribute or just removing this
Contributor
There was a problem hiding this comment.
Following rustc is (almost) always better :)
ShoyuVanilla
commented
Apr 19, 2026
|
|
||
| fn visit_goal(&mut self, goal: &InspectGoal<'_, 'db>) -> Self::Result; | ||
|
|
||
| fn on_recursion_limit(&mut self) -> Self::Result { |
Member
Author
There was a problem hiding this comment.
This is needed as like in rust-lang/rust#152444
ChayimFriedman2
approved these changes
Apr 19, 2026
|
|
||
| #[test] | ||
| fn regression_() { | ||
| fn regression_22007() { |
Contributor
There was a problem hiding this comment.
That's probably my fault 😳
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ported rustc codes from https://github.com/rust-lang/rust/blob/22cc6747b18b3a6738e98b06676fd91f1756b33a/compiler/rustc_hir_typeck/src/coercion.rs#L657-L669
Fixes #21885