Skip to content

Commit

Permalink
Add sink annotation to option some() (nim-lang#18358)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomc1998 authored Jun 25, 2021
1 parent 8535b26 commit f6bea08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pure/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)`.
##
Expand All @@ -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:**
Expand Down

0 comments on commit f6bea08

Please sign in to comment.