1911 Commits

Author SHA1 Message Date
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
28a6c136e9
revert std.mem.span to prefer len over sentinel; add spanZ 2020-03-19 19:30:09 -04:00
Andrew Kelley
dc04e97098
Merge pull request #4752 from ziglang/slice-array
slicing with comptime start and end indexes results in pointer-to-array
2020-03-19 18:06:16 -04:00
Andrew Kelley
6b6f2fcf96
std.net: remove the hack from earlier in the branch 2020-03-19 15:09:52 -04:00
Andrew Kelley
f614d94faa
update std lib to take advantage of slicing with comptime indexes 2020-03-19 14:48:47 -04:00
Andrew Kelley
555a2c0328
(breaking) std.fs.copyFile now integrates with Dir
Removed:
 * `std.fs.updateFile`
 * `std.fs.updateFileMode`
 * `std.fs.copyFile`
 * `std.fs.copyFileMode`

Added:
 * `std.fs.Dir.copyFile`
 * `std.fs.copyFileAbsolute`
 * `std.fs.updateFileAbsolute`

Moved:
 * `std.fs.Dir.UpdateFileOptions` => `std.fs.CopyFileOptions`

Deprecated:
 * `std.fs.deleteDir`
 * `std.fs.deleteDirC`
 * `std.fs.deleteDirW`
 * `std.fs.readLink`
 * `std.fs.readLinkC`
2020-03-19 14:43:41 -04:00
Andrew Kelley
1d7861a36e
fix incorrect sentinel check 2020-03-19 13:18:14 -04:00
Andrew Kelley
61266d2621
test & docs fixups to work with new semantics 2020-03-19 09:53:55 -04:00
Andrew Kelley
7fa88cc0a6
std lib fixups for new semantics
std lib tests are passing now
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
8ea0a00f40
improve std lib code for the new semantics 2020-03-19 09:53:54 -04:00
Andrew Kelley
8d0ac6dc4d
@ptrCast supports casting a slice to pointer 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
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
Andrew Kelley
27affde592
(breaking) clarify openDir API
* remove deprecated `std.fs.Dir` APIs
 * `std.fs.Dir.openDir` now takes a options struct with bool fields for
   `access_sub_paths` and `iterate`. It's now much more clear how
   opening directories works.
 * fixed the std lib and various zig code calling the wrong openDir
   function.
 * the runtime safety check for dir flags is removed in favor of the
   cheaper option of putting a comment on the same line as handling
   EBADF / ACCESS_DENIED, since that will show up in stack traces.
2020-03-18 16:10:57 -04:00
LemonBoy
c45fe2759f
build: Fix silly bug in directory traversal 2020-03-18 13:45:52 -04:00
LemonBoy
e15605e1c1
std: Safety check for iterate()
Calling iterate() on a Dir object returned by openDirTraverse is always
an error.
2020-03-18 13:45:52 -04:00
LemonBoy
4843c3b4c3
std: Introduce fnctl wrapper 2020-03-18 13:45:52 -04:00
LemonBoy
11a4ce42c1
zig fmt: Respect trailing commas in error set declarations
The logic is not perfect as it doesn't take into account the presence of
doc comments, but it's an improvement over the status quo.
2020-03-18 11:15:22 -04:00
LemonBoy
013ada1b59 std: More type checks for Thread startFn return type
Closes #4756
2020-03-18 10:37:35 -04:00
Andrew Kelley
dbde5df568
clean up some self-hosted bitrot + don't assume libstdc++
closes #4682

The self-hosted compiler is still bit rotted and still not compiling
successfully yet. I have a more serious rework of the code in a
different branch.
2020-03-17 23:03:45 -04:00
LeRoyce Pearson
613956cc47 Remove fcntlFlock and replace with plain fcntl 2020-03-17 21:02:19 -06:00
LeRoyce Pearson
32c5825030 Match netbsd's flock fields with others 2020-03-17 20:54:38 -06:00
LeRoyce Pearson
b773a8b175 Make fcntlFlock follow conventions of os.zig 2020-03-17 20:53:43 -06:00
Jonathan Marler
7251eb1681 fix a couple sockfds to be fd_t rather than i32
Using i32 causes compile errors on Windows because it uses *c_void rather than i32 for it's fd_t type.
2020-03-17 12:46:07 -04:00
LeRoyce Pearson
4532f5ecad Change fcntl params to ?*c_void
As recommended by LemonBoy
2020-03-16 21:50:52 -06:00
Timon Kruiper
6a15d668ee Change the default stdin behavior of RunStep to .Inherit
This behaves the same as stdout and stderr behavior which also
default to .inherit. Also adds a field to RunStep to change the behavior.

Since this is a breaking change, previous behavior can be restored by doing:
`RunStep.stdin_behavior = .Ignore`.
2020-03-16 17:23:53 -04:00
LemonBoy
582991a5a8 build: Expose function-sections switch 2020-03-16 13:06:50 -04:00
Andrew Kelley
a2432b6755
Merge pull request #4735 from ziglang/renameat
zig build system: correctly handle multiple output artifacts
2020-03-15 17:28:12 -04:00
Andrew Kelley
a27a8561e9
adjust renameatW to always supply dest root dir
this fixes tests for wine
2020-03-15 17:26:29 -04:00
Andrew Kelley
7e45a3ef6a fix typo in new mem.len test 2020-03-15 15:57:51 -04:00
Andrew Kelley
e369789062 fix std.os.renameatW
Ask for DELETE access when opening the source file.

Additionally, when the source and dest dir are the same, pass null
for RootDirectory.
2020-03-15 15:47:42 -04:00
Andrew Kelley
6c2b23593b fix std.mem.span handling of sentinel-terminated arrays
previously this function would use the array length, but now it scans
the array looking for the first sentinel that occurs.
2020-03-15 15:46:56 -04:00
Andrew Kelley
701aaf0ddf
renameatW: handle more windows nt status codes 2020-03-15 14:46:09 -04:00
Andrew Kelley
0a69a10f2a
Merge pull request #4740 from Vexu/cleanup
Cleanup and a fix in self-hosted parser
2020-03-15 14:18:33 -04:00
momumi
880d8fc380 fix Serializer to work with new OutStream API 2020-03-15 14:17:16 -04: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
LeRoyce Pearson
819537d70a Skip file lock test in single threaded mode 2020-03-14 20:36:26 -06:00
LeRoyce Pearson
947abb7626 Fix compile error on windows 2020-03-14 17:13:46 -06:00
Vexu
57f9f07558
use anon literals in ast.zig and parse.zig 2020-03-15 01:11:58 +02:00
Vexu
5e5dee829d
remove .Cancel correct merge err set parsing 2020-03-15 01:02:33 +02:00
LeRoyce Pearson
49128c86f8 Extract run_lock_file_test 2020-03-14 15:31:54 -06:00
LeRoyce Pearson
7ab77685a8 Make lock tests more flexible 2020-03-14 14:57:56 -06:00
LeRoyce Pearson
873c7a59e9 Add multiple read lock test 2020-03-14 13:29:49 -06:00
LeRoyce Pearson
72eb9933fd Call std.os.waitpid instead of std.os.linux.waitpid 2020-03-14 11:34:38 -06:00
LeRoyce Pearson
43ccc2d81e Add note about mandatory locks on linux 2020-03-14 10:12:46 -06:00
LeRoyce Pearson
43c4faba55 Add test to check that locking works 2020-03-14 10:12:46 -06:00
LeRoyce Pearson
a636b59cb5 Add lock option to CreateFlags 2020-03-14 10:12:46 -06:00
LeRoyce Pearson
4eff48b12e Add flock command paramter to os.fcntlFlock
Also, replace `os.fcntlFlockBlocking` with `os.fcntlFlock`
2020-03-14 10:12:46 -06:00