Skip to content

Commit 3e49b37

Browse files
authored
Rename @_fixed_layout to @frozen for structs and enums. (#25433)
1 parent 9319fce commit 3e49b37

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

stdlib/public/Python/Python.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ final class PyReference {
8686
/// a Python C API `PyObject`.
8787
@dynamicCallable
8888
@dynamicMemberLookup
89-
@_fixed_layout
89+
@frozen
9090
public struct PythonObject {
9191
/// The underlying `PyReference`.
9292
fileprivate var reference: PyReference
@@ -207,7 +207,7 @@ public extension PythonObject {
207207
}
208208

209209
/// An error produced by a failable Python operation.
210-
@_frozen
210+
@frozen
211211
public enum PythonError : Error, Equatable {
212212
/// A Python runtime exception, produced by calling a Python function.
213213
case exception(PythonObject, traceback: PythonObject?)
@@ -270,7 +270,7 @@ private func throwPythonErrorIfPresent() throws {
270270
/// `@dynamicCallable` attribute because the call syntax is unintuitive:
271271
/// `x.throwing(arg1, arg2, ...)`. The methods will still be named
272272
/// `dynamicallyCall` until further discussion/design.
273-
@_fixed_layout
273+
@frozen
274274
public struct ThrowingPythonObject {
275275
private var base: PythonObject
276276

@@ -417,7 +417,7 @@ public extension PythonObject {
417417
/// Member access operations return an `Optional` result. When member access
418418
/// fails, `nil` is returned.
419419
@dynamicMemberLookup
420-
@_fixed_layout
420+
@frozen
421421
public struct CheckingPythonObject {
422422
/// The underlying `PythonObject`.
423423
private var base: PythonObject
@@ -646,7 +646,7 @@ public let Python = PythonInterface()
646646
/// - Note: It is not intended for `PythonInterface` to be initialized
647647
/// directly. Instead, please use the global instance of `PythonInterface`
648648
/// called `Python`.
649-
@_fixed_layout
649+
@frozen
650650
@dynamicMemberLookup
651651
public struct PythonInterface {
652652
/// A dictionary of the Python builtins.

stdlib/public/core/Array.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,15 +1916,15 @@ internal struct _ArrayAnyHashableBox<Element: Hashable>
19161916
extension Array where Element : Differentiable {
19171917
/// The view of an array as the differentiable product manifold of `Element`
19181918
/// multiplied with itself `count` times.
1919-
@_fixed_layout
1919+
@frozen
19201920
public struct DifferentiableView : Differentiable {
19211921
private var _base: [Element]
19221922

19231923
/// The viewed array.
19241924
// I'm implementing this as a computed property instead of directly
19251925
// exposing `_base` because the `@differentiable` annotation does not make
19261926
// the stored property actually differentiable. I think this is a bug.
1927-
// Maybe it's related to `@_fixed_layout`?
1927+
// Maybe it's related to `@frozen`?
19281928
// TODO: Determine if that is a bug, and fix.
19291929
public var base: [Element] {
19301930
@differentiable(wrt: self, vjp: _vjpBase)

stdlib/public/core/AutoDiff.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ public struct AnyDerivative : Differentiable & AdditiveArithmetic {
619619
// `AdditiveArithmetic` requirements.
620620

621621
/// Internal struct representing an opaque zero value.
622-
@_fixed_layout
622+
@frozen
623623
@usableFromInline
624624
internal struct OpaqueZero : Differentiable & AdditiveArithmetic {}
625625

test/AutoDiff/refcounting.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class NonTrivialStuff : Equatable {
55
public static func == (lhs: NonTrivialStuff, rhs: NonTrivialStuff) -> Bool { return true }
66
}
77

8-
@_fixed_layout
8+
@frozen
99
public struct Vector : AdditiveArithmetic, VectorProtocol, Differentiable, Equatable {
1010
public var x: Float
1111
public var y: Float

test/AutoDiff/simple_real_vector.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -emit-silgen %s | %FileCheck %s
22

3-
@_fixed_layout
3+
@frozen
44
public struct Vector : AdditiveArithmetic, VectorProtocol, Differentiable {
55
public var x: Float
66
public var y: Float
@@ -54,7 +54,7 @@ public func test1() -> Vector {
5454
// Should pass verification.
5555
@_fixed_layout
5656
public class NonTrivial {}
57-
@_fixed_layout
57+
@frozen
5858
public struct TF189: Differentiable {
5959
@noDerivative public let x: Double
6060
@noDerivative public let nonTrivial: NonTrivial

0 commit comments

Comments
 (0)