mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
- While an opaque borrow access occurs to part of a value, the entire scope of the access needs to be treated as a liveness range, so add the `EndAccess`es to the liveness range. - The SIL verifier may crash the compiler on SILGen-generated code when the developer's source contains consume-during-borrow code patterns. Allow `load_borrow` instructions to be marked `[unchecked]`, which suppresses verifier checks until the move checker runs and gets a chance to properly diagnose these errors. Fixes rdar://124360175.
16 lines
359 B
Swift
16 lines
359 B
Swift
// RUN: %target-swift-frontend -emit-sil -verify %s
|
|
|
|
func foo(x: consuming Foo) { // expected-error{{'x' used after consume}}
|
|
x.bar.foo(x) // expected-error{{overlapping accesses to 'x'}} expected-note 3 {{}}
|
|
}
|
|
|
|
struct Foo: ~Copyable {
|
|
var bar: Bar {
|
|
_read { fatalError() }
|
|
}
|
|
}
|
|
|
|
struct Bar: ~Copyable {
|
|
func foo(_: consuming Foo) {}
|
|
}
|