Commit Graph

2317 Commits

Author SHA1 Message Date
Andrew Kelley 2e806682f4 (breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.

Also for consistency with ArrayList,
 * `append` => `appendSlice`
 * `appendByte` => `append`

Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Michael Dusan e3d12471a2 add compile-error test for #2687
Issue fixed by an unknown commit.

closes #2687
2020-03-31 20:08:00 -04:00
Andrew Kelley 47a0e3ec5e Merge pull request #4871 from boothby/issue4769
Address bugs when //, /// or //! are immediately followed by EOF
2020-03-31 10:56:21 -04:00
Kelly Boothby 44aadaff59 added unit tests to demonstrate #4769 and related bugs 2020-03-30 18:29:48 -07:00
Andrew Kelley 9e7ae06249 std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Andrew Kelley b980568c81 add peer type resolution for mixed-const []T and *[N]T
closes #4766

This commit also fixes the implementation of some utility functions for
adjusting properties of pointer types. Previously these functions would
incorrectly drop vector, sentinel, and inference metadata.
2020-03-30 13:02:50 -04:00
LemonBoy c1cc1ebc35 ir: Avoid constant-folding ptr to sentinels
Constant-folding the pointers to the expected sentinel value have some
big problems: it hides the real content of the array, makes the pointer
to the sentinel point to a completely different memory region and treats
it like a const value even when the underlying array is mutable.

Fixes #4840
2020-03-30 11:03:56 -04:00
Andrew Kelley c70471fae6 enable now-passing test cases
These can now be enabled thanks to bug fixes that landed in
LLVM 10.
2020-03-29 10:34:12 -04:00
Layne Gustafson a55897106e Add macro string concat tests 2020-03-28 20:40:26 -04:00
LemonBoy d788b0cd8b std: Minor changes to TLS handling
* Always allocate an info block per-thread so that libc can store
  important stuff there.
* Respect ABI-mandated alignment in more places.
* Nicer code, use slices/pointers instead of raw addresses whenever
  possible.
2020-03-28 11:20:38 -04:00
Andrew Kelley ab20b351ce update compile error tests 2020-03-26 14:07:19 -04:00
Andrew Kelley ddd98a7f10 prevent ptr cast from forcing alignment resolution unnecessarily 2020-03-26 12:34:16 -04:00
Andrew Kelley 93c7fa105f Merge remote-tracking branch 'origin/llvm10'
LLVM 10 was released today
2020-03-24 09:57:09 -04:00
LemonBoy 0cd953d40e ir: Prevent crash when slicing hardcoded pointer
Closes #4780
2020-03-23 09:13:52 -04:00
Andrew Kelley 13d04f9963 Merge pull request #4741 from momumi/master
allow `_` separators in number literals (stage 1)
2020-03-23 00:54:54 -04:00
Andrew Kelley e5e5196d8e Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 20:48:21 -04:00
LemonBoy 6a89751025 ir: Implement cast from anon struct to union 2020-03-22 19:06:22 -04:00
Andrew Kelley 3bded9cf29 disable failing stack trace test for aarch64 2020-03-22 18:54:19 -04:00
Andrew Kelley 380c276deb ci: disable qemu-riscv64 tests due to qemu being too old 2020-03-22 17:36:58 -04:00
Andrew Kelley 87b8b69eb0 update stack trace test expected output 2020-03-22 17:07:24 -04:00
Andrew Kelley 23c263776c Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 15:09:29 -04:00
LemonBoy dc79f181a5 ir: Disallow comparison between enum literal and untagged enum
Closes #4770
2020-03-21 20:54:05 -04:00
LemonBoy 28dbc58837 Address review comments 2020-03-21 09:54:49 +01:00
LemonBoy 128e70ff3a ir: Allow errdefer with payload
Closes #1265
2020-03-21 09:54:49 +01:00
Andrew Kelley 3a2c490889 "generate .h files" feature is no longer supported in stage1 2020-03-20 18:33:36 -04:00
LemonBoy 541e763010 ir: Peer type resolution between ?[]T and *[N]T
Closes #4767
2020-03-20 12:23:05 -04:00
Andrew Kelley 53b5aa812b Merge remote-tracking branch 'origin/master' into llvm10 2020-03-19 22:19:24 -04:00
Andrew Kelley 160367e0dd fix compile error for reading past end of pointer casted array 2020-03-19 17:23:53 -04:00
Andrew Kelley 8ddf9d84ff add behavior tests for slicing with comptime indexes 2020-03-19 11:17:46 -04:00
Andrew Kelley f824658e13 slicing sentinel-terminated slice without end
now results in a sentinel-terminated slice.
2020-03-19 10:54:20 -04:00
Andrew Kelley 61266d2621 test & docs fixups to work with new semantics 2020-03-19 09:53:55 -04:00
Andrew Kelley b5dba702ff fixes to std.meta
behavior tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley 2164b511cc partial revert of an improvement this branch made
because it uncovered a result location bug, and I need to get this
branch merged before going into a result location rabbit hole.

also fix the result type of slicing when the indexes are runtime known
and the result should be sentinel terminated.
2020-03-19 09:53:55 -04:00
Andrew Kelley 2b4134459d fix alignment when slicing with comptime start and end index 2020-03-19 09:53:54 -04:00
Andrew Kelley 0707be8de8 fixes in semantic analysis needed to support this feature 2020-03-19 09:53:54 -04:00
LemonBoy e3c92d0532 ir: More changes to sentinel-terminated const arrays
* Don't add an extra slot for the sentinel. Most of the code keeps using
  the constant value from the type descriptor, let's harmonize all the
  code dealing with sentinels.

* Properly write out sentinel values when reinterpreting pointers at
  comptime.

* Allow the reading of the 0th element in a `[0:S]T` type.
2020-03-19 09:53:30 -04:00
Andrew Kelley 46ffc798b6 fix swapped logic for Windows
Remove `std.fs.deleteTree`. Callers instead should use
`std.fs.cwd().deleteTree`.

Add `std.fs.deleteTreeAbsolute` for when the caller has an absolute
path.
2020-03-18 16:42:47 -04:00
LemonBoy 1479c28b49 ir: Correct ABI size calculation for arrays
Zero-length array with a sentinel may not have zero size.

Closes #4749
2020-03-18 11:10:45 -04:00
momumi 47f7e66580 add more test cases for invalid number literals 2020-03-15 23:42:29 +10:00
momumi 925f710852 make parsing 0.0_e1 an error 2020-03-15 13:05:24 +10:00
momumi 7aac21c6f5 allow _ separators in number literals (stage 1)
* Underscores `_` may be placed between two digits in a int/float literal
* Consecutive underscores are not allowed
* Fixed parsing bug in exponents of hexadecimal float literals.
  Exponents should always be base 10, but hex characters would be parsed
  inside the exponent and everything after them would be ignored. eg:
  `0x1.0p1ab1` would be parsed as `0x1.0p1`.
2020-03-15 12:38:35 +10:00
Andrew Kelley 75bda408cd update stack traces test expectations 2020-03-13 17:50:29 -04:00
Andrew Kelley 656ba530d8 Merge remote-tracking branch 'origin/master' into llvm10 2020-03-13 15:17:53 -04:00
Andrew Kelley f51bec321b Merge pull request #4707 from Vexu/small-atomics
Support atomic operations with bools and non power of two integers
2020-03-12 18:55:16 -04:00
Vexu 71d776c3be add note to disabled tests, improve comptime cmpxchg 2020-03-12 22:42:01 +02:00
Vexu 6dde769279 Simplify stores, use sext for signed ints 2020-03-12 22:02:58 +02:00
Vexu ce19638cd4 disable test on mipsel 2020-03-12 17:31:10 +02:00
Vexu 02c491e42a translate-c fix order of tokens 2020-03-12 17:14:01 +02:00
Vexu 710b05b153 support @atomicRmw at comptime 2020-03-12 16:46:16 +02:00
Vexu dda711ba0d translate-c treat c bools as ints 2020-03-12 14:40:47 +02:00