Markdown code blocks part 5 (#20236)
No logic was added, just a few more `*.md` files have been migrated.
This commit is contained in:
parent
60f6724b70
commit
1c31de361d
21 changed files with 486 additions and 413 deletions
|
|
@ -6,7 +6,7 @@ rule: If `result` does not refer to a location pointing to the heap
|
|||
(that is in `result = X` the `X` involves a `ptr` or `ref` access)
|
||||
then it has to be derived from the routine's first parameter:
|
||||
|
||||
.. code-block:: nim
|
||||
```nim
|
||||
proc forward[T](x: var T): var T =
|
||||
result = x # ok, derived from the first parameter.
|
||||
|
||||
|
|
@ -17,6 +17,7 @@ then it has to be derived from the routine's first parameter:
|
|||
result = forward(x) # Error: location is derived from `x`
|
||||
# which is not p's first parameter and lives
|
||||
# on the stack.
|
||||
```
|
||||
|
||||
In other words, the lifetime of what `result` points to is attached to the
|
||||
lifetime of the first parameter and that is enough knowledge to verify
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue