Skip to content

Commit 6dd3e49

Browse files
committed
AST: Re-baseline BuiltinEmplaceTypedThrows feature.
1 parent 69c13c3 commit 6dd3e49

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE(IsolatedAny, 431, "@isolated(any) fu
254254
LANGUAGE_FEATURE(IsolatedAny2, 431, "@isolated(any) function types")
255255
LANGUAGE_FEATURE(ObjCImplementation, 436, "@objc @implementation extensions")
256256
LANGUAGE_FEATURE(NonescapableTypes, 446, "Nonescapable types")
257-
LANGUAGE_FEATURE(BuiltinEmplaceTypedThrows, 0, "Builtin.emplace typed throws")
258257
SUPPRESSIBLE_LANGUAGE_FEATURE(MemorySafetyAttributes, 458, "@unsafe attribute")
259258
LANGUAGE_FEATURE(ValueGenerics, 452, "Value generics feature (integer generics)")
259+
BASELINE_LANGUAGE_FEATURE(BuiltinEmplaceTypedThrows, 0, "Builtin.emplace typed throws")
260260
LANGUAGE_FEATURE(RawIdentifiers, 451, "Raw identifiers")
261261
LANGUAGE_FEATURE(SendableCompletionHandlers, 463, "Objective-C completion handler parameters are imported as @Sendable")
262262
LANGUAGE_FEATURE(AsyncExecutionBehaviorAttributes, 0, "@concurrent and nonisolated(nonsending)")

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,6 @@ static bool usesFeatureCustomAvailability(Decl *decl) {
612612
return false;
613613
}
614614

615-
static bool usesFeatureBuiltinEmplaceTypedThrows(Decl *decl) {
616-
// Callers of 'Builtin.emplace' should explicitly guard the usage with #if.
617-
return false;
618-
}
619-
620615
static bool usesFeatureAsyncExecutionBehaviorAttributes(Decl *decl) {
621616
// Explicit `@concurrent` attribute on the declaration.
622617
if (decl->getAttrs().hasAttribute<ConcurrentAttr>())

stdlib/public/core/InlineArray.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ extension InlineArray where Element: ~Copyable {
215215
@available(SwiftStdlib 6.2, *)
216216
@_alwaysEmitIntoClient
217217
public init<E: Error>(_ body: (Index) throws(E) -> Element) throws(E) {
218-
#if $BuiltinEmplaceTypedThrows
219218
_storage = try Builtin.emplace { (rawPtr) throws(E) -> () in
220219
let buffer = unsafe Self._initializationBuffer(start: rawPtr)
221220

@@ -234,9 +233,6 @@ extension InlineArray where Element: ~Copyable {
234233
}
235234
}
236235
}
237-
#else
238-
fatalError()
239-
#endif
240236
}
241237

242238
/// Initializes every element in this array, by calling the given closure
@@ -264,7 +260,6 @@ extension InlineArray where Element: ~Copyable {
264260
first: consuming Element,
265261
next: (borrowing Element) throws(E) -> Element
266262
) throws(E) {
267-
#if $BuiltinEmplaceTypedThrows
268263
// FIXME: We should be able to mark 'Builtin.emplace' as '@once' or something
269264
// to give the compiler enough information to know we will only run
270265
// it once so it can consume the capture. For now, we use an optional
@@ -298,17 +293,13 @@ extension InlineArray where Element: ~Copyable {
298293
}
299294
}
300295
}
301-
#else
302-
fatalError()
303-
#endif
304296
}
305297

306298
@available(SwiftStdlib 6.2, *)
307299
@_alwaysEmitIntoClient
308300
public init<E: Error>(
309301
initializingWith initializer: (inout OutputSpan<Element>) throws(E) -> Void
310302
) throws(E) {
311-
#if $BuiltinEmplaceTypedThrows
312303
_storage = try Builtin.emplace { (rawPtr) throws(E) -> () in
313304
let buffer = unsafe Self._initializationBuffer(start: rawPtr)
314305
_internalInvariant(Self.count == buffer.count)
@@ -317,9 +308,6 @@ extension InlineArray where Element: ~Copyable {
317308
let initialized = unsafe output.finalize(for: buffer)
318309
_precondition(count == initialized, "InlineArray initialization underflow")
319310
}
320-
#else
321-
fatalError()
322-
#endif
323311
}
324312
}
325313

0 commit comments

Comments
 (0)