blob: d84d3e042d5033b404d289c31976ae204b884e2a [file] [log] [blame] [view]
## fi-0110: Resource containing types must be marked resource {:#fi-0110}
A type that includes a handle, either directly or through the transitive
inclusion of another handle-containing type, cannot be declared without that
type being specified as a `resource`:
{% include "docs/reference/fidl/language/error-catalog/label/_bad.md" %}
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0110.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
There are two possible solutions. The first is to annotate the offending
declaration with the resource modifier:
{% include "docs/reference/fidl/language/error-catalog/label/_good.md" %}
<!-- TODO(https://fxbug.dev/42061249): Improve example quality. -->
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0110-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
Alternatively, one could opt to remove the `resource`-including type completely,
thereby obviating the need for the modifier on the owning declaration:
{% include "docs/reference/fidl/language/error-catalog/label/_good.md" %}
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0110-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
The reasoning and motivations behind the addition of the `resource` modifier and
the "infectious" nature of the usage pattern enforced by this error can be found
in [RFC-0057: Default no handles][rfc-0057].
[rfc-0057]: /docs/contribute/governance/rfcs/0057_default_no_handles.md