Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2465,6 +2465,7 @@ class ConsumeOperatorCopyableAddressesCheckerPass
for (auto *arg : fn->front().getSILFunctionArguments()) {
if (arg->getType().isAddress() &&
(arg->hasConvention(SILArgumentConvention::Indirect_In) ||
arg->hasConvention(SILArgumentConvention::Indirect_In_Guaranteed) ||
arg->hasConvention(SILArgumentConvention::Indirect_Inout)))
addressesToCheck.insert(arg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public func conditionalBadConsumingUseLoop2<T>(_ x: T) {

// This is ok, no uses after.
public func simpleMoveOfParameter<T>(_ x: T) -> () {
let _ = consume x // expected-error {{'consume' applied to value that the compiler does not support}}
let _ = consume x
}

public func simpleMoveOfOwnedParameter<T>(_ x: __owned T) -> () {
Expand Down Expand Up @@ -202,6 +202,26 @@ public func errorLoopMoveOfParameterNonConsume<T>(_ x: __owned T) -> () { // exp
}
}

func consumeConsuming<T>(_ k: consuming T) {
_ = consume k
}

func consumeBorrowing<T>(_ k: borrowing T) { // expected-error{{'k' is borrowed and cannot be consumed}}
_ = consume k // expected-note{{consumed here}}
}

func consumeOwned<T>(_ k: __owned T) {
_ = consume k
}

func consumeShared<T>(_ k: __shared T) {
_ = consume k
}

func consumeBare<T>(_ k: T) {
_ = consume k
}

////////////////////////
// Pattern Match Lets //
////////////////////////
Expand Down