Commit Graph

21402 Commits

Author SHA1 Message Date
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
Huon Wilson
e6fb622af1 std::rand: wrappers for floats from [0,1] and (0,1).
Provide `Closed01` and `Open01` that generate directly from the
closed/open intervals from 0 to 1, in contrast to the plain impls for
f32 and f64 which generate the half-open [0,1).

Fixes #7755.
2013-11-18 23:12:01 +11: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
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
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
Corey Richardson
ab9e3a6652 Adjust error message for method type mismatch
Closes #10118, Closes #5925
2013-11-16 00:50:20 -05:00
Jaemin Moon
51bdec18b0 Show the name of the trait in the error message 2013-11-16 00:50:18 -05:00
bors
90754ae9c9 auto merge of #10478 : TeXitoi/rust/shootout-meteor, r=brson
This implementation of the meteor contest implements:
 - insertion check with bit trick;
 - pregenetation of every feasible placement of the pieces on the
   board;
 - filtering of placement that implies unfeasible board
 - central symetry breaking

related to #2776
2013-11-14 22:01:26 -08:00
Daniel Micay
fbad2e2ae9 remove cast::unsafe_copy
This is the same functionality as `ptr::read_ptr`.
2013-11-14 22:20:12 -05:00
Guillaume Pinot
d2bcc7b621 Improve variable naming. 2013-11-14 23:22:44 +01:00
Guillaume Pinot
74d27311a7 remove useless Iterate impl, and permute the order of the argument of iterate
Writing iterate(x, f) is more logical as rust iterator pipeline is left to right.
2013-11-14 23:05:33 +01:00
bors
ade310cbb6 auto merge of #10018 : fhahn/rust/check-inferred-ints, r=alexcrichton
I've started working on this issue and pushed a small commit, which adds a range check for integer literals in `middle::const_eval` (no `uint` at the moment) 
At the moment, this patch is just a proof of concept, I'm not sure if there is a better function for the checks in `middle::const_eval`. This patch does not check for overflows after constant folding, eg:

    let x: i8 = 99 + 99;
2013-11-14 13:01:35 -08:00
bors
0d11935bf6 auto merge of #10428 : toffaletti/rust/try_lock, r=alexcrichton
I need try_lock for an algorithm I'm trying to implement in Rust.
2013-11-14 11:51:25 -08:00
bors
af62adfad0 auto merge of #9788 : geoffhill/rust/bare-fn-cast, r=pnkfelix
Bare functions are another example of a scalar but non-numeric
type (like char) that should be handled separately in casts.
This disallows expressions like `0 as extern "Rust" fn() -> int;`.

It might be advantageous to allow casts between bare functions
and raw pointers in unsafe code in the future, to pass function
pointers between Rust and C.

Closes #8728
2013-11-14 05:21:21 -08:00
Guillaume Pinot
89a9ce0cc6 Add shootout meteor contest benchmark.
This implementation of the meteor contest implements:
 - insertion check with bit trick;
 - pregenetation of every feasible placement of the pieces on the
   board;
 - filtering of placement that implies unfeasible board
 - central symetry breaking
2013-11-14 09:11:33 +01:00
klutzy
3e5185d97a test: Add xfail-win32 to two debug-info tests 2013-11-14 14:43:09 +09:00
klutzy
bbcd3465ef rustpkg: Disable test suite on windows
sha1, version, util tests are still alive and they pass on win32.
2013-11-14 14:43:09 +09:00
klutzy
09cb7ecc67 test: Fix signal-exit-status on windows 2013-11-14 14:43:08 +09:00
klutzy
fcf9844891 test: Clean up xfail-{fast,win32} tests
Rename {struct-update,fsu}-moves-and-copies, since win32
failed to run the test since UAC prevents any executable whose
name contaning "update". (#10452)

Some tests related to #9205 are expected to fail on gcc 4.8,
so they are marked as `xfail-win32` instead of `xfail-fast`.

Some tests using `extra::tempfile` fail on win32 due to #10462.
Mark them as `xfail-win32`.
2013-11-14 14:25:44 +09:00
bors
58b5c618cf auto merge of #10457 : alexcrichton/rust/native-io, r=brson
This commit re-organizes the io::native module slightly in order to have a
working implementation of rtio::IoFactory which uses native implementations. The
goal is to seamlessly multiplex among libuv/native implementations wherever
necessary.

Right now most of the native I/O is unimplemented, but we have existing bindings
for file descriptors and processes which have been hooked up. What this means is
that you can now invoke println!() from libstd with no local task, no local
scheduler, and even without libuv.

There's still plenty of work to do on the native I/O factory, but this is the
first steps into making it an official portion of the standard library. I don't
expect anyone to reach into io::native directly, but rather only std::io
primitives will be used. Each std::io interface seamlessly falls back onto the
native I/O implementation if the local scheduler doesn't have a libuv one
(hurray trait ojects!)
2013-11-13 19:46:18 -08:00
Alex Crichton
9bcf557589 Implement native::IoFactory
This commit re-organizes the io::native module slightly in order to have a
working implementation of rtio::IoFactory which uses native implementations. The
goal is to seamlessly multiplex among libuv/native implementations wherever
necessary.

Right now most of the native I/O is unimplemented, but we have existing bindings
for file descriptors and processes which have been hooked up. What this means is
that you can now invoke println!() from libstd with no local task, no local
scheduler, and even without libuv.

There's still plenty of work to do on the native I/O factory, but this is the
first steps into making it an official portion of the standard library. I don't
expect anyone to reach into io::native directly, but rather only std::io
primitives will be used. Each std::io interface seamlessly falls back onto the
native I/O implementation if the local scheduler doesn't have a libuv one
(hurray trait ojects!)
2013-11-13 18:34:59 -08:00
bors
8a3b35f68a auto merge of #10464 : gutworth/rust/snap-err, r=pnkfelix
...tatement
2013-11-13 16:26:15 -08:00
Jason Toffaletti
91de538c98 add rust_trylock_little_lock
Try to acquire lock and succeed only if lock is not already held.
Uses TryEnterCriticalSection or pthread_mutex_trylock.
2013-11-13 14:44:50 -08:00
bors
49c6ae10cb auto merge of #10421 : adridu59/rust/patch-www, r=alexcrichton
* Closes #10330
* Improves on #9873
* Adds favicon for tutorial files
2013-11-13 14:41:19 -08:00
bors
2b2a89d97f auto merge of #10447 : alexcrichton/rust/flaky-time-test, r=catamorphism
This test was failing periodically on windows and other platforms, and in
debugging the issue locally I've found that the previous test was failing
at the assertion `ns0 <= ns1`. Upon inspecting the values, the two numbers were
very close to one another, but off by a little bit.

I believe that this is because `precise_time_s` goes from `u64` -> `f64` and
then we go again back to `u64` for the assertion. This conversion is a lossy one
that's not always guaranteed to succeed, so instead I've changed the test to
only compare against u64 instances.
2013-11-13 13:31:24 -08:00
bors
a79ed57beb auto merge of #10451 : zkamsler/rust/buf_writer, r=alexcrichton
I implemented BufWriter. I realize the use of conditions are on their way out for IO, but it does raise a condition if a write will not fit in the buffer for now.

I also replaced the seek code for MemWriter. It was adding the offset as a uint, which is unsound for negative offsets. It only happened to work because unsigned addition performs the same operation with two's complement, and sizeof(uint) <= sizeof(i64) so there was no (lack of) sign extension. I replaced this with computing an offset as an i64 and clamping to zero. I don't expect anyone will have use BufWriter with a byte buffer greater than 2^63 bytes any time soon.

@alexcrichton

Closes #10433
2013-11-13 12:21:28 -08:00
Alex Crichton
7bc092f109 Introduce an io::Buffer trait
This trait is meant to abstract whether a reader is actually implemented with an
underlying buffer. For all readers which are implemented as such, we can
efficiently implement things like read_char, read_line, read_until, etc. There
are two required methods for managing the internal buffer, and otherwise
read_line and friends can all become default methods.

Closes #10334
2013-11-13 11:36:13 -08:00
Zach Kamsler
c2c7a2497d Implemented BufWriter
Filled in the implementations of Writer and Seek for BufWriter. It
raises the io_error condition if a write cannot fit in the buffer.

The Seek implementation for MemWriter, which was incorrectly using
unsigned arithmatic to add signed offsets, has also been replaced.
2013-11-13 14:22:03 -05:00
bors
314d6f693f auto merge of #10277 : dcrewi/rust/missing-doc-and-visibility-rules, r=alexcrichton
Now the privacy pass returns enough information that other passes do not need to duplicate the visibility rules, and the missing_doc implementation is more consistent with other lint checks.
2013-11-13 10:16:29 -08:00
David Creswick
1f7eb4f9aa make missing_doc lint respect the visibility rules
Previously, the `exported_items` set created by the privacy pass was
incomplete. Specifically, it did not include items that had been defined
at a private path but then `pub use`d at a public path. This commit
finds all crate exports during the privacy pass. Consequently, some code
in the reachable pass and in rustdoc is no longer necessary. This commit
then removes the separate `MissingDocLintVisitor` lint pass, opting to
check missing_doc lint in the same pass as the other lint checkers using
the visibility result computed by the privacy pass.

Fixes #9777.
2013-11-13 11:31:59 -06:00
Benjamin Peterson
d328ab765b be more robust when removing download artifacts and remove bogus raise statement 2013-11-13 12:02:50 -05:00
Adrien Tétar
5a01dbe67b doc: disable parser error highlighting + a few fixes
CodeMirror parser errors are related to #9873.
2013-11-13 09:32:29 +01:00
Zack Corr
57486994d5 Add build_lib_with_cfgs, build_bin_with_cfgs to rustpkg API. Closes #9944. 2013-11-13 14:54:17 +10:00
Corey Richardson
67692b21b5 io: benchmarks for creation of the various Buffered objects 2013-11-12 21:51:15 -05:00
bors
1bfa45cfd9 auto merge of #10342 : catamorphism/rust/rustpkg-dir-checking-and-monitor, r=erickt
r? @brson
2013-11-12 16:41:14 -08:00
Tim Chevalier
65aacd083a rustpkg: Eliminate the spurious os::path_exists(&pkg_src.start_dir.join(p)) assertion failure
This addresses the problem reported in #10253 and possibly elsewhere.

Closes #10253
2013-11-12 15:32:31 -08:00
Carol W
33ee4335b9 Fixed xfail for nbody shootout benchmark by correcting command line parse.
Cleaned up unneeded imports and type changes to resolve compiler warnings.
2013-11-12 15:14:07 -08:00
Adrien Tétar
123e0cefb6 doc: CSS: fix code fonts
Closes #10330.
2013-11-12 21:36:09 +01:00
bors
3b0d48634f auto merge of #10427 : alexcrichton/rust/no-xray, r=brson
Just a few triage issues that I ran into.
2013-11-12 12:16:21 -08:00
Alex Crichton
b9b908f62f Make a time test less flaky
This test was failing periodically on windows and other platforms, and in
debugging the issue locally I've found that the previous test was failing
at the assertion `ns0 <= ns1`. Upon inspecting the values, the two numbers were
very close to one another, but off by a little bit.

I believe that this is because `precise_time_s` goes from `u64` -> `f64` and
then we go again back to `u64` for the assertion. This conversion is a lossy one
that's not always guaranteed to succeed, so instead I've changed the test to
only compare against u64 instances.
2013-11-12 11:44:14 -08:00
bors
f1a67bd4c0 auto merge of #10423 : alexcrichton/rust/move-io, r=pcwalton
I still plan on reorganizing the internals of the IO module a bit, but this is the major move which has been on the horizon for awhile.
2013-11-12 11:01:24 -08:00
Florian Hahn
20627c7430 Check inferred integer literals for overflows, closes #4220 2013-11-12 19:36:46 +01:00
Florian Hahn
be09626148 Remove type overflow checks from check_const.rs, refs #4220
The checks are now handled by the linter
2013-11-12 19:35:55 +01:00
Alex Crichton
5fdbcc4020 Improve error message for breaks in blocks
Before it was always stated that it was a "break outside of a loop" when you
could very well be in a loop, but just in a block instead.

Closes #3064
2013-11-12 09:40:21 -08:00
Brian Anderson
6b6f89b0ec rt: Delete more C++ 2013-11-12 06:05:03 -08:00
bors
11b07847e6 auto merge of #10435 : jayanderson/rust/docs, r=huonw
This fills in some missing docs in the nums package. Let me know if this is on the right track for what's wanted for docs. I can probably fill in more in the future. Thanks.

(As a side note the precedence of the unary negative operator '-' tripped me up for a bit. Essentially I would expect `-25.0f32.sqrt()` to result in NaN instead of `-5.0`.)
2013-11-12 02:31:15 -08:00
bors
34035036e3 auto merge of #10198 : alexcrichton/rust/darwin-quiet, r=jdm
Instead of running dsymutil for all builds, this changes it to only run the program for debug builds.

Closes #3495
2013-11-11 22:56:07 -08:00
bors
4320a0caff auto merge of #10425 : astrieanna/rust/rm-issue-912, r=brson
According to rust's issue #912, this will not be fixed. There's no point in keeping the test if it is never intended to pass.
2013-11-11 20:46:11 -08:00
Alex Crichton
49ee49296b Move std::rt::io to std::io 2013-11-11 20:44:07 -08:00
Jay Anderson
8a4be8080b Use constants instead of raw values. 2013-11-11 20:52:42 -07:00
bors
8b4683d79d auto merge of #10424 : alexcrichton/rust/optimize-buffered, r=brson
I was benchmarking rust-http recently, and I saw that 50% of its time was spent
creating buffered readers/writers. Albeit rust-http wasn't using
std::rt::io::buffered, but the same idea applies here. It's much cheaper to
malloc a large region and not initialize it than to set it all to 0. Buffered
readers/writers never use uninitialized data, and their internal buffers are
encapsulated, so any usage of uninitialized slots are an implementation bug in
the readers/writers.
2013-11-11 19:31:14 -08:00
bors
86787f8bef auto merge of #10109 : pcmattman/rust/pass-nonzero-exit-status-on-termination-by-signal, r=alexcrichton
The UvProcess exit callback is called with a zero exit status and non-zero termination signal when a child is terminated by a signal.

If a parent checks only the exit status (for example, only checks the return value from `wait()`), it may believe the process completed successfully when it actually failed.

Helpers for common use-cases are in `std::rt::io::process`.

Should resolve https://github.com/mozilla/rust/issues/10062.
2013-11-11 18:11:17 -08:00
Jay Anderson
deefb1f4b7 Got directions backwards in to_degrees and to_radians docs. 2013-11-11 18:56:48 -07:00
Jay Anderson
6c02e81c70 Add docs for traits Exponential, Hyperbolic, BitCount. 2013-11-11 18:49:48 -07:00
Jay Anderson
f4bedded8b Update docs for Fractional, Algebraic, Round, and Trigonometric traits. 2013-11-11 18:49:48 -07:00
Matthew Iselin
f698decf37 Implemented a ProcessExit enum and helper methods to std::rt::io::process for getting process termination status, or the signal that terminated a process.
A test has been added to rtio-processes.rs to ensure signal termination is picked up correctly.
2013-11-12 11:37:14 +10:00
bors
c0b7972f7d auto merge of #10422 : alexcrichton/rust/explicit-crate-map, r=pcwalton
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 16:11:22 -08:00
bors
23746ae990 auto merge of #10403 : poiru/rust/issue-2675, r=alexcrichton
Closes #2675.
2013-11-11 12:06:25 -08:00
Alex Crichton
0cc5e6c83f Remove resolve's xray infrastructure
Since the removal of privacy from resolve, this flag is no longer necessary to
get the test runner working. All of the privacy checks are bypassed by a special
item attribute in the privacy visitor.

Closes #4947
2013-11-11 11:26:31 -08:00
Leah Hanson
a5b6d8d7c2 Remove test issue-3461
According to issue #3461, it doesn't sound like this is planned to be fixed.
2013-11-11 13:25:07 -06:00
Birunthan Mohanathas
36afd60609 Add asserts to check for faililng QueryPerformance* calls in precise_time_ns
Closes #2675.
2013-11-11 21:21:51 +02:00
Birunthan Mohanathas
61f76a5130 Change use of unsigned integers to signed integers for clarity in
precise_time_ns

The QueryPerformance* functions take a LARGE_INTEGER, which is a signed
64-bit integer rather than an unsigned 64-bit integer. `ts.tv_sec`, too,
is a signed integer so `ns_per_s` has been changed to a int64_t.
2013-11-11 21:21:24 +02:00
Leah Hanson
ba4bf7ec33 Remove run-pass/issue-3907-2.rs
This test is not supposed to compile; there is an equivalent test in compile-fail/issue-3907.rs.
2013-11-11 12:59:00 -06:00
bors
0966ec01dc auto merge of #10407 : alexcrichton/rust/no-fixed-stack-segment, r=brson
The commit messages have more details, but this removes all analysis and usage related to fixed_stack_segment and rust_stack attributes. It's now the assumption that we always have "enough stack" and we'll implement detection of stack overflow through other means.

The stack overflow detection is currently implemented for rust functions, but it is unimplemented for C functions (we still don't have guard pages).
2013-11-11 10:46:28 -08:00
Alex Crichton
1f19243095 Decrease the default stack size back to 2MB
I increased this to 4MB when I implemented abort-on-stack-overflow for Rust
functions. Now that the fixed_stack_segment attribute is removed, no rust
function will ever reasonably request 2MB of stack (due to calling an FFI
function).

The default size of 2MB should be plenty for everyday use-cases, and tasks can
still request more stack via the spawning API.
2013-11-11 10:40:34 -08:00
Alex Crichton
7755ffd013 Remove #[fixed_stack_segment] and #[rust_stack]
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155
2013-11-11 10:40:34 -08:00
Leah Hanson
2d6ef29e68 Removed test issue-912.rs
This was marked xfail-test
According to rust's issue #912, this will not be fixed.
There's no point in keeping the test if it is never intended to pass.
2013-11-11 12:12:39 -06:00
Alex Crichton
cdf7d63bfc Optimize creation of buffered readers/writers
I was benchmarking rust-http recently, and I saw that 50% of its time was spent
creating buffered readers/writers. Albeit rust-http wasn't using
std::rt::io::buffered, but the same idea applies here. It's much cheaper to
malloc a large region and not initialize it than to set it all to 0. Buffered
readers/writers never use uninitialized data, and their internal buffers are
encapsulated, so any usage of uninitialized slots are an implementation bug in
the readers/writers.
2013-11-11 10:08:03 -08:00
Alex Crichton
2eb92b77a9 Add a flag to force generating toplevel crate map
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 09:26:24 -08:00
bors
4d9b95fada auto merge of #10417 : cmr/rust/vec_overflow, r=huonw
Fixes #10271
2013-11-11 08:56:18 -08:00
bors
4059b5c4b3 auto merge of #10409 : alexcrichton/rust/issue-10386, r=brson
Turns out the pipe names must have special names on windows. Once we have
special names, all the tests pass just fine.

Closes #10386
2013-11-11 07:46:18 -08:00
bors
c47986b675 auto merge of #10394 : yichoi/rust/make_check_pass_android, r=brson
To enable test on android bot #9120

some tests are disabled and can be fixed further.
2013-11-11 06:21:16 -08:00
Seo Sanghyeon
2337d88339 Fix path parsing 2013-11-11 21:53:14 +09:00
Corey Richardson
fc01f20c42 Implement size_hint for Range
Closes #8606
2013-11-11 07:22:30 -05:00
Corey Richardson
a46b2b8e7a vec: with_capacity: check for overflow
Fixes #10271
2013-11-11 06:09:28 -05:00
Corey Richardson
2c18983ea5 Clean lint on test build 2013-11-11 05:00:48 -05:00
bors
46100c0622 auto merge of #10408 : alexcrichton/rust/snapshots, r=huonw
Mostly just using the `system` abi where possible.
2013-11-10 21:56:08 -08:00
Alex Crichton
681ea93d52 Enable uv pipe tests on windows
Turns out the pipe names must have special names on windows. Once we have
special names, all the tests pass just fine.

Closes #10386
2013-11-10 20:43:08 -08:00
Alex Crichton
7407bcc1a2 Register new snapshots 2013-11-10 17:51:56 -08:00
bors
63cfc9989d auto merge of #10406 : alexcrichton/rust/issue-10405, r=huonw
The logging macros all use libuv-based I/O, and there was one stray debug
statement in task::spawn which was executing before the I/O context was ready.
Remove it and add a test to make sure that we can continue to debug this sort of
code.

Closes #10405
2013-11-10 16:01:12 -08:00
Alex Crichton
64afa4ea22 Only run dsymutil on OSX in debug builds
When there are no debug symbols generated, then the program just prints an
annoying warning otherwise.

Closes #10198
2013-11-10 13:58:11 -08:00
bors
fe48d8fcd1 auto merge of #10399 : huonw/rust/get-opt-doc, r=alexcrichton 2013-11-10 13:36:11 -08:00
Alex Crichton
b71d629744 Remove a debug! statement before I/O is ready
The logging macros all use libuv-based I/O, and there was one stray debug
statement in task::spawn which was executing before the I/O context was ready.
Remove it and add a test to make sure that we can continue to debug this sort of
code.

Closes #10405
2013-11-10 13:05:36 -08:00
Alex Crichton
e38a89d0b0 Fix usage of libuv for windows 2013-11-10 12:23:57 -08:00
Huon Wilson
8e719bdfb5 extra::getopts: update docs for minor renaming. 2013-11-10 23:28:26 +11:00
Alex Crichton
c5fdd69d3e Carefully destroy channels at the right time.
When a channel is destroyed, it may attempt scheduler operations which could
move a task off of it's I/O scheduler. This is obviously a bad interaction, and
some finesse is required to make it work (making destructors run at the right
time).

Closes #10375
2013-11-10 01:37:12 -08:00
Alex Crichton
86a321b65d Another round of test fixes from previous commits 2013-11-10 01:37:12 -08:00
Alex Crichton
3a3eefc5c3 Update to the latest libuv
At this time, also point the libuv submodule to the official repo instead of my
own off to the side.

cc #10246
Closes #10329
2013-11-10 01:37:11 -08:00
Alex Crichton
b652bbc670 Fall back from uv tty instances more aggressively
It appears that uv's support for interacting with a stdio stream as a tty when
it's actually a pipe is pretty problematic. To get around this, promote a check
to see if the stream is a tty to the top of the tty constructor, and bail out
quickly if it's not identified as a tty.

Closes #10237
2013-11-10 01:37:11 -08:00
Alex Crichton
df4c0b8e43 Make the uv bindings resilient to linked failure
In the ideal world, uv I/O could be canceled safely at any time. In reality,
however, we are unable to do this. Right now linked failure is fairly flaky as
implemented in the runtime, making it very difficult to test whether the linked
failure mechanisms inside of the uv bindings are ready for this kind of
interaction.

Right now, all constructors will execute in a task::unkillable block, and all
homing I/O operations will prevent linked failure in the duration of the homing
operation. What this means is that tasks which perform I/O are still susceptible
to linked failure, but the I/O operations themselves will never get interrupted.
Instead, the linked failure will be received at the edge of the I/O operation.
2013-11-10 01:37:11 -08:00
Alex Crichton
5e6bbc6bfa Assorted test fixes and merge conflicts 2013-11-10 01:37:11 -08:00
Alex Crichton
b545751597 Rework the idle callback to have a safer interface
It turns out that the uv implementation would cause use-after-free if the idle
callback was used after the call to `close`, and additionally nothing would ever
really work that well if `start()` were called twice. To change this, the
`start` and `close` methods were removed in favor of specifying the callback at
creation, and allowing destruction to take care of closing the watcher.
2013-11-10 01:37:11 -08:00
Alex Crichton
d08aadcc9a Update all uv tests to pass again 2013-11-10 01:37:11 -08:00
Alex Crichton
0df8b0057c Work around bugs in 32-bit enum FFI
cc #10308
2013-11-10 01:37:11 -08:00
Alex Crichton
1bdaea827e Migrate all streams to synchronous closing 2013-11-10 01:37:11 -08:00
Alex Crichton
f9abd998d6 Add bindings to uv's utime function
This exposes the ability to change the modification and access times on a file.

Closes #10266
2013-11-10 01:37:11 -08:00
Alex Crichton
497d63f0bc Don't overflow in a converting stat times to u64
Closes #10297
2013-11-10 01:37:11 -08:00
Alex Crichton
aa78c3d6f6 Clean up the remaining chunks of uv 2013-11-10 01:37:11 -08:00
Alex Crichton
584b359348 Migrate uv net bindings away from ~fn() 2013-11-10 01:37:11 -08:00
Alex Crichton
5842b606a7 Migrate uv getaddrinfo away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
be896288a3 Migrate uv file bindings away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
c1b5c4db8f Start migrating stream I/O away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
6690bcb101 Fixing rebase conflicts and such
This cleans up the merging of removing ~fn() and removing C++ wrappers to a
compile-able and progress-ready state
2013-11-10 01:37:10 -08:00
Alex Crichton
18ce014e9d Remove usage of ~fn from the scheduler 2013-11-10 01:37:10 -08:00
Alex Crichton
28219fc679 Remove usage of ~fn() from uv async/idle 2013-11-10 01:37:10 -08:00
Alex Crichton
9286d5113d Migrate uv signal handling away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
ceab326e82 Migrate uv process bindings away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
24b4223418 Migrate uv timer bindings away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
653406fcf7 uv: Remove closure-based home_for_io for raii
Using an raii wrapper means that there's no need for a '_self' variant and we
can greatly reduce the amount of 'self_'-named variables.
2013-11-10 01:37:10 -08:00
Alex Crichton
4bcde6bc06 uv: Provide a helper fn to Result<(), IoError> 2013-11-10 01:37:10 -08:00
Alex Crichton
30c885ea52 uv: Remove lots of uv/C++ wrappers 2013-11-10 01:37:10 -08:00
Young-il Choi
9bb1e256d7 temporarily disable tests on android and tagging issue number #10393 2013-11-10 12:02:23 +09:00
Young-il Choi
5daf6b7849 temporarily disable tests on android and tagging issue number #10380 2013-11-10 12:01:22 +09:00
Young-il Choi
d6f7669c78 temporarily disable tests on android and tagging issue number #10379 2013-11-10 11:57:27 +09:00
Young-il Choi
480894796a temporarily disable tests on android and tagging issue number #10378 2013-11-10 11:57:03 +09:00
Young-il Choi
e3f9f45439 disable tests on android since tcp/ip permission cannot be acquired without help of apk 2013-11-10 08:18:12 +09:00
Young-il Choi
ca55317e90 tagging issue number(#10381) 2013-11-10 08:18:12 +09:00