diff options
author | tomc1998 <thomascheng1998@googlemail.com> | 2021-06-25 21:06:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-25 22:06:24 +0200 |
commit | f6bea08eac7938e460ca9088693f0cf3f274e75b (patch) | |
tree | a191325929e83bfb071b4007a19e1a8f2488ff2f /lib/pure/options.nim | |
parent | 8535b26a754b2daea46627019e3145d7c12d826e (diff) | |
download | Nim-f6bea08eac7938e460ca9088693f0cf3f274e75b.tar.gz |
Add sink annotation to option some() (#18358)
Diffstat (limited to 'lib/pure/options.nim')
-rw-r--r-- | lib/pure/options.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/options.nim b/lib/pure/options.nim index bd5aa389e..850bfa555 100644 --- a/lib/pure/options.nim +++ b/lib/pure/options.nim @@ -92,7 +92,7 @@ type UnpackDefect* = object of Defect UnpackError* {.deprecated: "See corresponding Defect".} = UnpackDefect -proc option*[T](val: T): Option[T] {.inline.} = +proc option*[T](val: sink T): Option[T] {.inline.} = ## Can be used to convert a pointer type (`ptr`, `pointer`, `ref` or `proc`) to an option type. ## It converts `nil` to `none(T)`. When `T` is no pointer type, this is equivalent to `some(val)`. ## @@ -112,7 +112,7 @@ proc option*[T](val: T): Option[T] {.inline.} = when T isnot SomePointer: result.has = true -proc some*[T](val: T): Option[T] {.inline.} = +proc some*[T](val: sink T): Option[T] {.inline.} = ## Returns an `Option` that has the value `val`. ## ## **See also:** |