Files
swift-mirror/test/Sema/manualownership_attr.swift
Kavon Farvardin 2d881bdc9c ManualOwnership: provide ability to apply to entire compilation unit
With this patch, I'm flipping the polarity of things.

The flag `-enable-experimental-feature ManualOwnership` now turns on the diagnostics,
but they're all silenced by default. So, you need to add -Wwarning or -Werror to
your build settings to turn on the specific diagnostics you care about.

These are the diagnostic groups relevant to the feature:

- SemanticCopies aka "explicit copies mode"
- DynamicExclusivity

For example, the build setting `-Werror SemanticCopies` now gives you errors about
explicit copies, just as before, but now you can make them just warnings with -Wwarning.

To opt-out a declaration from everything when using the feature, use @_noManualOwnership.

@_manualOwnership is no longer an attribute as a result.

resolves rdar://163372569
2025-10-24 18:54:07 -07:00

14 lines
404 B
Swift

// RUN: %target-typecheck-verify-swift \
// RUN: -enable-experimental-feature NoImplicitCopy \
// RUN: -enable-experimental-feature ManualOwnership
// REQUIRES: swift_feature_ManualOwnership
// REQUIRES: swift_feature_NoImplicitCopy
class C {}
func hello() -> (C, C) {
@_noImplicitCopy let x = C() // expected-error {{'@_noImplicitCopy' cannot be used with ManualOwnership}}
return (x, x)
}