Skip to content

Commit dde5ded

Browse files
committed
Add the StrictMemorySafety feature to indicate when -strict-memory-safety is enabled
1 parent 92c2c9a commit dde5ded

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

proposals/nnnn-strict-memory-safety.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Authors: [Doug Gregor](https://github.com/DougGregor)
55
* Review Manager: TBD
66
* Status: **Awaiting review**
7+
* Feature name: `StrictMemorySafety`
78
* Vision: [Opt-in Strict Memory Safety Checking (Prospective)](https://github.com/swiftlang/swift-evolution/pull/2581)
89
* Implementation: On main with experimental feature flags `AllowUnsafeAttribute` and `WarnUnsafe`
910
* Review: ([pitch](https://forums.swift.org/t/pitch-opt-in-strict-memory-safety-checking/76689))
@@ -42,7 +43,7 @@ For example, Swift solves null references with optional types. Statically, Swift
4243

4344
This proposal introduces an opt-in strict memory safety checking mode that identifies all uses of unsafe behavior within the given module. There are several parts to this change:
4445

45-
* A compiler flag `-strict-memory-safety` that enables warnings for all uses of unsafe constructs within a given module. All warnings will be in the diagnostic group `Unsafe`, enabling precise control over memory-safety-related warnings per [SE-0443](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0443-warning-control-flags.md).
46+
* A compiler flag `-strict-memory-safety` that enables warnings for all uses of unsafe constructs within a given module. All warnings will be in the diagnostic group `Unsafe`, enabling precise control over memory-safety-related warnings per [SE-0443](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0443-warning-control-flags.md). When strict memory safety is enabled, the `StrictMemorySafety` feature will be set: `#if hasFeature(StrictMemorySafety)` can be used to detect when Swift code is being compiled in this mode.
4647
* An attribute `@unsafe` that indicates that a declaration is unsafe to use. Such declarations may use unsafe constructs within their signatures.
4748
* An `unsafe` expression that marks any use of unsafe constructs in an expression, much like `try` and `await`.
4849
* Standard library annotations to identify unsafe declarations.

0 commit comments

Comments
 (0)