provide better error messages for large set (#20207)

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
ringabout
2022-08-25 06:49:52 +08:00
committed by GitHub
parent d143924ab2
commit 404e91ce48
2 changed files with 8 additions and 4 deletions

View File

@@ -13,9 +13,13 @@ range `0 .. MaxSetElements-1` where `MaxSetElements` is currently always
The reason is that sets are implemented as high performance bit vectors.
Attempting to declare a set with a larger type will result in an error:
```nim
var s: set[int64] # Error: set is too large
```
```nim
var s: set[int64] # Error: set is too large; use `std/sets` for ordinal types
# with more than 2^16 elements
```
**Note:** Nim also offers `hash sets <sets.html>`_ (which you need to import
with `import sets`), which have no such restrictions.