Commit Graph

23939 Commits

Author SHA1 Message Date
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
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
Chris Morgan
9fa32c07a0 Fix the num_lit grammar in the reference manual.
- 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-16 15:53:56 +11:00
Chris Morgan
8e59c5d34a Don't make tags for our dependencies and tests.
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-16 13:44:52 +11: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
bors
43f6791e75 auto merge of #10497 : thestinger/rust/cleanup, r=cmr
This is the same functionality as `ptr::read_ptr`.
2013-11-14 19:31:24 -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
11ece44f02 auto merge of #10484 : nibrahim/rust/docfix, r=cmr
Without this, a.rs appears as a struck out line.
2013-11-14 08:01:42 -08:00
Noufal Ibrahim
bc698ba3ef Fixes formatting
Without this, a.rs appears as a struck out line.
2013-11-14 21:04:38 +05:30
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
bors
f9cea4b3a0 auto merge of #10476 : catamorphism/rust/rustpkg-doc-fix, r=catamorphism
spotted by Yurume
2013-11-14 00:16:18 -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
bors
6f401478dc auto merge of #10473 : jschaf/rust/ignore-windows-build-dir, r=alexcrichton
Ignoring the build directory on Windows.
2013-11-13 23:06:16 -08:00
Tim Chevalier
8a041e63a5 docs: Change "workspace" to "package directory"
spotted by Yurume
2013-11-13 22:41:50 -08:00
bors
51f2e7e84e auto merge of #10472 : klutzy/rust/cleanup-xfail, r=alexcrichton
Closes #10452.
2013-11-13 21:56:16 -08:00
klutzy
175858519d doc: Fix example on Windows 2013-11-14 14:43:10 +09: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
Joe Schafer
e91cb479a4 Add Window build directory to .gitignore 2013-11-13 21:05:01 -05: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