mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Allow any declaration to be marked with `@unsafe`, meaning that it
involves unsafe code. This also extends to C declarations marked with
the `swift_attr("unsafe")` attribute.
Under a separate experimental flag (`DisallowUnsafe`), diagnose any
attempt to use an `@unsafe` declaration or any unsafe language feature
(such as `unowned(unsafe)`, `@unchecked Sendable`). This begins to
define a "safe" mode in Swift that prohibits memory-unsafe constructs.
6 lines
157 B
Swift
6 lines
157 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
@unsafe func f() { }
|
|
// expected-error@-1{{attribute requires '-enable-experimental-feature AllowUnsafeAttribute'}}
|
|
|