Markdown code blocks part 5 (#20236)

No logic was added, just a few more `*.md` files have been migrated.
This commit is contained in:
Andrey Makarov 2022-08-17 22:20:22 +03:00 • committed by GitHub
commit 1c31de361d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 486 additions and 413 deletions

View file

@ -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