Uh oh!
There was an error while loading. Please reload this page.
Normalize lazilly for sized - #32844
Conversation
It should never have been public. Call `skip_binder` instead and make your intentions explicit. Where possible, I adopted `map_bound_ref` and `map_bound` instead.
This avoids normalizing for structural types, which kind of gives us a poor man's lazy normalization. It's enough to fix issue rust-lang#31299, anyway, though you can still get false failures if you try hard enough. Fixesrust-lang#31299.
Leverage the fact that wfcheck requires that all struct fields are of sized type except the last, so we don't need to check that again.
arielb1
commented
Apr 9, 2016
This does not handle newtyped pointers ( |
| match bound { | ||
| ty::BoundCopy => ok_if(vec![element_ty]), | ||
| ty::BoundSized => ok_if(Vec::new()), | ||
| ty::BoundCopy => self.builtin_bound_ok_if(bound, vec![element_ty]), |
arielb1
commented
Apr 9, 2016
How does last-field-only not break our self-recursive struct checking? structRecursive{this:Recursive,last:u32} |
nikomatsakis
commented
Apr 11, 2016
We have separate code that checks for this. It so happens that if we get a recursive When I run that test I get: /home/nmatsakis/tmp/x.rs:1:1:4:2 error: recursive type `Recursive` has infinite size[E0072]
/home/nmatsakis/tmp/x.rs:1structRecursive{
/home/nmatsakis/tmp/x.rs:2this:Recursive,
/home/nmatsakis/tmp/x.rs:3last:u32
/home/nmatsakis/tmp/x.rs:4}
/home/nmatsakis/tmp/x.rs:1:1:4:2 help: run `rustc --explain E0072` to see a detailed explanation
/home/nmatsakis/tmp/x.rs:1:1:4:2 help: insert indirection(e.g., a `Box`, `Rc`, or `&`) at some point to make `Recursive` representable
error: aborting due to previous errorI can add a test case if you like. |
nikomatsakis
commented
Apr 11, 2016
No, it doesn't, no structs. Why not land it? Just because it's hacky? |
nikomatsakis
commented
Apr 22, 2016
Withdrawing this PR in favor of #33138, which is way better. |
This is a bit of a hack, but if we eagerly expand structural type obligations, we can resolve#31299.
r? @arielb1