Commit Graph

8730 Commits

Author SHA1 Message Date
Timothee Cour
4742e6e1fd followup #16714: add -d:nimLegacyUnarySlice + changelog (#17794) 2021-04-20 00:25:28 -07:00
Timothee Cour
ad67bcf379 fix https://github.com/nim-lang/RFCs/issues/311 remove unary slice (#16714) 2021-04-19 19:02:52 -07:00
Clyybber
24abe10aa8 Small privateAccess improvement (#17786) 2021-04-19 17:51:00 +02:00
Clyybber
6de5aa1971 Rename = to =copy in stdlib (#17781) 2021-04-19 13:16:10 +02:00
flywind
dc89b21257 [std/locks]close #7998(complete condition variables) (#17711)
* close #7998
* workaround genode

* Update lib/system/syslocks.nim
2021-04-19 10:51:13 +02:00
flywind
cedbc7035d [std/locks]remove workaround for withLock (#17772)
Ref #6113 and #6049

The workaround for generics instantiation is unnecessary. It seems to be fixed by another PR I guess.

The test still works. So the changes should be harmless.
https://github.com/nim-lang/Nim/blob/devel/tests/stdlib/tlocks.nim

I also add some inline pragmas.
2021-04-19 10:33:56 +02:00
Juan Carlos
f8038af5ec Documentation only, dom (#17770)
* ReSync with Devel

* ReSync

* https://github.com/timotheecour/Nim/issues/674

* Update lib/js/dom.nim

Co-authored-by: flywind <xzsflywind@gmail.com>

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2021-04-19 07:42:38 +02:00
flywind
172a5ab7f8 [std/rlocks]add inline pragma (#17773)
so that it can be used as the base of new locks module with destructors.
2021-04-19 07:41:50 +02:00
Timothee Cour
0a10af5a2c privateAccess now works with ref | ptr (#17760) 2021-04-19 00:15:58 +02:00
Dankr4d
6916faf83c Fix #17755 (#17766)
Signed-off-by: Dankr4d <dude569@freenet.de>
2021-04-18 23:39:05 +02:00
Timothee Cour
42c6eec4ef fix #17749 ignore SIGPIPE signals, fix nim CI #17748 (#17752)
* fix #17749 SIGPIPE

* fix for windows
2021-04-18 15:34:29 +02:00
Andreas Rumpf
7b6ab5109f IC exposes typedesc implementation shenanigans (#17759)
* IC exposes typedesc implementation shenanigans; so I change system.default's definition to what it should have been to begin with
* Update lib/system.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-04-18 07:27:03 +02:00
shirleyquirk
c8b8cb8458 make cuchar alias uint8 instead of char (#17738) 2021-04-17 17:27:10 +02:00
flywind
5c5f356347 replace defer with try ... finally (#17753) 2021-04-17 11:48:22 +02:00
Timothee Cour
7e94420847 cString => cSourceString; tyCString => tyCstring so that error msgs show cstring, not cString (#17744) 2021-04-17 11:14:09 +02:00
shirleyquirk
fdd4391534 Fix buffer-overrun bug in net (#17728) [backport:1.0] 2021-04-16 14:22:51 +02:00
Timothee Cour
d19e4310dc std/hashes: hash(ref|ptr|pointer) + other improvements (#17731) 2021-04-16 14:21:26 +02:00
Timothee Cour
611b88763f start using import {.all.} (#17736) 2021-04-16 12:54:49 +02:00
Timothee Cour
8161b02897 import foo {.all.} reboot (#17706) 2021-04-16 09:16:39 +02:00
flywind
12783dbcf0 make the copy operation of Thread an error (#17734) 2021-04-16 08:50:44 +02:00
Tanguy Cizain
363467fc00 Fix array's high & low return type for empty arrays (#17705)
* fix array.high/low return type

* Add test for empty array low return type

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-04-15 15:45:38 +02:00
Clyybber
51a40c1f38 Fix getCustomPragmaVal for some multi arg pragmas (#17723)
* Fix getCustomPragmaVal for some multi arg pragmas

* Bootstrap fix
2021-04-15 13:55:50 +02:00
Andrey Makarov
f8dce493d3 rst indentation fixes (ref #17340) (#17715) 2021-04-15 08:12:44 +02:00
Timothee Cour
d6242d7fe1 simplify asyncfutures, asyncmacro (#17633) 2021-04-14 21:22:22 +02:00
Arne Döring
56c37759d6 getCustomPragma is split up in more usable chunks (#11526)
* getCustomPragma is split up in more usable chunks
* changelog entry
* fix for style checks
* shitty typedesc special casing
* Add since annotation and remove typedesc comments
* Fix typo
* Revert since annotation because it breaks bootstrapping
* Export getCustomPragmaNode conditionally
* Reduce code duplication
* Update since
* Update lib/core/macros.nim
* Apply suggestions from code review

Co-authored-by: Clyybber <darkmine956@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-04-14 20:42:09 +02:00
flywind
44657b78c4 callback cannot be nil (#17718)
`Task.callback` cannot be nil, we need to raise it at debug and release mode

Situations:
- if users create a Task object without using `toTask` and invoke the Task
- if users already move the Task and invoke the Task
2021-04-14 19:14:14 +02:00
flywind
58f44c8b4e Update channels.nim (#17717) 2021-04-14 16:45:22 +02:00
zah
3b47a689cf Remove the use of usrToCell in gcMark [backport:1.2] (#17709)
* Remove the use of usrToCell in gcMark [backport:1.2]

Recently, we've discovered a GC crash resulting from inlining of
the memory allocation procs that allowed the compiler to avoid
maintaining any references to the "user pointer" on the stack.
Instead, a "cell pointer" appeared there and all field accesses
were performed with adjusted offsets. This interfered with the
ability of the GC to mark the correct cell in the conservative
stack scans which lead to premature collection of objects.

More details here:
af69b3ceae

This commit closes another theoretical loophole that may lead to
the same problem. If a short proc is accessing both the object and
its reference count in a short sequence of instructions, the compiler
may be enticed to reduce the number of registers being used by storing
only a single pointer to the object and using offsets when reading
and writing fields. A perfectly good strategy would be to store only
the cell pointer, so the reference count updates can be performed
without applying offsets. Accessing the fields of the object requires
offsets anyway, but these can be adjusted at compile-time without any
loss. Following this strategy will lead to the same problem of marking
a wrong cell during the conservative stack scan, leading to premature
collection.

The problem is avoided by not using `usrToCell` in `gcMark`. Since
the cell discovery logic can already handle interior pointers, the
user pointers don't need to be adjusted for the GC to function correctly.
2021-04-14 12:10:01 +02:00
Timothee Cour
e92c78a9ac add number literal jsbigints.big (#17707) 2021-04-13 09:33:28 +02:00
flywind
8b5769133c remove unnecessary assignment (#17702) 2021-04-12 08:58:46 +02:00
shirleyquirk
0bc943ad54 followup strformat PR. backslash escapes, tests, docs (#17700)
* Allow use of colons inside fmt
allowing colons inside fmt by replacing the format specifier delimiter lets arbitrary nim code be run within fmt expressions.

Co-authored-by: flywind <xzsflywind@gmail.com>

* formatting,documentation,backslash escapes

Adding support for evaluating expressions by special-casing parentheses causes this regression: `&"""{ "(hello)" }"""` no longer parses.
In addition, code such as &"""{(if open: '(' else: ')')}""" wouldn't work.
To enable that, as well as the use of, e.g. Table constructors inside curlies, I've added backslash escapes.
This also means that if/for/etc statements, unparenthesized, will work, if the colons are escaped, but i've left that under-documented.

It's not exactly elegant having two types of escape, but I believe it's the least bad option.

* changelog
* added json strformat test
* pulled my thumb out and wrote a parser

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2021-04-12 07:32:37 +02:00
Araq
e710b9cf33 macrocache.nim: removed trailing whitespace 2021-04-11 20:14:44 +02:00
Timothee Cour
ceadf54d76 iterable[T] (#17196)
* fix failing test toSeq in manual which now works
* changelog
* reject proc fn(a: iterable)
* add iterable to spec
* remove MCS/UFCS limitation that now works
2021-04-11 14:25:41 +02:00
shirleyquirk
a5b30c94c2 [feature] add arbitrary code execution to strformat (#17694)
* changed parser to ignore ':' within parens
* Update strformat.nim
* Update lib/pure/strformat.nim

Co-authored-by: flywind <xzsflywind@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-04-11 13:07:23 +02:00
Andrey Makarov
2150cd1826 restyle RST option lists (#17637)
* WIP: restyle RST option lists

* apply similar style to Latex

* fix tests

* minor visual tweaks

* update tests

* remove leftover comments
2021-04-10 09:49:01 +02:00
Emery Hemingway
8aa5991bea Genode platform fixes (#17521)
* Genode: move dyncall failures to runtime

Do not use the "error" pragma to warn that dynamic library loading is
not implemented, print a message at runtime and exit.

* Genode: use stricter dataspace type in page allocator

* Genode: remove compiler configuration from nim.cfg

Self-hosting Nim is not supported on Genode and defining the
cross-compilation environment can be done externally.

* Genode: use new mutex API

* Genode: call nim_component_construct as a C procedure

* Genode: implement echo for NimStringV2
2021-04-09 16:29:10 +02:00
Andreas Rumpf
86a1dcf928 hashes: Made the runnableExample easier to understand (#17689) 2021-04-09 15:36:06 +02:00
flywind
f25243140b add std/tasks (#17447) 2021-04-09 11:51:51 +02:00
konsumlamm
e4b64eee89 Fix small typos (#17680) 2021-04-09 00:40:19 +02:00
konsumlamm
6ec55ebf48 Fix rst typo (#17671) 2021-04-08 20:29:11 +02:00
konsumlamm
9f0f477552 Update sysrand documentation (#17676)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-04-08 12:41:43 -05:00
Andrey Makarov
42687457b0 further progress on rst roles & directives (fix #17646) (#17659)
* further progress on rst roles & dir-s (fix #17646)

* fix documents according to the messages

* fix bug 17 from #17340
2021-04-08 19:00:14 +02:00
konsumlamm
1b03accac7 Improve endians module (#17674)
Extend documentation
Add runnableExamples
2021-04-08 14:08:58 +02:00
Andreas Rumpf
643dbc743b use strstr for a faster find implementation (#17672)
* use strstr for a faster find implementation
* stress the -d:release and -d:danger switches
2021-04-08 00:54:47 +02:00
Andreas Rumpf
bd7807de4c fixes #17647 (#17667) 2021-04-07 23:26:53 +02:00
flywind
834d5641e8 use sink and lent in deques (#17661)
* use sink and lent in deques

* Update lib/pure/collections/deques.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-04-07 14:17:48 +02:00
Andreas Rumpf
939df8cbda ensure the avr example keeps compiling (#17663)
* ensure the avr example keeps compiling

* Update tests/avr/thello.nim

* now compiles properly
2021-04-07 13:40:57 +02:00
flywind
34c1c631bb close #4451 (#17627) 2021-04-06 22:08:59 +02:00
Miran
020c0a3344 don't run one example on 32-bit machines (#17655)
This example seems to break our 32-bit nightlies builds.

This is just a temporary solution (TM) until we figure out a better one.
2021-04-06 18:52:12 +02:00
flywind
c7b4639460 ref #14873 (#17644)
* ref #14873

* comment

* Update lib/core/locks.nim
2021-04-06 16:21:58 +02:00