mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
disable sink inference, only enable it for the stdlib. Reason: better source code compatibility (#15105)
This commit is contained in:
@@ -265,6 +265,10 @@ proc mydiv(a, b): int {.raises: [].} =
|
||||
- Removed the `--oldast` switch.
|
||||
- `$getType(untyped)` is now "untyped" instead of "expr", `$getType(typed)` is
|
||||
now "typed" instead of "stmt".
|
||||
- Sink inference is now disabled per default and has to enabled explicitly via
|
||||
`--sinkInference:on`. *Note*: For the standard library sink inference remains
|
||||
enabled. This change is most relevant for the `--gc:arc`, `--gc:orc` memory
|
||||
management modes.
|
||||
|
||||
|
||||
## Tool changes
|
||||
|
||||
@@ -373,7 +373,7 @@ const
|
||||
DefaultOptions* = {optObjCheck, optFieldCheck, optRangeCheck,
|
||||
optBoundsCheck, optOverflowCheck, optAssert, optWarns, optRefCheck,
|
||||
optHints, optStackTrace, optLineTrace, # consider adding `optStackTraceMsgs`
|
||||
optTrMacros, optStyleCheck, optSinkInference}
|
||||
optTrMacros, optStyleCheck}
|
||||
DefaultGlobalOptions* = {optThreadAnalysis,
|
||||
optExcessiveStackTrace, optListFullPaths}
|
||||
|
||||
|
||||
@@ -261,8 +261,14 @@ optimizations (and the current implementation does not).
|
||||
Sink parameter inference
|
||||
========================
|
||||
|
||||
The current implementation does a limited form of sink parameter
|
||||
inference. The `.nosinks`:idx: pragma can be used to disable this inference
|
||||
The current implementation can do a limited form of sink parameter
|
||||
inference. But it has to be enabled via `--sinkInference:on`, either
|
||||
on the command line or via a `push` pragma.
|
||||
|
||||
To enable it for a section of code, one can
|
||||
use `{.push sinkInference: on.}`...`{.pop.}`.
|
||||
|
||||
The `.nosinks`:idx: pragma can be used to disable this inference
|
||||
for a single routine:
|
||||
|
||||
.. code-block:: nim
|
||||
@@ -270,8 +276,6 @@ for a single routine:
|
||||
proc addX(x: T; child: T) {.nosinks.} =
|
||||
x.s.add child
|
||||
|
||||
To disable it for a section of code, one can
|
||||
use `{.push sinkInference: off.}`...`{.pop.}`.
|
||||
|
||||
The details of the inference algorithm are currently undocumented.
|
||||
|
||||
|
||||
@@ -48,3 +48,6 @@ when defined(nimlocks):
|
||||
{.pragma: benign, gcsafe, locks: 0.}
|
||||
else:
|
||||
{.pragma: benign, gcsafe.}
|
||||
|
||||
when defined(nimHasSinkInference):
|
||||
{.push sinkInference: on.}
|
||||
|
||||
1
tests/arc/nim.cfg
Normal file
1
tests/arc/nim.cfg
Normal file
@@ -0,0 +1 @@
|
||||
--sinkInference:on
|
||||
1
tests/destructor/nim.cfg
Normal file
1
tests/destructor/nim.cfg
Normal file
@@ -0,0 +1 @@
|
||||
--sinkInference:on
|
||||
Reference in New Issue
Block a user