@@ -832,24 +832,26 @@ class LetValueInitialization : public Initialization {
832832 ConsumableAndAssignable);
833833 }
834834
835- // Otherwise, if we do not have a no implicit copy variable, just follow
836- // the "normal path": perform a lexical borrow if the lifetime is lexical.
837- if (!vd->isNoImplicitCopy ()) {
838- return SGF.B .createBeginBorrow (
835+ // If we have a no implicit copy lexical, emit the instruction stream so
836+ // that the move checker knows to check this variable.
837+ if (vd->isNoImplicitCopy ()) {
838+ value = SGF.B .createMoveValue (PrologueLoc, value, /* IisLexical*/ true ,
839+ /* hasPointerEscape=*/ false ,
840+ /* fromVarDecl=*/ true );
841+ value =
842+ SGF.B .createOwnedCopyableToMoveOnlyWrapperValue (PrologueLoc, value);
843+ return SGF.B .createMarkUnresolvedNonCopyableValueInst (
839844 PrologueLoc, value,
840- /* isLexical= */ SGF. F . getLifetime (vd, value-> getType ()). isLexical (),
841- /* hasPointerEscape= */ false , /* fromVarDecl= */ true );
845+ MarkUnresolvedNonCopyableValueInst::CheckKind::
846+ ConsumableAndAssignable );
842847 }
843848
844- // If we have a no implicit copy lexical, emit the instruction stream so
845- // that the move checker knows to check this variable.
846- value =
847- SGF.B .createMoveValue (PrologueLoc, value, /* IisLexical*/ true ,
848- /* hasPointerEscape=*/ false , /* fromVarDecl=*/ true );
849- value = SGF.B .createOwnedCopyableToMoveOnlyWrapperValue (PrologueLoc, value);
850- return SGF.B .createMarkUnresolvedNonCopyableValueInst (
849+ // Otherwise, if we do not have a no implicit copy variable, just follow
850+ // the "normal path": perform a lexical borrow if the lifetime is lexical.
851+ return SGF.B .createBeginBorrow (
851852 PrologueLoc, value,
852- MarkUnresolvedNonCopyableValueInst::CheckKind::ConsumableAndAssignable);
853+ /* isLexical=*/ SGF.F .getLifetime (vd, value->getType ()).isLexical (),
854+ /* hasPointerEscape=*/ false , /* fromVarDecl=*/ true );
853855 }
854856
855857 void bindValue (SILValue value, SILGenFunction &SGF, bool wasPlusOne,
0 commit comments