Skip to content

Commit d516750

Browse files
yaahcteor2345
andauthored
Update text/0000-dyno.md
Co-authored-by: teor <[email protected]>
1 parent f8626e1 commit d516750

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/0000-dyno.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Each of these approaches has significant downsides: adding methods to traits lea
258258

259259
`provide_any` could be a module inside `any` rather than a sibling (it could then be renamed to `provide` or `provider`).
260260

261-
There are numerous ways to tweak the API of a module like `provide_any`. The dyno and object-provider crates provide two such examples. There are many others, for example providing more patterns of types without requiring tags, not providing any common type patterns (i.e., always requiring tags), not exposing tags at all, etc.
261+
There are numerous ways to tweak the API of a module like `provide_any`. The `dyno` and `object-provider` crates provide two such examples. There are many others, for example providing more patterns of types without requiring tags, not providing any common type patterns (i.e., always requiring tags), not exposing tags at all, etc.
262262

263263
One hazard that must be avoided with such tweaks is that the API must distinguish between reference types with a `'static` lifetime and value types (with no lifetimes), either by using type tags or by having separate mechanisms for handling references and values. If this is done improperly, the API could be unsound. As an example, consider an API which lets an object provide a reference with type `&'a str` (where `'a` is the lifetime of some local scope), then a caller requests an object of type `&'static str` using an API designed for values (possible because that type satisfies the `'static` bound). Without some care, it is possible for the two types to be confused (because the lifetime is not reflected in the type tag or `TypeId`) and for the `&'a str` to be returned with the wrong lifetime. I believe this is not possible in the current proposal, but was possible in an earlier, more ergonomic iteration.
264264

0 commit comments

Comments
 (0)