Commit Graph

31924 Commits

Author SHA1 Message Date
Huon Wilson
edc9191921 testsuite: implement #[reexport_test_harness_name] to get access to the
default entrypoint of the --test binary.

This allows one to, e.g., run tests under libgreen by starting it
manually, passing in the test entrypoint.
2014-08-09 13:00:58 +10:00
Huon Wilson
c3284733e3 move a test into a run make, to check external affect rather than
implementation details.

(Mainly to avoid accessing the secret internal test module symbol name.)
2014-08-09 13:00:58 +10:00
bors
39bafb09fd auto merge of #16314 : Ryman/rust/ringbuf_non_pow2, r=huonw
See test for details.
2014-08-09 01:21:23 +00:00
nham
9315d841c7 Remove the dist function; it is more efficient to compare squared distances 2014-08-08 21:02:51 -04:00
Brian Anderson
e59fb9eb62 mk: Don't emit landing pads in stage 0.
Reduces time to build stage0 from 11:30 to 9:40 on my machine.
2014-08-08 16:54:26 -07:00
Alexis Beingessner
e8006f3c74 Make small doc contributions less onerous/intimidating 2014-08-08 19:36:32 -04:00
bors
a1429bca5a auto merge of #16277 : Gankro/rust/responsive-docs, r=cmr
* move some sidebar contents to a title bar when small
* inline description toggle when small
* make out-of-band and in-band content share space, rather than float and clash
* compress wording of out-of-band content to avoid line-wrap as much as possible

## [Live Version Here](http://cg.scs.carleton.ca/~abeinges/doc/index.html)

Pages Of Interest:
* [Vec](http://cg.scs.carleton.ca/~abeinges/doc/std/vec/struct.Vec.html) (small path)
* [TreeSet](http://cg.scs.carleton.ca/~abeinges/doc/collections/treemap/struct.TreeSet.html) (long path)
* [std](http://cg.scs.carleton.ca/~abeinges/doc/std/index.html) (for stability dash)

TBD in a future PR is to convert links in the sidebar into a series of nest ul/li's, so that they can easily be moved to a drop-down in the new title bar. I think this is out of scope for this PR, but am willing to implement it now if desired.
2014-08-08 21:36:11 +00:00
Tobias Bucher
cd6eb12270 Add division by zero case to the CheckedDiv comment 2014-08-08 22:45:50 +02:00
bors
57630eb809 auto merge of #16336 : retep998/rust/master, r=brson
Several of the tests in `make check-fast` were failing so this fixes those tests.
2014-08-08 19:51:11 +00:00
nham
3bd158c665 Add example of estimating pi using Monte Carlo simulation to std::rand 2014-08-08 15:37:06 -04:00
Stuart Pernsteiner
0c158b4fbf don't translate items when monomorphizing foreign-ABI functions 2014-08-08 11:26:21 -07:00
bors
98f1b0fb68 auto merge of #16333 : steveklabnik/rust/guide_strings, r=brson
I _think_ this is the right place to introduce strings. It's a bit hard to talk about without understanding pointers and ownership, but you need to have some idea of what's going on...
2014-08-08 18:06:11 +00:00
Ruud van Asseldonk
c56fa5f266 libcore: Fix documentation comment for f32. 2014-08-08 18:30:23 +02:00
bors
ca89cfb0e3 auto merge of #16255 : steveklabnik/rust/guide_methods, r=nikomatsakis
Shifting some things around here, as I think this is a better order.
2014-08-08 16:21:10 +00:00
Steve Klabnik
50ffe0ccab Guide: method syntax 2014-08-08 10:39:48 -04:00
bors
86decf638e auto merge of #16327 : mdinger/rust/typo, r=steveklabnik
Fix typo. It's possible it's `These modules` but I think it's supposed to be singular because it's not refering to nested modules.
2014-08-08 14:36:10 +00:00
bors
67a05bd793 auto merge of #16349 : nikomatsakis/rust/snapshot-20140808, r=nikomatsakis 2014-08-08 12:51:13 +00:00
Falco Hirschenberger
6b9a202899 Adding test for issue #15917 which was previously fixed with #15709 2014-08-08 14:18:10 +02:00
Niko Matsakis
4fd797e757 Register new snapshot 12e0f72 2014-08-08 07:55:00 -04:00
bors
3b1f983584 auto merge of #16325 : froydnj/rust/vec-grammar-fix, r=alexcrichton
Just a small typo noticed while reading through documentation.
2014-08-08 11:06:12 +00:00
Chris Nixon
c377f9e3d4 Move system header includes above valgrind.h include
This allows rustc to be build under msys2's mingw64 gcc
2014-08-08 10:42:41 +01:00
bors
1272a83bfa auto merge of #16321 : gioele/rust/use-local-rust, r=brson
This commit makes the configuration system autodetect a `rustc` that
is already installed and use that instead of downloading a snapshot.
2014-08-08 09:11:13 +00:00
bors
c5b8d89b27 auto merge of #16309 : steveklabnik/rust/guide_tasks, r=brson
I wasn't 100% sure of what level of detail I wanted to go into things here. For example, 1:1 vs M:N tasks seems like a better distinction to leave to the Guide.
2014-08-08 07:26:15 +00:00
Vadim Chugunov
d1e03b3bb7 Implement Win64 system ABI. 2014-08-07 23:11:55 -07:00
Eduardo Bautista
b1428279f1 Single curly braces instead of double are being used 2014-08-08 00:52:09 -05:00
Eduardo Bautista
59f23aec07 Update error message on compile 2014-08-08 00:47:47 -05:00
bors
0ba2d04224 auto merge of #16279 : nham/rust/fix_slice_docs, r=alexcrichton
This does a few things:

 - remove references to ~[] and the OwnedVector trait, which are both
   obsolete
 - correct the docs to say that this is the slice module, not the vec
   module
 - add a sentence pointing out that vectors are distinct from Vec
 - remove documentation on Vec.

closes #15459
2014-08-08 05:41:15 +00:00
bors
aae7901a78 auto merge of #16285 : alexcrichton/rust/rename-share, r=huonw
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use`
statement, but the `NoShare` struct is no longer part of `std::kinds::marker`
due to #12660 (the build cannot bootstrap otherwise).

All code referencing the `Share` trait should now reference the `Sync` trait,
and all code referencing the `NoShare` type should now reference the `NoSync`
type. The functionality and meaning of this trait have not changed, only the
naming.

Closes #16281
[breaking-change]
2014-08-08 03:51:15 +00:00
nham
cb0aa8ac71 Cleanup collections::slice documentation.
This does a few things:

 - remove references to ~[] and the OwnedVector trait, which are both
   obsolete
 - correct the docs to say that this is the slice module, not the vec
   module
 - add a sentence pointing out that vectors are distinct from Vec
 - remove documentation on Vec.

closes #15459
2014-08-07 23:45:39 -04:00
Alex Crichton
d9038fc3b3 rustdoc: Set a nonzero exit status on failure
Now that rustdoc is spawning a child task, the program won't exit with a default
error code if the main task fails (because it never fails). This commit forces
the main task to wait for a child task in order to correctly propagate failure.

Closes #16341
2014-08-07 20:19:18 -07:00
Daniel Micay
3cbff72da2 enable PIE by default on Linux for full ASLR
Rust already builds all code as position independent by default, so the
linker can be told to build a position independent executable if it's
not disabled with `-C relocation-model=dynamic-no-pic`. Position
independent code does have a significant cost on i686 (not on x86_64 or
ARM) but there's no significant cost to linking code that's already
position independent as a position independent executable.

Address space layout randomization makes exploiting vulnerabilities much
more difficult by providing a statistical defence against an attempt to
find or modify existing code / data. Without ASLR, it's trivial to use a
vulnerability to take over control of the process via return-oriented
programming.

Rust code can be used for return-oriented programming whether it is safe
or unsafe, so even a fully safe application needs to be built as a
position independent executable to defend against vulnerabilities in
unsafe blocks or C libraries.

Sample program:

    extern crate libc;

    use std::mem;

    static mut global: u32 = 5;
    static constant: u32 = 5;
    fn foo() {}

    fn main() {
        let local = 5;
        println!("stack: {}, global: {}, constant: {}, fn: {}, lib fn: {}",
                 &local as *const u32,
                 unsafe { &global as *const u32 },
                 &constant as *const u32,
                 unsafe { mem::transmute::<_, *const ()>(foo) },
                 unsafe { mem::transmute::<_, *const ()>(libc::mprotect) });
    }

Before:

    stack: 0x3ff15eb9f94, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x32749547530
    stack: 0x3b5d47d80e4, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x394469a7530
    stack: 0x3fe2c4e5564, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x399734a2530
    stack: 0x3e525e0fb24, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x2f62a810530
    stack: 0x3b50fb3eae4, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x2e590e86530

After:

    stack: 0x38cf12c90a4, global: 0x3e2d46b488, constant: 0x3e2d23cf80, fn: 0x3e2d1c2510, lib fn: 0x2617d3b4530
    stack: 0x3d733faf474, global: 0x7eb1839488, constant: 0x7eb160af80, fn: 0x7eb1590510, lib fn: 0x32d30c1f530
    stack: 0x3bb42212ec4, global: 0x5bbb365488, constant: 0x5bbb136f80, fn: 0x5bbb0bc510, lib fn: 0x3595e6c1530
    stack: 0x39f678c1ab4, global: 0x22c4e3c488, constant: 0x22c4c0df80, fn: 0x22c4b93510, lib fn: 0x3835b727530
    stack: 0x3afb25bd394, global: 0x493eab2488, constant: 0x493e883f80, fn: 0x493e809510, lib fn: 0x3478d6a7530

This may also be necessary on other platforms, but I can only test on
Linux right now. Note that GDB gained support for debugging position
independent executables in version 7.1 (March 2010).
2014-08-07 22:57:00 -04:00
bors
87d2bf400c auto merge of #16273 : steveklabnik/rust/guide_generics, r=brson 2014-08-08 02:01:16 +00:00
bors
8888d7c8e9 auto merge of #16206 : steveklabnik/rust/guide_lambdas, r=brson 2014-08-07 23:36:17 +00:00
Steve Klabnik
dac73ad3c1 Guide: Traits 2014-08-07 18:12:36 -04:00
bors
12e0f72f51 auto merge of #16334 : nikomatsakis/rust/mission-snapshot, r=achrichto 2014-08-07 21:51:19 +00:00
Niko Matsakis
1fcc4f9c5f Remove spawn-stack-too-big.rs, which is too flaky. 2014-08-07 16:53:58 -04:00
Peter Atashian
24ebbb4420 windows: Fix INVALID_HANDLE_VALUE
Made INVALID_HANDLE_VALUE actually a HANDLE.
Removed all useless casts during INVALID_HANDLE_VALUE comparisons.

Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-07 16:40:12 -04:00
Steve Klabnik
e0fa999891 Guide: strings 2014-08-07 16:37:39 -04:00
Steve Klabnik
b1435ed593 Guide: tasks 2014-08-07 15:21:57 -04:00
mdinger
0582a2d6e7 Fix typo 2014-08-07 15:14:16 -04:00
bors
50834e7de4 auto merge of #16317 : adrienbrault/rust/patch-1, r=kballard 2014-08-07 18:56:11 +00:00
Steve Klabnik
aa8602e20a Guide: closures 2014-08-07 14:11:14 -04:00
bors
4879ca7924 auto merge of #15831 : rpjohnst/rust/generic-foreign-fns, r=alexcrichton
This allows for things like this:

    extern "C" fn callback<T>(t: T) { /* ... */ }
    extern "C" {
        fn take_callback(c: extern fn(i32));
    }

and later:

    take_callback(callback::<i32>);

Closes #12502.
2014-08-07 15:56:43 +00:00
Alex Crichton
1f760d5d1a Rename Share to Sync
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use`
statement, but the `NoShare` struct is no longer part of `std::kinds::marker`
due to #12660 (the build cannot bootstrap otherwise).

All code referencing the `Share` trait should now reference the `Sync` trait,
and all code referencing the `NoShare` type should now reference the `NoSync`
type. The functionality and meaning of this trait have not changed, only the
naming.

Closes #16281
[breaking-change]
2014-08-07 08:54:38 -07:00
Nathan Froyd
0d974eecd3 fix grammar in Vec.retain's doc comment 2014-08-07 11:27:06 -04:00
Gioele Barabucci
ddeb3db872 Use system rustc if configured with --enable-local-rust
This commit makes the configuration system autodetect a rustc that
is already installed and use that instead of downloading a snapshot.
2014-08-07 15:55:10 +02:00
Huon Wilson
3826026f98 rustc: gensym the module names for --test to avoid introducing user-accessible names.
This requires avoiding `quote_...!` for constructing the parts of the
__test module, since that stringifies and reinterns the idents, losing
the special gensym'd nature of them. (#15962.)
2014-08-07 21:54:13 +10:00
bors
8a02304a44 auto merge of #16318 : nikomatsakis/rust/issue-5723-bootstrap-2, r=pnkfelix
Introduce syntax for lifetime bounds like `'b:'a`, meaning `'b outlives 'a`. Syntax currently does nothing but is needed for full fix to #5763. To use this syntax, the issue_5763_bootstrap feature guard is required.
2014-08-07 11:31:05 +00:00
Niko Matsakis
fcab98038c Temporary bootstrapping hack: introduce syntax for r egion bounds like 'b:'a,
meaning `'b outlives 'a`. Syntax currently does nothing but is needed for full
fix to #5763. To use this syntax, the issue_5763_bootstrap feature guard is
required.
2014-08-07 07:23:59 -04:00
Peter Atashian
feb219d23f windows: Fix several tests on 64-bit.
Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-07 04:05:00 -04:00