Add sink annotation to option some() (#18358)
This commit is contained in:
parent
8535b26a75
commit
f6bea08eac
1 changed files with 2 additions and 2 deletions
|
|
@ -92,7 +92,7 @@ type
|
||||||
UnpackDefect* = object of Defect
|
UnpackDefect* = object of Defect
|
||||||
UnpackError* {.deprecated: "See corresponding Defect".} = UnpackDefect
|
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.
|
## 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)`.
|
## 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:
|
when T isnot SomePointer:
|
||||||
result.has = true
|
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`.
|
## Returns an `Option` that has the value `val`.
|
||||||
##
|
##
|
||||||
## **See also:**
|
## **See also:**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue