Skip to content

fix: Use ProofTreeVisitor for unsized coercion#22096

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
ShoyuVanilla:issue-21885
Apr 19, 2026
Merged

fix: Use ProofTreeVisitor for unsized coercion#22096
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
ShoyuVanilla:issue-21885

Conversation

@ShoyuVanilla
Copy link
Copy Markdown
Member

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)
Copy link
Copy Markdown
Member Author

@ShoyuVanilla ShoyuVanilla Apr 19, 2026

Choose a reason for hiding this comment

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

rustc succeeds the unsized coercion here, but emits fulfillment error on impl Foo + ?Sized is not being Sized 🤔

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And we fail the coercion?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Currently we do, but not anymore with this PR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure which way would be better; keeping this with an ignored attribute or just removing this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Following rustc is (almost) always better :)


fn visit_goal(&mut self, goal: &InspectGoal<'_, 'db>) -> Self::Result;

fn on_recursion_limit(&mut self) -> Self::Result {
Copy link
Copy Markdown
Member Author

@ShoyuVanilla ShoyuVanilla Apr 19, 2026

Choose a reason for hiding this comment

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


#[test]
fn regression_() {
fn regression_22007() {
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 Apr 19, 2026

Choose a reason for hiding this comment

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

That's probably my fault 😳

View changes since the review

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Apr 19, 2026
Merged via the queue into rust-lang:master with commit e794f62 Apr 19, 2026
18 checks passed
@ShoyuVanilla ShoyuVanilla deleted the issue-21885 branch April 19, 2026 19:49
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.

False positive compile error from lack of trait object coercion

2 participants