@Nashenas88 implemented aggregate type-checking in nikomatsakis#13, but we still need to handle other sorts of rvalues.
This is a meta-issue to cover the various cases. As PRs come in, I can check things off. Here is a list. In practice, all of the issues boil down to needing to verify various trait requirements, so the main step here will be building a subroutine for checking that a given trait reference is satisfied at a particular location (somewhat similar to normalize -- instructions to come shortly).
@Nashenas88 implemented aggregate type-checking in nikomatsakis#13, but we still need to handle other sorts of rvalues.
This is a meta-issue to cover the various cases. As PRs come in, I can check things off. Here is a list. In practice, all of the issues boil down to needing to verify various trait requirements, so the main step here will be building a subroutine for checking that a given trait reference is satisfied at a particular location (somewhat similar to
normalize-- instructions to come shortly).Rvalue::Use(Operand)--let y = xSized? Do that for every operand?Rvalue::Repeat(Operand, ConstUsize)--let y = [x; N]Copy.Rvalue::Ref(Region, BorrowKind, Lvalue)--let y = &xRvalue::Len(X)Rvalue::Cast(CastKind, Operand, Ty), let's break this down byCastKind:Misc-- some form of bitcast I think, no action neededReifyFnPointer- added by @arielb1 the signatures must matchClosureFnPointer- added by @arielb1 the signatures must matchUnsafeFnPointer- added by @arielb1 the signatures must matchUnsize- I think we should verify a trait obligation here, something likeT: Unsize<U>whereT is the operand's type andU` is the target type. Have to double check this.Rvalue::BinaryOp(..)-- built-in binary operators. Probably we should check that e.g. the LHS and RHS are of the same type, but I'm not sure if that must be true and it doesn't really affect NLL anyhow. Leave it for now.Rvalue::CheckedBinaryOp(..)-- as above.Rvalue::UnaryOp(..)-- as above.Rvalue::Discriminant(..)-- no special rule.Rvalue::NullaryOp(..)--sizeofshould require that the type is sizedboxthe same