Skip to content

Commit d25cd0b

Browse files
committed
Convert the noimplicitcopy addressonly fail test back to its original form.
For some reason in a previous commit, this started to work so I just added support. In this PR, it changed again and the test started to fail again. We are not shipping noimplicitcopy in 5.9, so I just changed the error message to the old "I don't understand" error message. I additionally looked at why the failure is occuring. The reason why is that the frontend emits an unchecked_ref_cast since currently the moveonlywrapper_to_copyable instruction does not accept addresses (even though it could) and the field sensitive liveness analysis does not know how to represent an unchecked_ref_cast (which is ok, since we would like it to be rejected).
1 parent e4cdc66 commit d25cd0b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/SILOptimizer/move_only_checker_addressonly_fail.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ struct GenericAggregate<T> {
1010
func test1<T>(_ x: T) {
1111
@_noImplicitCopy let x2 = x // expected-error {{@_noImplicitCopy can not be used on a generic or existential typed binding or a nominal type containing such typed things}}
1212

13-
consumeValue(x2) // expected-error {{'x2' has guaranteed ownership but was consumed}}
14-
// expected-note @-1 {{consuming use here}}
15-
consumeValue(x2) // expected-error {{'x2' has guaranteed ownership but was consumed}}
16-
// expected-note @-1 {{consuming use here}}
13+
// These fail b/c we use an unchecked_addr_cast to convert addresses from
14+
// @moveOnly to non-@moveOnly. We should change moveonly_to_copyable to
15+
// handle addresses as well.
16+
//
17+
// An earlier change, I believe made it so that SILGen did not emit these
18+
// unchecked_addr_cast.
19+
consumeValue(x2) // expected-error {{Usage of @noImplicitCopy that the move checker does not know how to check!}}
20+
consumeValue(x2) // expected-error {{Usage of @noImplicitCopy that the move checker does not know how to check!}}
1721
}

0 commit comments

Comments
 (0)