Commit Graph

19168 Commits

Author SHA1 Message Date
bors
9e1e152091 auto merge of #8596 : vadimcn/rust/master, r=alexcrichton
This resolves issue #908.  

Notable changes:
-  On Windows, LLVM integrated assembler emits bad stack unwind tables when segmented stacks are enabled.  However, unwind info directives in the assembly output are correct, so we generate assembly first and then run it through an external assembler, just like it is already done for Android builds.

- Linker is invoked  via "g++" command instead of "gcc": g++ passes the appropriate magic parameters to the linker, which ensure correct registration of stack unwind tables in dynamic libraries.
2013-08-22 21:06:25 -07:00
Vadim Chugunov
651f38258d Disabled broken tests in std::vec. 2013-08-22 20:02:20 -07:00
Vadim Chugunov
12ecdb6381 Enabled unit tests in std and extra. 2013-08-22 20:02:20 -07:00
bors
95c542e7fe auto merge of #8655 : olsonjeffery/rust/newrt_file_io, r=pcwalton,brson
This PR includes the addition of the essential CRUD functionality exposed as a part of the `uv_fs_*` api. There's a lot more to be done, but the essential abstractions are in place and can be easily expanded.

A summary:

* `rt::io::file::FileStream` is fleshed out and behaves as a *non-positional* file stream (that is, it has a cursor that can be viewed/changed via `tell` and `seek`
* The underlying abstraction in `RtioFileStream` exposes pairs of `read(), write()` and `pread(), pwrite()`. The latter two take explicit `offset` params and don't respect the current cursor location in a file afaik. They both use the same underlying libuv impl
* Because libuv explicitly does *not* support `seek`/`tell` operations, these are impl'd in `UvFileStream` by using `lseek(2)` on the raw file descriptor.
* I did my best to flesh out and adhere to the stubbing that was already present in `rt::io::file` and the tests should back that up. There may be things missing.
* All of the work to test `seek`/`tell` is done in `rt::io::file`, even though the actual impl is down in `rt::uv::uvio`.
* We have the ability to spin up an `~RtioFileStream` from a raw file descriptor. This would be useful for interacting with stdin and stdout via newrt.
* The lowest level abstractions (in `rt::uv::file`) support fully synchronous/blocking interactions with the uv API and there is a CRUD test using it. This may also be useful for blocking printf, if desired (the default would be non-blocking and uses libuv's io threadpool)

There are a few polish things I need to do still (the foremost that I know of is undefined behavior when seek'ing beyond the file's boundary).

After this lands, I want to move on to mapping more of the `uv_fs_*` API (especially `uv_fs_stat`). Also a few people have mentioned interest in `uv_pipe_t` support. I'm open to suggestions.
2013-08-22 18:36:28 -07:00
Jeff Olson
b7cbd8a8fd fix 32bit mac build error 2013-08-22 17:26:02 -07:00
bors
23bfa600a0 auto merge of #8659 : msullivan/rust/default-methods, r=alexcrichton 2013-08-22 17:21:29 -07:00
Jeff Olson
744c46225e make check appeasement 2013-08-22 16:33:59 -07:00
Jeff Olson
8d997fba1a std: put FileMode/Access->whence-mask in uvio, open/unlink as fns in file:: 2013-08-22 16:31:58 -07:00
Jeff Olson
6311856bf4 std: slight refactor on UvFilestream seek behavior, pre-seek-refactor 2013-08-22 16:31:58 -07:00
Jeff Olson
94b84a851c std: all of the calls in rt::uv::file take a &Loop 2013-08-22 16:31:58 -07:00
Jeff Olson
f01e265357 std: moved static file actions (open,unlink) to FsRequest 2013-08-22 16:31:58 -07:00
Jeff Olson
f85d3b3ec1 std: reform fn sigs of FileDescriptor methods (better result signalling) 2013-08-22 16:31:58 -07:00
Jeff Olson
429b5f88f9 std: rename tmp file paths to go into ./tmp folder in builddir 2013-08-22 16:31:58 -07:00
Jeff Olson
13eb259a09 change FileDescriptor instance methods to use &mut self 2013-08-22 16:31:58 -07:00
Jeff Olson
ece709f172 std: more seek tests 2013-08-22 16:31:58 -07:00
Jeff Olson
320ccbeb53 std: naive stdio print test in uvio 2013-08-22 16:31:58 -07:00
Jeff Olson
c0fba3c4ac rt: re-adding lines erroneous stripped out in merge conflict 2013-08-22 16:31:58 -07:00
Jeff Olson
10ff5355b3 std: UvFileStream implements HomingIO + .home_for_io() wrapper usage 2013-08-22 16:31:58 -07:00
Jeff Olson
c3a819b01c std: writing to stdout only works when using -1 offset.. 2013-08-22 16:31:58 -07:00
Jeff Olson
a7ee85b50b std: stripping unneeded fcntl.h include from rust_uv.cpp 2013-08-22 16:31:58 -07:00
Jeff Olson
0e9964189d std: lint appeasement for unused param in condition handler 2013-08-22 16:31:58 -07:00
Jeff Olson
05c8cc70c9 std: rework file io.. support [p]read,[p]write, impl seek/tell + more tests 2013-08-22 16:31:57 -07:00
Jeff Olson
48d6761028 std: adding #[fixed_stack_segment] as needed in new uvll calls 2013-08-22 16:31:57 -07:00
Jeff Olson
4015b4a9b4 std: add FileStream::unlink + more tests 2013-08-22 16:31:57 -07:00
Jeff Olson
f6d897d7d9 std: rt::io::file::FileStream fleshed out.. needs more work.. see extended
- change all uses of Path in fn args to &P
- FileStream.read assumptions were wrong (libuv file io is non-positional)
- the above will mean that we "own" Seek impl info .. should probably
  push it in UvFileDescriptor..
- needs more tests
2013-08-22 16:31:57 -07:00
Jeff Olson
47f0e91689 std: CRUD file io bindings in uvio, fs_open()/unlink() in IoFactory + test 2013-08-22 16:31:57 -07:00
Jeff Olson
f60bd75f4d std: remove fcntl const bindings + making valgrind clean w/ no owned vecs 2013-08-22 16:31:57 -07:00
Jeff Olson
e0a80ee332 std: support async/threadpool & sync paths in uv_fs_* calls + add sync test 2013-08-22 16:31:57 -07:00
Jeff Olson
c49c2921b0 std: add read and unlink to low-level FileDescriptor + end-to-end CRUD test 2013-08-22 16:31:57 -07:00
Jeff Olson
dabbac1d6c std: working tests for low-level libuv open, write and close operations 2013-08-22 16:31:57 -07:00
Jeff Olson
a901b16690 std: bootstrapping libuv-based fileio in newrt... open & close
the test "touch"es a new file
2013-08-22 16:31:57 -07:00
Michael Sullivan
7b08b2c838 Suppress a broken test. Issue #8690. 2013-08-22 15:27:25 -07:00
Michael Sullivan
ad6eeb843b Don't do a bogus substitution on the transformed self ty for objects. Closes #8664. 2013-08-22 10:52:11 -07:00
Michael Sullivan
97d2b44f87 Substitute into the impl method rather than the trait method when emitting vtables. Closes #8601. 2013-08-22 10:52:11 -07:00
Michael Sullivan
8a9cddad7a Fix type parameter handling for static default methods. Closes #8654. 2013-08-22 10:52:11 -07:00
bors
063a005459 auto merge of #8669 : lkuper/rust/infer-refactor, r=nikomatsakis
This commit removes the "super_*" functions from
typeck::infer::combine, and adds them as default methods on the
Combine trait instead, making it possible to remove a lot of
boilerplate from the various impls of Combine.

I've been wanting to do this for over a year.  In fact, it was my
original motivation for default methods!

It might be possible to tighten things up even more, but this is the
bulk of it.
2013-08-22 10:31:25 -07:00
Michael Sullivan
451de33f7b Add self to the ast_map for provided methods. Closes #8010. 2013-08-22 10:14:10 -07:00
Michael Sullivan
48a682398a Don't ICE if an argument in a default method doesn't have a name. Closes #8417. 2013-08-22 10:14:10 -07:00
bors
4e3dbf959a auto merge of #8666 : nikomatsakis/rust/issue-3678-extern-fn-types, r=pcwalton
Change the type of crust fns like this one:

    extern fn foo() { ... }

from `*u8` to `extern "C" fn()`.

r? @pcwalton (or whomever)
2013-08-22 07:01:27 -07:00
bors
3f6f79b789 auto merge of #8627 : kballard/rust/fix-rusti, r=catamorphism
Commit 0932ab336 accidentally broke rusti by making it parse the binary
name as the input, instead of parsing what the user typed.
2013-08-22 04:41:27 -07:00
bors
7e50260f13 auto merge of #8626 : kballard/rust/issue-8615, r=catamorphism
Fixes #8615.
2013-08-22 03:11:29 -07:00
bors
b95c135621 auto merge of #8620 : brson/rust/issue-7563, r=alexcrichton 2013-08-22 01:41:30 -07:00
Vadim Chugunov
9e4fddeade Cleanup assembly source. 2013-08-22 00:12:44 -07:00
Vadim Chugunov
39fc0883fd Enabled tests. 2013-08-22 00:12:44 -07:00
Vadim Chugunov
3768bb32cd Compile via external assembler on Windows. 2013-08-22 00:12:43 -07:00
Vadim Chugunov
84e683063b Emit unwind info in rustrt assembly files on Windows. 2013-08-22 00:12:43 -07:00
Vadim Chugunov
9e7f1fce73 Un-disable stack unwinding on Windows. 2013-08-22 00:12:43 -07:00
Vadim Chugunov
1860efbfc6 On Windows, use g++ for linking, instead of gcc.
This is required in order to produce linked modules that perform correct registration of unwind tables.
2013-08-22 00:12:42 -07:00
bors
f51d30d729 auto merge of #8616 : kballard/rust/url-parse-errors, r=catamorphism
Fixes issue #8612.
2013-08-22 00:01:32 -07:00
bors
f1132496dd auto merge of #8590 : blake2-ppc/rust/std-str, r=alexcrichton
Implement CharIterator as a separate struct, so that it can be .clone()'d. Fix `.char_range_at_reverse` so that it performs better, closer to the forwards version. This makes the reverse iterators and users like `.rfind()` perform better.

    Before
    test str::bench::char_iterator ... bench: 146 ns/iter (+/- 0)
    test str::bench::char_iterator_ascii ... bench: 397 ns/iter (+/- 49)
    test str::bench::char_iterator_rev ... bench: 576 ns/iter (+/- 8)
    test str::bench::char_offset_iterator ... bench: 128 ns/iter (+/- 2)
    test str::bench::char_offset_iterator_rev ... bench: 425 ns/iter (+/- 59)
    
    After
    test str::bench::char_iterator ... bench: 130 ns/iter (+/- 1)
    test str::bench::char_iterator_ascii ... bench: 307 ns/iter (+/- 5)
    test str::bench::char_iterator_rev ... bench: 185 ns/iter (+/- 8)
    test str::bench::char_offset_iterator ... bench: 131 ns/iter (+/- 13)
    test str::bench::char_offset_iterator_rev ... bench: 183 ns/iter (+/- 2)

To be able to use a string slice to represent the CharIterator, a function `slice_unchecked` is added, that does the same as `slice_bytes` but without any boundary checks.

It would be possible to implement CharIterator with pointer arithmetic to make it *much more efficient*, but since vec iterator is still improving, it's too early to attempt to re-implement it in other places. Hopefully CharIterator can be implemented on top of vec iterator without any unsafe code later.

Additional changes fix the documentation about null termination.
2013-08-21 21:51:30 -07:00