---
title: Deprecated implementation-only imports (ImplementationOnlyDeprecated)
framework: swift-compiler
role: article
role_heading: Article
path: swift-compiler/documentation/diagnostics/implementation-only-deprecated
---

# Deprecated implementation-only imports (ImplementationOnlyDeprecated)

Warnings that identify import declarations with the @_implementationOnly attribute.

## Overview

Overview When applied to import declarations, the compiler-internal attribute @_implementationOnly attempts prevents declarations from the imported module from being exposed in the ABI or public interface of the dependent module. This attribute became deprecated when support for access levels on import declarations was introduced with SE-0409: Access level on imports. One reason @_implementationOnly import is deprecated is that it is unsafe when used in modules that are built without Library evolution enabled. For example, suppose the following code were part of a library named Foo: // Library `Foo` @_implementationOnly import ImplementationDetail

public struct Bar {   internal var x: Baz // defined in ImplementationDetail } If Foo is not compiled with library evolution, then the memory layout of values of Bar must be known at compile time in clients of Foo. However, the @_implementationOnly import of ImplementationDetail prevents clients from being able to look up Baz which is a type that contributes to the layout of Foo. As a result, the layout of Foo will be miscalculated resulting in undefined behavior.

## See Also

### Related Documentation

- [SE-0409: Access level on imports](swift-compiler/documentation/swift-evolution/0409-access-level-on-imports.md)
- Library evolution

- [@dynamicCallable implementation requirements (DynamicCallable)](swift-compiler/documentation/diagnostics/dynamic-callable-requirements.md)
- [Add @preconcurrency import (AddPreconcurrencyImport)](swift-compiler/documentation/diagnostics/add-preconcurrency-import.md)
- [Always enabled availability domains (AlwaysAvailableDomain)](swift-compiler/documentation/diagnostics/always-available-domain.md)
- [Argument matching for trailing closures (TrailingClosureMatching)](swift-compiler/documentation/diagnostics/trailing-closure-matching.md)
- [Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)](swift-compiler/documentation/diagnostics/actor-isolated-mutating-async.md)
- [Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)](swift-compiler/documentation/diagnostics/actor-isolated-call.md)
- [Captures in a `@Sendable` closure (SendableClosureCaptures)](swift-compiler/documentation/diagnostics/sendable-closure-captures.md)
- [Compilation caching (CompilationCaching)](swift-compiler/documentation/diagnostics/compilation-caching.md)
- [Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)](swift-compiler/documentation/diagnostics/string-interpolation-conformance.md)
- [Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)](swift-compiler/documentation/diagnostics/conversion-from-isolated-any-to-synchronous.md)
- [Cross-isolation data race (RegionIsolationCrossIsolationDataRace)](swift-compiler/documentation/diagnostics/region-isolation-cross-isolation-data-race.md)
- [Deprecated declaration warnings (DeprecatedDeclaration)](swift-compiler/documentation/diagnostics/deprecated-declaration.md)
- [Dynamic exclusivity (DynamicExclusivity)](swift-compiler/documentation/diagnostics/dynamic-exclusivity.md)
- [Embedded Swift language restrictions (EmbeddedRestrictions)](swift-compiler/documentation/diagnostics/embedded-restrictions.md)
- [Existential Types and Performance (ExistentialType)](swift-compiler/documentation/diagnostics/existential-type.md)
