Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression for well known trait impls for builtin types #590

Closed
jackh726 opened this issue Aug 3, 2020 · 3 comments · Fixed by #591
Closed

Regression for well known trait impls for builtin types #590

jackh726 opened this issue Aug 3, 2020 · 3 comments · Fixed by #591
Labels
bug A bug

Comments

@jackh726
Copy link
Member

jackh726 commented Aug 3, 2020

So, this regression happened sometime between 0.14 and 0.20.

Basically, if we have a goal like

Canonical {
  value: InEnvironment {
    environment: Env([]),
    goal: Implemented(Ty(^0.0): TraitId(DefId(2:1942 ~ core[d282]::marker[0]::Sized[0]))),
  },
  binders: [U0 with kind integer type],
}

then we don't generate the clause for Sized impl (at least with SLG).

We pass Implemented(Ty(?0i): TraitId(DefId(2:1942 ~ core[d282]::marker[0]::Sized[0]))) to program_clauses_for_goal; the ?0i self type is not covered in add_sized_program_clauses. I haven't tested Copy/Clone, but I'm almost certain the same problem occurs. Edit: forgot that these are in libcore, so aren't builtin for ints/floats.

@flodiebold
Copy link
Member

flodiebold commented Aug 4, 2020

I think we would have floundered on this before #555, but now it's actually hitting the built-in clauses code which doesn't handle it.

I.e. we just need to actually handle this case in the built-in clauses code.

@jackh726
Copy link
Member Author

jackh726 commented Aug 4, 2020

Well, we used to be able to solve that goal fine in SLG (I found this when updating the rustc integration, because lots of tests there fail now)

Yeah, this should be a fairly simple fix, but its actually a pretty big issue.

@jackh726 jackh726 added the bug A bug label Aug 4, 2020
@flodiebold
Copy link
Member

My guess is it worked because rustc tried again later when the variable was resolved. Now Chalk will say the goal can't be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants