Commit Graph

40982 Commits

Author SHA1 Message Date
Manish Goregaokar
b3c9331c25 Rollup merge of #24240 - apasel422:patch-1, r=aturon 2015-04-11 19:03:56 +05:30
Manish Goregaokar
55610d64d1 Rollup merge of #24239 - steveklabnik:editing_pass, r=steveklabnik
Now that the new TOC has landed, I've started doing an editing pass to get the old content into the right shape. I felt this introduction was significant enough to send as its own PR, though, as it's the introduction.

It's possible that we may just want to replace 'the intro' with this directly, but this PR doesn't do that.
2015-04-11 19:03:50 +05:30
Manish Goregaokar
f99341a8e0 Rollup merge of #24236 - aturon:issue-19097, r=alexcrichton
Closes #19097
2015-04-11 19:03:43 +05:30
Manish Goregaokar
f5d6cae3fc Rollup merge of #24234 - thiagooak:academic-research, r=steveklabnik
#24004

Something like this?
2015-04-11 19:03:36 +05:30
Manish Goregaokar
c4a7d9b15c Rollup merge of #24121 - steveklabnik:gh24107, r=steveklabnik 2015-04-11 19:03:29 +05:30
Manish Goregaokar
719ad518ff Rollup merge of #24285 - brson:rustup, r=alexcrichton
Now lives at https://github.com/rust-lang/rustup

r? @alexcrichton
2015-04-11 19:03:20 +05:30
Manish Goregaokar
872de9c71f Rollup merge of #24269 - benashford:formatting-fix, r=alexcrichton
This fixes the bug described in issue #23150.  This affected formatting any floating point number into a string in a formatting pattern that: a) required rounding up, and b) required an extra digit on the front.

So `format!(\"{:.0}\", 9.9)` would fail, but `format!(\"{:.0}\", 8.9)` would succeed.  This was due to a negative integer being cast to a `usize` resulting in an 'arithmetic operation overflowed' panic.

The fix was to change the order of operations so that the number is zero before casting.
2015-04-11 19:03:13 +05:30
Manish Goregaokar
1737957e19 Rollup merge of #24268 - pnkfelix:regression-tests, r=alexcrichton
A pair of regression tests for issues that seem to have been fixed since they were originally filed.
2015-04-11 19:03:04 +05:30
bors
0be4e0ec50 Auto merge of #24155 - chris-chambers:stmt_macros, r=sfackler
Statement macros are now treated somewhat like item macros, in that a statement macro can now expand into a series of statements, rather than just a single statement.

This allows statement macros to be nested inside other kinds of macros and expand properly, where previously the expansion would only work when no nesting was present.

See:
- `src/test/run-pass/macro-stmt_macro_in_expr_macro.rs`
- `src/test/run-pass/macro-nested_stmt_macro.rs`

This changes the interface of the MacResult trait.  make_stmt has become make_stmts and now returns a vector, rather than a single item.  Plugin writers who were implementing MacResult will have breakage, as well as anyone using MacEager::stmt.

See:
- `src/libsyntax/ext/base.rs`

This also causes a minor difference in behavior to the diagnostics produced by certain malformed macros.

See:
- `src/test/compile-fail/macro-incomplete-parse.rs`
2015-04-11 08:07:34 +00:00
Christopher Chambers
77627ea8dd Moves expand_stmt's bt_pop so that it balances correctly. 2015-04-11 00:59:00 -05:00
bors
3a8275397a Auto merge of #24254 - aturon:join-handle-debug, r=alexcrichton
Make `Box<Any + Send>` implement `Debug`.

Fixes #21291
2015-04-11 05:57:55 +00:00
Christopher Chambers
22eb3193a6 Simplifications to statement macro handling.
SmallVector::pop no longer worries about converting a Many repr downward
to One or Zero.

expand_stmt makes use of `if let` for style purposes.
2015-04-10 23:42:40 -05:00
Christopher Chambers
fae29e497c Eliminates a pointless is_empty test. 2015-04-10 22:20:01 -05:00
Christopher Chambers
b16cfacbcc Improves semicolon expansion efficiency, corrects bt_pop placement.
Implements pop() on SmallVector, and uses it to expand the final semicolon
in a statement macro expansion more efficiently.

Corrects the placement of the call to fld.cx.bt_pop().  It must run
unconditionally to reverse the corresponding push.
2015-04-10 21:50:23 -05:00
bors
c87ec1edb1 Auto merge of #24186 - richo:pad-pointers, r=alexcrichton
This pads out the printing of pointers to their native width.

Extracted from and rebased on top of #24144
2015-04-11 01:59:18 +00:00
bors
93f7fe32d3 Auto merge of #24270 - pnkfelix:use-disr-val-for-derive-ord, r=brson
Use `discriminant_value` intrinsic for `derive(PartialOrd)`

[breaking-change]

This is a [breaking-change] because it can change the result of comparison operators when enum discriminants have been explicitly assigned.  Notably in a case like:
```rust
#[derive(PartialOrd)]
enum E { A = 2, B = 1}
```

Under the old deriving, `A < B` held, because `A` came before `B` in the order of declaration.  But now we use the ordering according to the provided values, and thus `A > B`.  (However, this change is very unlikely to break much, if any, code, since the orderings themselves should all remain well-defined, total, etc.)

Fix #15523
2015-04-10 23:49:24 +00:00
Felix S. Klock II
05aaad114f Remove pretty-expanded from 2 tests; deriving(Ord) uses unstable intrinsic. 2015-04-11 00:50:59 +02:00
Felix S. Klock II
847a897fb3 fix some comments. 2015-04-10 19:13:34 +02:00
Felix S. Klock II
47016f9ce5 Test case for 64-bit corner cases where truncation occurred before prior commit. 2015-04-10 19:11:03 +02:00
Felix S. Klock II
781fc902a4 Incorporate repr-attr into deriving(PartialOrd) to avoid truncation errors.
remove out of date fixme.
2015-04-10 19:11:00 +02:00
Brian Anderson
a0f832da52 Remove rustup.sh.
Now lives at https://github.com/rust-lang/rustup
2015-04-10 10:01:04 -07:00
Steve Klabnik
288b1c9aba Add examples for Convert 2015-04-10 12:44:20 -04:00
bors
c897ac04e2 Auto merge of #24177 - alexcrichton:rustdoc, r=aturon
This commit series starts out with more official test harness support for rustdoc tests, and then each commit afterwards adds a test (where appropriate). Each commit should also test and finish independently of all others (they're all pretty separable).

I've uploaded a [copy of the documentation](http://people.mozilla.org/~acrichton/doc/std/) generated after all these commits were applied, and a double check on issues being closed would be greatly appreciated! I'll also browse the docs a bit and make sure nothing regressed too horribly.
2015-04-10 16:18:44 +00:00
Felix S. Klock II
afb7acff57 Re-add a fixme after some investigation into what's going on. 2015-04-10 16:32:31 +02:00
Felix S. Klock II
c44d40e77f Test case for new derive(PartialOrd) expansion. 2015-04-10 16:32:27 +02:00
Felix S. Klock II
6118795ee1 Change derive expansions to use discriminant_value intrinsic.
Fix #15523.
2015-04-10 16:20:18 +02:00
Felix S. Klock II
ea2739176b Rebase discriminant_value test. Add case for a specialized repr. 2015-04-10 16:14:00 +02:00
Felix S. Klock II
fb6d780dbe Regression test for Issue 21486.
Fix #21486
2015-04-10 15:35:19 +02:00
Felix S. Klock II
6c2a9910c7 Regression test for Issue 21400.
Fix #21400.
2015-04-10 15:34:34 +02:00
bors
9539627ac7 Auto merge of #24034 - alexcrichton:cloexec, r=aturon
The commit messages have more details as to what's going on, but this is a breaking change for any libraries which expect file descriptors to be inherited by default.

Closes #12148
2015-04-10 12:42:46 +00:00
Ben Ashford
faef52a847 Fix for #23150 2015-04-10 13:19:14 +01:00
James Miller
800c5f8038 Add test for discriminant_value results 2015-04-10 12:23:37 +02:00
James Miller
41dd35503a Implement discriminant_value intrinsic
Implements an intrinsic for extracting the value of the discriminant
enum variant values. For non-enum types, this returns zero, otherwise it
returns the value we use for discriminant comparisons. This means that
enum types that do not have a discriminant will also work in this
arrangement.

This is (at least part of) the work on Issue #24263
2015-04-10 12:23:08 +02:00
Alex Crichton
eadc3bcd67 std: Unconditionally close all file descriptors
The logic for only closing file descriptors >= 3 was inherited from quite some
time ago and ends up meaning that some internal APIs are less consistent than
they should be. By unconditionally closing everything entering a `FileDesc` we
ensure that we're consistent in our behavior as well as robustly handling the
stdio case.
2015-04-10 01:03:38 -07:00
Alex Crichton
445faca844 Test fixes and review feedback 2015-04-10 00:58:10 -07:00
bors
e4f9ddb878 Auto merge of #24180 - huonw:optimise-max-etc, r=alexcrichton
The main change in this patch is removing the use of `Option` inside the
inner loops of those functions to avoid comparisons where one branch
will only trigger on the first pass through the loop.

The included benchmarks go from:

    test bench_max    ... bench:       372 ns/iter (+/- 118)
    test bench_max_by ... bench:       428 ns/iter (+/- 33)
    test bench_max_by2 ... bench:      7128 ns/iter (+/- 326)

to:

    test bench_max    ... bench:       317 ns/iter (+/- 64)
    test bench_max_by ... bench:       356 ns/iter (+/- 270)
    test bench_max_by2 ... bench:      1387 ns/iter (+/- 183)

Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-10 07:54:18 +00:00
Huon Wilson
c2258d6d04 Optimise Iterator::{max, max_by, min, min_by}.
The main change in this patch is removing the use of `Option` inside the
inner loops of those functions to avoid comparisons where one branch
will only trigger on the first pass through the loop.

The included benchmarks go from:

    test bench_max    ... bench:       372 ns/iter (+/- 118)
    test bench_max_by ... bench:       428 ns/iter (+/- 33)
    test bench_max_by2 ... bench:      7128 ns/iter (+/- 326)

to:

    test bench_max    ... bench:       317 ns/iter (+/- 64)
    test bench_max_by ... bench:       356 ns/iter (+/- 270)
    test bench_max_by2 ... bench:      1387 ns/iter (+/- 183)

Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
2015-04-10 14:42:17 +10:00
Richo Healey
64da4e171d fmt: Assume that we'll only ever see 32 or 64 bit pointers 2015-04-09 18:06:01 -07:00
Richo Healey
d8bb08037f test: Unignore test for fixed issue #20676 2015-04-09 18:03:48 -07:00
Richo Healey
333eb85d4b fmt: {:p#} formats pointers padded to native width 2015-04-09 18:03:47 -07:00
Aaron Turon
76d468ae26 Ensure that .join().unwrap() works
Makes `Any + Send` implement `Debug`.

Fixes #21291
2015-04-09 17:33:17 -07:00
Alex Crichton
33a2191d0b std: Clean up process spawn impl on unix
* De-indent quite a bit by removing usage of FnOnce closures
* Clearly separate code for the parent/child after the fork
* Use `fs2::{File, OpenOptions}` instead of calling `open` manually
* Use RAII to close I/O objects wherever possible
* Remove loop for closing all file descriptors, all our own ones are now
  `CLOEXEC` by default so they cannot be inherited
2015-04-09 17:09:37 -07:00
Alex Crichton
d6c72306c8 std: Set CLOEXEC for all fds opened on unix
This commit starts to set the CLOEXEC flag for all files and sockets opened by
the standard library by default on all unix platforms. There are a few points of
note in this commit:

* The implementation is not 100% satisfactory in the face of threads. File
  descriptors only have the `F_CLOEXEC` flag set *after* they are opened,
  allowing for a fork/exec to happen in the middle and leak the descriptor.
  Some platforms do support atomically opening a descriptor while setting the
  `CLOEXEC` flag, and it is left as a future extension to bind these apis as it
  is unclear how to do so nicely at this time.

* The implementation does not offer a method of opting into the old behavior of
  not setting `CLOEXEC`. This will possibly be added in the future through
  extensions on `OpenOptions`, for example.

* This change does not yet audit any Windows APIs to see if the handles are
  inherited by default by accident.

This is a breaking change for users who call `fork` or `exec` outside of the
standard library itself and expect file descriptors to be inherted. All file
descriptors created by the standard library will no longer be inherited.

[breaking-change]
2015-04-09 17:07:02 -07:00
bors
6b95d8bed8 Auto merge of #24205 - brson:debug, r=alexcrichton
This makes the default configuration fully optimized, with no debugging options, no llvm asserts, renames --enable-debug to --enable-debug-assertions, and adds --enable-debug as a blanket option that toggles various things, per #17665. It does not add a `--enable-release` flag since that would be a no-op.

cc @nrc

Fixes https://github.com/rust-lang/rust/issues/22390
Fixes https://github.com/rust-lang/rust/issues/17081
Partially addresses https://github.com/rust-lang/rust/issues/17665
2015-04-09 23:52:02 +00:00
Steve Klabnik
bf88539cc9 TRPL: new introduction 2015-04-09 19:39:06 -04:00
bors
88fc543866 Auto merge of #24232 - Manishearth:rollup, r=Manishearth
None
2015-04-09 20:38:36 +00:00
Manish Goregaokar
ea731797b8 fixup windows std_misc 2015-04-10 02:09:19 +05:30
Manish Goregaokar
53a609b1df Rollup merge of #24217 - aturon:iterator-fixes, r=alexcrichton 2015-04-10 00:24:45 +05:30
Manish Goregaokar
ede25fe5d1 Rollup merge of #24225 - nrc:for-span, r=pnkfelix 2015-04-10 00:24:45 +05:30
Manish Goregaokar
ce825ab37b Rollup merge of #24170 - omo:omo-typo-fix, r=steveklabnik
Can anyone take a look? Very trivial.
2015-04-10 00:24:45 +05:30