Commit Graph

23875 Commits

Author SHA1 Message Date
Alex Crichton
68d5510292 Implement more native file I/O
This implements a fair amount of the unimpl() functionality in io::native
relating to filesystem operations. I've also modified all io::fs tests to run in
both a native and uv environment (so everything is actually tested).

There are a two bits of remaining functionality which I was unable to get
working:

* change_file_times on windows
* lstat on windows

I think that change_file_times may just need a better interface, but lstat has a
large implementation in libuv which I didn't want to tackle trying to copy.
2013-11-19 09:59:21 -08:00
bors
f5f5d5aac7 auto merge of #10479 : alexcrichton/rust/native-mutex.rs, r=cmr
This adds a new `std::unstable::mutex` module which contains bindings to the platform-provided mutexes. This module is pretty much entirely unsafe to use, but is critical for the runtime and dropping our C++ dependency.

The actual implementation is to do a compare-and-swap on an initially uninitialized pointer. Pthreads does allow for static initialization, so this wouldn't be necessary if we had all the proper headers and whatnot, but windows it looks like will always require some sort of compare-and-swap operation. For now, I didn't want to have to define all the pthreads headers, so I continue to just malloc the pthreads lock/cvar.

After this, there's only one remaining C++ component of rust, and that's unwinding.
2013-11-18 21:51:31 -08:00
Alex Crichton
508b7b996e Move runtime files to C instead of C++
Explicitly have the only C++ portion of the runtime be one file with exception
handling. All other runtime files must now live in C and be fully defined in C.
2013-11-18 21:45:58 -08:00
Alex Crichton
e8bf078802 Remove the C++ lock_and_signal type
A the same time this purges all runtime support needed for statically
initialized mutexes, moving all users over to the new Mutex type instead.
2013-11-18 20:06:40 -08:00
Alex Crichton
24eb1b445d Implement a native mutex type
This mutex is built on top of pthreads for unix and the related windows apis on
windows. This is a straight port of the lock_and_signal type from C++ to rust.
Almost all operations on the type are unsafe, and it's definitely not
recommended for general use.

Closes #9105
2013-11-18 20:06:39 -08:00
bors
ab7fe9dd06 auto merge of #10458 : yichoi/rust/make_check_pass_android2, r=brson
To enable test on android bot #9120

 workcache::test disabled and run-pass/core-run-destroy.rs fixed on android
2013-11-18 18:56:31 -08:00
bors
2a984c92a8 auto merge of #10440 : brson/rust/cnamespace, r=bstrie 2013-11-18 17:46:32 -08:00
bors
7fc3e82aae auto merge of #10366 : brson/rust/ignore-patterns, r=alexcrichton
This replaces `*` with `..` in enums, `_` with `..` in structs, and `.._` with `..` in vectors. It adds obsolete syntax warnings for the old forms but doesn't turn them on yet because we need a snapshot.

#5830
2013-11-18 16:36:33 -08:00
Brian Anderson
85f107d8cb Use '..' as slice wildcard in vectors 2013-11-18 16:19:48 -08:00
Brian Anderson
35e6c02524 Use '..' as multi-field wildcard in enums and structs. 2013-11-18 16:19:46 -08:00
Brian Anderson
f4c222f7a3 rt: Namespace all C functions under rust_ 2013-11-18 16:17:43 -08:00
Young-il Choi
68024eb4eb android support added to test case 2013-11-19 09:08:47 +09:00
Young-il Choi
093757ca80 add path environments 2013-11-19 09:08:47 +09:00
Young-il Choi
c45870b85e fix #10450 2013-11-19 09:08:47 +09:00
Young-il Choi
88831383b4 temporarily disable tests on android and tagging issue number #10455 2013-11-19 09:08:47 +09:00
bors
9062988610 auto merge of #10552 : michaelwoerister/rust/ifstepping, r=brson
This PR improves the single-stepping experience for if-expression (no more jumping into the *else* branch before entering the *then* branch, no more jumping to the end of the *else* branch after finishing the *then* branch). Unfortunately I don't know of a straight-forward way of writing automated tests for this. Suggestions welcome!
2013-11-18 15:26:29 -08:00
bors
3d569df41d auto merge of #10555 : TeXitoi/rust/pidigits-resurected, r=alexcrichton
Changes:
* default value when no args
* license
* removed libc printing
* use extra::bigint instead of handmade gmp binding

The drawback is that it's 2 order of magnitude slower, the good news is that there is a good bench for extra::bigint.
2013-11-18 13:46:55 -08:00
Guillaume Pinot
ec27c09bdf pidigits resurected
Changes:
* default value when no args
* license
* removed libc printing
* use extra::bigint instead of handmade gmp binding
2013-11-18 22:23:38 +01:00
bors
6c8b702cf7 auto merge of #10539 : alexcrichton/rust/external-linkage, r=pcwalton
If a function is marked as external, then it's likely desired for use with some
native library, so we're not really accomplishing a whole lot by internalizing
all of these symbols.
2013-11-18 10:26:49 -08:00
Alex Crichton
4ddeef35e5 Don't mark reachable extern fns as internal
If a function is marked as external, then it's likely desired for use with some
native library, so we're not really accomplishing a whole lot by internalizing
all of these symbols.
2013-11-18 10:21:58 -08:00
Michael Woerister
d0872eb692 debuginfo: Improved stepping for if-expressions 2013-11-18 16:56:44 +01:00
bors
4dded4345f auto merge of #10508 : chris-morgan/rust/tags-improvements, r=cmr
Largely, this is just being more specific about where tags get searched
for to remove external dependencies like src/llvm, which reduces the
number of tags *enormously* and significantly increases the usefulness
of the tags file as it is then focusing on 240K lines of Rust code
and 4.5K of C++ rather than just shy of 1M lines of C++ code (mostly
from LLVM) and another 100K lines of Rust tests and a diverse collection
of other languages.

src/rustllvm/RustWrapper.cpp and src/rustllvm/PassWrapper.cpp are
getting tags made, but I'm not sure if that's desirable or not. At
worst, it's not a significant wrong.

A future, desirable step is producing tags for just libstd and libextra
for the use of people using Rust-the-language rather than working on
Rust itself.
2013-11-17 23:41:25 -08:00
bors
8eda5d8315 auto merge of #10443 : alexcrichton/rust/meaninless-pub-priv, r=cmr
Closes #10111
2013-11-17 22:21:23 -08:00
Alex Crichton
dab8fec4af Forbid privacy in inner functions
Closes #10111
2013-11-17 21:28:18 -08:00
bors
727b70d6ae auto merge of #10526 : itdaniher/rust/master, r=pcwalton
This commit fixes issue #10468.

It propagate optimization level from PkgSrc to compile_crate as a rustc::driver::session::OptLevel enum.

The 'opt' argument to compile_crate was previously hardcoded as boolean false, such that calls to session::options would always result in the session::No flag being used.
2013-11-17 21:11:24 -08:00
bors
15a8e6248c auto merge of #10363 : astrieanna/rust/fix-x86stdcall, r=huonw
* moved `extern` inside module
* changed `extern "stdcall"` to `extern "system"`
* changed `cfg(target_os="win32")` to `cfg(windows)`
* only run on Windows && x86, (not x86_64)
* updated copyright dates
2013-11-17 20:01:34 -08:00
Leah Hanson
69768f7c94 Fix XFailed test x86stdcall
There was a syntax error because the `extern "stdcall"` was outside the module instead of inside it.

* moved `extern` inside module
* change `extern "stdcall"` to `extern "system"`
* change `cfg(target_os="win32")` to `cfg(windows)`
* updated copyright dates
* changed log(error, ...) => info!(....)
* added `pub` keyword to kernel32 functions
2013-11-17 20:55:59 -06:00
bors
5e3123bfa7 auto merge of #10533 : tautologico/rust/fixdocs, r=huonw
This fixes a number of bugs in the doc comments for a bunch of functions in libstd/iter.rs, mostly updating to use unwrap() instead of get() on options. Also fixes the docs for advance() (trait Iterator) which was not making sense, though if it is not useful anymore maybe it should be removed.
2013-11-17 18:51:30 -08:00
Andrei Formiga
1f27512b17 Fixed docs for advance() in Iterator trait 2013-11-17 23:45:29 -03:00
Andrei Formiga
2839805b9c Fixed uses of get() to unwrap() in doc examples in std::iter 2013-11-17 23:30:57 -03:00
bors
b4197aeed6 auto merge of #10511 : cmr/rust/addtests, r=huonw
Commit messages have all
2013-11-17 16:21:32 -08:00
Corey Richardson
ed34cd1e3c Better error message when using vectors in statics
Closes #10487
2013-11-17 18:35:52 -05:00
Corey Richardson
5d466ff96e Add a test for #6976
Closes #6976
2013-11-17 18:35:47 -05:00
bors
2c9e56f0ed auto merge of #10532 : dhodder/rust/master, r=alexcrichton
Hello.  This is just a tiny doc update -- I'm new here, so apologies if I'm doing it wrong.
2013-11-17 15:11:41 -08:00
bors
60ec647b77 auto merge of #10531 : TeXitoi/rust/mandelbrot-resurected, r=cmr
Changes:
* add licence;
* remove usage of libc and unsafe;
* use BufferedWriter to improve performance;
* use a DummyWriter to cancel binary output in test.
2013-11-17 14:01:58 -08:00
Dave Hodder
48f76a0577 Add doc comment for extra::url::query_to_str 2013-11-17 16:52:14 +00:00
bors
e0943504e4 auto merge of #10523 : huonw/rust/10522, r=cmr
If any of the digits was one past the maximum (e.g. 10**9 for base 10),
then this wasn't detected correctly and so the length of the digit was
one more than expected, causing a very large allocation.

Fixes #10522.
Fixes #10288.
2013-11-17 07:32:13 -08:00
bors
5208332a1a auto merge of #10518 : huonw/rust/6911, r=alexcrichton
Bringing it into line with the unused-variable one,

    fn main() {
        let mut _a = 1;
    }

will not warn that `_a` is never used mutably.

Fixes #6911.
2013-11-17 06:21:47 -08:00
bors
6c8e33753c auto merge of #10510 : chris-morgan/rust/fix-num_lit-grammar-in-the-reference-manaul, r=cmr
- Cause `0` to be considered a valid integer literal (it is).
- Add octal literals (missed from #10243).

I have *not* modified doc/po/rust.md.pot or doc/po/ja/rust.md.po at all;
they already seem to be out of date so it's easier to ignore them for
myself. I can update them if desired, of course.
2013-11-17 04:26:37 -08:00
Guillaume Pinot
93bb99ea09 Prettier long string breaking. 2013-11-17 13:09:56 +01:00
Guillaume Pinot
0c3b04fa0f Clarrify the message for test mode and use u8 instead of i8 for storing bits 2013-11-17 12:47:47 +01:00
bors
dff4f52a72 auto merge of #10509 : cmr/rust/trait_name, r=alexcrichton
Rebase + fix of #10118
2013-11-17 03:16:37 -08:00
Guillaume Pinot
6258857beb resurect shootout-mandelbrot.rs
Changes:
* add licence;
* remove usage of libc and unsafe;
* use BufferedWriter to improve performance;
* use a DummyWriter to cancel binary output in test.
2013-11-17 12:04:36 +01:00
bors
66df86ae98 auto merge of #10466 : alexcrichton/rust/issue-10334, r=cmr
These commits create a `Buffer` trait in the `io` module which represents an I/O reader which is internally buffered. This abstraction is used to reasonably implement `read_line` and `read_until` along with at least an ok implementation of `read_char` (although I certainly haven't benchmarked `read_char`).
2013-11-17 01:21:36 -08:00
bors
0a577f384e auto merge of #10454 : z0w0/rust/issue-9944, r=cmr
Allows you to provide explicit `--cfg` flags when building certain packages through the rustpkg API.
2013-11-16 23:46:37 -08:00
Huon Wilson
c8e6a38693 extra: handle an edge case in BigUint.to_str().
If any of the digits was one past the maximum (e.g. 10**9 for base 10),
then this wasn't detected correctly and so the length of the digit was
one more than expected, causing a very large allocation.

Fixes #10522.
Fixes #10288.
2013-11-17 16:05:01 +11:00
Ian Daniher
b60b411495 fix 10468, propagate optimization level as rustc::driver::session::OptLevel 2013-11-16 20:26:01 -05:00
bors
b0e1318164 auto merge of #10420 : sanxiyn/rust/path, r=cmr
Fix #10283.
2013-11-16 14:36:40 -08:00
Huon Wilson
6bd8bb51a0 lint: _-prefixed variables don't get an unused-mut warning.
Bringing it into line with the unused-variable one,

    fn main() {
        let mut _a = 1;
    }

will not warn that `_a` is never used mutably.

Fixes #6911.
2013-11-16 22:20:42 +11:00
Alex Crichton
01343d3d29 Implement read_char on the Buffer trait 2013-11-16 02:11:47 -08:00