]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoRollup merge of #24234 - thiagooak:academic-research, r=steveklabnik
Manish Goregaokar [Sat, 11 Apr 2015 13:33:36 +0000 (19:03 +0530)]
Rollup merge of #24234 - thiagooak:academic-research, r=steveklabnik

 #24004

Something like this?

9 years agoRollup merge of #24121 - steveklabnik:gh24107, r=steveklabnik
Manish Goregaokar [Sat, 11 Apr 2015 13:33:29 +0000 (19:03 +0530)]
Rollup merge of #24121 - steveklabnik:gh24107, r=steveklabnik

9 years agoRollup merge of #24285 - brson:rustup, r=alexcrichton
Manish Goregaokar [Sat, 11 Apr 2015 13:33:20 +0000 (19:03 +0530)]
Rollup merge of #24285 - brson:rustup, r=alexcrichton

 Now lives at https://github.com/rust-lang/rustup

r? @alexcrichton

9 years agoRollup merge of #24269 - benashford:formatting-fix, r=alexcrichton
Manish Goregaokar [Sat, 11 Apr 2015 13:33:13 +0000 (19:03 +0530)]
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.

9 years agoRollup merge of #24268 - pnkfelix:regression-tests, r=alexcrichton
Manish Goregaokar [Sat, 11 Apr 2015 13:33:04 +0000 (19:03 +0530)]
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.

9 years agoAuto merge of #24155 - chris-chambers:stmt_macros, r=sfackler
bors [Sat, 11 Apr 2015 08:07:34 +0000 (08:07 +0000)]
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`

9 years agoMoves expand_stmt's bt_pop so that it balances correctly.
Christopher Chambers [Sat, 11 Apr 2015 05:59:00 +0000 (00:59 -0500)]
Moves expand_stmt's bt_pop so that it balances correctly.

9 years agoAuto merge of #24254 - aturon:join-handle-debug, r=alexcrichton
bors [Sat, 11 Apr 2015 05:57:55 +0000 (05:57 +0000)]
Auto merge of #24254 - aturon:join-handle-debug, r=alexcrichton

Make `Box<Any + Send>` implement `Debug`.

Fixes #21291

9 years agoSimplifications to statement macro handling.
Christopher Chambers [Sat, 11 Apr 2015 04:06:34 +0000 (23:06 -0500)]
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.

9 years agoEliminates a pointless is_empty test.
Christopher Chambers [Sat, 11 Apr 2015 03:20:01 +0000 (22:20 -0500)]
Eliminates a pointless is_empty test.

9 years agoImproves semicolon expansion efficiency, corrects bt_pop placement.
Christopher Chambers [Sat, 11 Apr 2015 02:50:23 +0000 (21:50 -0500)]
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.

9 years agoAuto merge of #24186 - richo:pad-pointers, r=alexcrichton
bors [Sat, 11 Apr 2015 01:59:18 +0000 (01:59 +0000)]
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

9 years agoAuto merge of #24270 - pnkfelix:use-disr-val-for-derive-ord, r=brson
bors [Fri, 10 Apr 2015 23:49:24 +0000 (23:49 +0000)]
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

9 years agoRemove pretty-expanded from 2 tests; deriving(Ord) uses unstable intrinsic.
Felix S. Klock II [Fri, 10 Apr 2015 22:50:59 +0000 (00:50 +0200)]
Remove pretty-expanded from 2 tests; deriving(Ord) uses unstable intrinsic.

9 years agofix some comments.
Felix S. Klock II [Fri, 10 Apr 2015 17:13:34 +0000 (19:13 +0200)]
fix some comments.

9 years agoTest case for 64-bit corner cases where truncation occurred before prior commit.
Felix S. Klock II [Fri, 10 Apr 2015 17:02:01 +0000 (19:02 +0200)]
Test case for 64-bit corner cases where truncation occurred before prior commit.

9 years agoIncorporate repr-attr into deriving(PartialOrd) to avoid truncation errors.
Felix S. Klock II [Fri, 10 Apr 2015 17:00:38 +0000 (19:00 +0200)]
Incorporate repr-attr into deriving(PartialOrd) to avoid truncation errors.

remove out of date fixme.

9 years agoRemove rustup.sh.
Brian Anderson [Fri, 10 Apr 2015 17:01:04 +0000 (10:01 -0700)]
Remove rustup.sh.

Now lives at https://github.com/rust-lang/rustup

9 years agoAdd examples for Convert
Steve Klabnik [Mon, 6 Apr 2015 18:25:39 +0000 (14:25 -0400)]
Add examples for Convert

9 years agoAuto merge of #24177 - alexcrichton:rustdoc, r=aturon
bors [Fri, 10 Apr 2015 16:18:44 +0000 (16:18 +0000)]
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.

9 years agoRe-add a fixme after some investigation into what's going on.
Felix S. Klock II [Fri, 10 Apr 2015 14:26:11 +0000 (16:26 +0200)]
Re-add a fixme after some investigation into what's going on.

9 years agoTest case for new `derive(PartialOrd)` expansion.
Felix S. Klock II [Fri, 10 Apr 2015 14:17:06 +0000 (16:17 +0200)]
Test case for new `derive(PartialOrd)` expansion.

9 years agoChange `derive` expansions to use `discriminant_value` intrinsic.
Felix S. Klock II [Fri, 10 Apr 2015 14:15:12 +0000 (16:15 +0200)]
Change `derive` expansions to use `discriminant_value` intrinsic.

Fix #15523.

9 years agoRebase discriminant_value test. Add case for a specialized repr.
Felix S. Klock II [Fri, 10 Apr 2015 14:14:00 +0000 (16:14 +0200)]
Rebase discriminant_value test. Add case for a specialized repr.

9 years agoRegression test for Issue 21486.
Felix S. Klock II [Fri, 10 Apr 2015 13:35:19 +0000 (15:35 +0200)]
Regression test for Issue 21486.

Fix #21486

9 years agoRegression test for Issue 21400.
Felix S. Klock II [Fri, 10 Apr 2015 13:34:34 +0000 (15:34 +0200)]
Regression test for Issue 21400.

Fix #21400.

9 years agoAuto merge of #24034 - alexcrichton:cloexec, r=aturon
bors [Fri, 10 Apr 2015 12:42:46 +0000 (12:42 +0000)]
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

9 years agoFix for #23150
Ben Ashford [Fri, 10 Apr 2015 12:10:48 +0000 (13:10 +0100)]
Fix for #23150

9 years agoAdd test for discriminant_value results
James Miller [Sun, 11 Jan 2015 00:51:58 +0000 (13:51 +1300)]
Add test for discriminant_value results

9 years agoImplement `discriminant_value` intrinsic
James Miller [Sat, 10 Jan 2015 23:58:20 +0000 (12:58 +1300)]
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

9 years agostd: Unconditionally close all file descriptors
Alex Crichton [Fri, 3 Apr 2015 22:44:14 +0000 (15:44 -0700)]
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.

9 years agoTest fixes and review feedback
Alex Crichton [Wed, 8 Apr 2015 03:11:59 +0000 (20:11 -0700)]
Test fixes and review feedback

9 years agoAuto merge of #24180 - huonw:optimise-max-etc, r=alexcrichton
bors [Fri, 10 Apr 2015 07:54:18 +0000 (07:54 +0000)]
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/

9 years agoOptimise Iterator::{max, max_by, min, min_by}.
Huon Wilson [Wed, 8 Apr 2015 04:25:22 +0000 (14:25 +1000)]
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/

9 years agofmt: Assume that we'll only ever see 32 or 64 bit pointers
Richo Healey [Fri, 10 Apr 2015 01:06:01 +0000 (18:06 -0700)]
fmt: Assume that we'll only ever see 32 or 64 bit pointers

9 years agotest: Unignore test for fixed issue #20676
Richo Healey [Thu, 9 Apr 2015 00:48:19 +0000 (17:48 -0700)]
test: Unignore test for fixed issue #20676

9 years agofmt: {:p#} formats pointers padded to native width
Richo Healey [Wed, 8 Apr 2015 00:53:55 +0000 (17:53 -0700)]
fmt: {:p#} formats pointers padded to native width

9 years agoEnsure that .join().unwrap() works
Aaron Turon [Fri, 10 Apr 2015 00:23:49 +0000 (17:23 -0700)]
Ensure that .join().unwrap() works

Makes `Any + Send` implement `Debug`.

Fixes #21291

9 years agostd: Clean up process spawn impl on unix
Alex Crichton [Fri, 3 Apr 2015 22:34:15 +0000 (15:34 -0700)]
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

9 years agostd: Set CLOEXEC for all fds opened on unix
Alex Crichton [Fri, 3 Apr 2015 22:30:10 +0000 (15:30 -0700)]
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]

9 years agoAuto merge of #24205 - brson:debug, r=alexcrichton
bors [Thu, 9 Apr 2015 23:52:02 +0000 (23:52 +0000)]
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

9 years agoAuto merge of #24232 - Manishearth:rollup, r=Manishearth
bors [Thu, 9 Apr 2015 20:38:36 +0000 (20:38 +0000)]
Auto merge of #24232 - Manishearth:rollup, r=Manishearth

None

9 years agofixup windows std_misc
Manish Goregaokar [Thu, 9 Apr 2015 20:39:19 +0000 (02:09 +0530)]
fixup windows std_misc

9 years agoRollup merge of #24217 - aturon:iterator-fixes, r=alexcrichton
Manish Goregaokar [Thu, 9 Apr 2015 16:00:06 +0000 (21:30 +0530)]
Rollup merge of #24217 - aturon:iterator-fixes, r=alexcrichton

9 years agoRollup merge of #24225 - nrc:for-span, r=pnkfelix
Manish Goregaokar [Thu, 9 Apr 2015 10:25:18 +0000 (15:55 +0530)]
Rollup merge of #24225 - nrc:for-span, r=pnkfelix

9 years agoRollup merge of #24170 - omo:omo-typo-fix, r=steveklabnik
Manish Goregaokar [Thu, 9 Apr 2015 10:25:12 +0000 (15:55 +0530)]
Rollup merge of #24170 - omo:omo-typo-fix, r=steveklabnik

 Can anyone take a look? Very trivial.

9 years agoRollup merge of #24221 - nrc:debug-loc, r=sfackler
Manish Goregaokar [Thu, 9 Apr 2015 10:25:05 +0000 (15:55 +0530)]
Rollup merge of #24221 - nrc:debug-loc, r=sfackler

9 years agoRollup merge of #24218 - lstat:remove-ignore-tidy, r=alexcrichton
Manish Goregaokar [Thu, 9 Apr 2015 10:24:58 +0000 (15:54 +0530)]
Rollup merge of #24218 - lstat:remove-ignore-tidy, r=alexcrichton

 This is a really minor issue. I noticed some tests no longer need the ignore
tidy comment directive.

A quick grep turned up the following files:

    src/test/compile-fail/bad-mid-path-type-params.rs
    src/test/compile-fail/bad-sized.rs
    src/test/compile-fail/coherence-default-trait-impl.rs
    src/test/compile-fail/coherence-orphan.rs
    src/test/compile-fail/issue-8767.rs
    src/test/compile-fail/lint-stability.rs
    src/test/compile-fail/lint-uppercase-variables.rs
    src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs
    src/test/compile-fail/use-after-move-implicity-coerced-object.rs
    src/test/debuginfo/gdb-pretty-std.rs

It didn't seem like it was worth opening an issue for this, but if that is not
the case (i.e. it is required), I'll open one up. Thanks!

9 years agoRollup merge of #24216 - alexcrichton:stabilize-from-raw-os-error, r=aturon
Manish Goregaokar [Thu, 9 Apr 2015 10:24:43 +0000 (15:54 +0530)]
Rollup merge of #24216 - alexcrichton:stabilize-from-raw-os-error, r=aturon

 This commit stabilizes the old `io::Error::from_os_error` after being renamed to
use the `raw_os_error` terminology instead. This function is often useful when
writing bindings to OS functions but only actually converting to an I/O error at
a later point.

9 years agoRollup merge of #24215 - alexcrichton:stabilize-clone-from, r=aturon
Manish Goregaokar [Thu, 9 Apr 2015 10:24:36 +0000 (15:54 +0530)]
Rollup merge of #24215 - alexcrichton:stabilize-clone-from, r=aturon

 This method hasn't really changed since is inception, and it can often be a
nice performance win for some situations. This method also imposes no burden on
implementors or users of `Clone` as it's just a default method on the side.

9 years agoRollup merge of #24212 - alexcrichton:destabilize-begin-unwind, r=huonw
Manish Goregaokar [Thu, 9 Apr 2015 10:24:28 +0000 (15:54 +0530)]
Rollup merge of #24212 - alexcrichton:destabilize-begin-unwind, r=huonw

 Now that we have a `#[allow_internal_unstable]` attribute for macros there's no
need for these two `begin_unwind` functions to be stable. Right now the `panic!`
interface is the only one we wish to stabilize, so remove the stability markers
from these functions.

While this is a breaking change, it is highly unlikely to break any actual code.
It is recommended to use the `panic!` macro instead if it breaks explicit calls
into `std::rt`.

[breaking-change]
cc #24208

9 years agoRollup merge of #24207 - kmcallister:llvm-plugin, r=brson
Manish Goregaokar [Thu, 9 Apr 2015 10:24:18 +0000 (15:54 +0530)]
Rollup merge of #24207 - kmcallister:llvm-plugin, r=brson

 r? @brson

I'm using this to integrate rustc with [american-fuzzy-lop](http://lcamtuf.coredump.cx/afl/). Building with afl instrumentation is no different from loading any other plugin library.

I'd like this PR to include a `run-make` test with a custom LLVM pass; however I'm not sure it's worth the trouble of building C++ code and linking LLVM from the test suite (are there existing tests that do this?)

9 years agoRollup merge of #24205 - brson:debug, r=alexcrichton
Manish Goregaokar [Thu, 9 Apr 2015 10:24:11 +0000 (15:54 +0530)]
Rollup 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

9 years agoRollup merge of #24193 - lstat:needstest, r=alexcrichton
Manish Goregaokar [Thu, 9 Apr 2015 10:24:04 +0000 (15:54 +0530)]
Rollup merge of #24193 - lstat:needstest, r=alexcrichton

 Closes #22289
Closes #22370
Closes #22384

9 years agoRollup merge of #24191 - nikomatsakis:issue-20791, r=pnkfelix
Manish Goregaokar [Thu, 9 Apr 2015 10:23:59 +0000 (15:53 +0530)]
Rollup merge of #24191 - nikomatsakis:issue-20791, r=pnkfelix

 Modify the ExprUseVisitor to walk each part of an AutoRef, and in
particular to treat an AutoUnsize as as kind of \"instantaneous\" borrow
of the value being unsized. This prevents us from feeding uninitialized
data.

This caused a problem for the eager reborrow of comparison traits,
because that wound up introducing a \"double AutoRef\", which was not
being thoroughly checked before but turned out not to type check.
Fortunately, we can just remove that \"eager reborrow\" as it is no longer
needed now that `PartialEq` doesn't force both LHS and RHS to have the
same type (and even if we did have this problem, the better way would be
to lean on introducing a common supertype).

Fixes #20791.

r? @nrc

9 years agoNightly gets LLVM assertions
Brian Anderson [Thu, 9 Apr 2015 18:51:46 +0000 (11:51 -0700)]
Nightly gets LLVM assertions

9 years agoresurrect research paper list #24004
Thiago Carvalho [Thu, 9 Apr 2015 16:07:33 +0000 (18:07 +0200)]
resurrect research paper list #24004

9 years agoImprove bounds in Iterator API
Aaron Turon [Thu, 9 Apr 2015 00:01:03 +0000 (17:01 -0700)]
Improve bounds in Iterator API

This commit changes `Iterator`'s API by:

* Generalizing bounds from `Iterator` to `IntoIterator` whenever
  possible, matching the semantics and ergonomics of `for` loops.

* Tightens up a few method-level bounds so that you get an error
  earlier. For example, `rev` did not require `DoubleEndedIterator` even
  though the result is only an `Iterator` when the original iterator was
  double-ended.

Closes #23587

The bound-tightening is technically a:

[breaking-change]

but no code should break in practice.

9 years agoAuto merge of #24176 - kballard:bufreader-seek-impl, r=aturon
bors [Thu, 9 Apr 2015 12:07:24 +0000 (12:07 +0000)]
Auto merge of #24176 - kballard:bufreader-seek-impl, r=aturon

9 years agoRollup merge of #24176 - kballard:bufreader-seek-impl, r=aturon
Manish Goregaokar [Thu, 9 Apr 2015 10:23:48 +0000 (15:53 +0530)]
Rollup merge of #24176 - kballard:bufreader-seek-impl, r=aturon

9 years agoRollup merge of #24175 - dhuseby:bitrig_fixing_tests_2, r=alexcrichton
Manish Goregaokar [Thu, 9 Apr 2015 10:23:43 +0000 (15:53 +0530)]
Rollup merge of #24175 - dhuseby:bitrig_fixing_tests_2, r=alexcrichton

 I'm not sure why this is failing.  This patch disables this test until I can figure out what is wrong.

9 years agoRollup merge of #24171 - rillian:rustup, r=brson
Manish Goregaokar [Thu, 9 Apr 2015 10:23:36 +0000 (15:53 +0530)]
Rollup merge of #24171 - rillian:rustup, r=brson

 The idea here is if you don't want rust in /usr/local
you can put something like this is your .profile:

```
export RUSTUP_PREFIX=$HOME/.local/rust
export PATH=$PATH:${RUSTUP_PREFIX}/bin
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${RUSTUP_PREFIX}/lib
```
Then when you run rustup, it will update the install
in ${RUSTUP_PREFIX} without having to remember to pass
an explicit --prefix argument every time.

9 years agoFix the span for `for` expressions
Nick Cameron [Thu, 9 Apr 2015 08:35:27 +0000 (20:35 +1200)]
Fix the span for `for` expressions

9 years agoAuto merge of #24171 - rillian:rustup, r=brson
bors [Thu, 9 Apr 2015 07:49:26 +0000 (07:49 +0000)]
Auto merge of #24171 - rillian:rustup, r=brson

The idea here is if you don't want rust in /usr/local
you can put something like this is your .profile:

```
export RUSTUP_PREFIX=$HOME/.local/rust
export PATH=$PATH:${RUSTUP_PREFIX}/bin
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${RUSTUP_PREFIX}/lib
```
Then when you run rustup, it will update the install
in ${RUSTUP_PREFIX} without having to remember to pass
an explicit --prefix argument every time.

9 years agoDebug impls for a few things in syntax::codemap
Nick Cameron [Thu, 9 Apr 2015 06:25:48 +0000 (18:25 +1200)]
Debug impls for a few things in syntax::codemap

9 years agoAuto merge of #24168 - kballard:clone-for-extern-c-unsafe-fns, r=alexcrichton
bors [Thu, 9 Apr 2015 04:56:23 +0000 (04:56 +0000)]
Auto merge of #24168 - kballard:clone-for-extern-c-unsafe-fns, r=alexcrichton

We only implemented Clone on `extern "Rust" fn`s (for up to 8
parameters). This didn't cover `extern "C"` or `unsafe` (or
`unsafe extern "C"`) `fn`s, but there's no reason why they shouldn't be
cloneable as well.

The new impls are marked unstable because the existing impl for `extern
"Rust" fn`s is.

Fixes #24161.

9 years agoImplement io::Seek for io::BufWriter<W> where W: io::Seek
Kevin Ballard [Wed, 8 Apr 2015 00:29:33 +0000 (17:29 -0700)]
Implement io::Seek for io::BufWriter<W> where W: io::Seek

Seeking the `BufWriter` writes out its internal buffer before seeking.

9 years agoImplement io::Seek for io::BufReader<R> where R: io::Seek
Kevin Ballard [Tue, 7 Apr 2015 23:01:21 +0000 (16:01 -0700)]
Implement io::Seek for io::BufReader<R> where R: io::Seek

Seeking the `BufReader` discards the internal buffer (and adjusts the
offset appropriately when seeking with `SeekFrom::Current(_)`).

9 years agoDon't deoptimize llvm when --enable-debug
Brian Anderson [Thu, 9 Apr 2015 01:01:46 +0000 (18:01 -0700)]
Don't deoptimize llvm when --enable-debug

libLTO fails to link here.

9 years agoAuto merge of #24158 - sanxiyn:cast, r=nrc
bors [Thu, 9 Apr 2015 01:00:37 +0000 (01:00 +0000)]
Auto merge of #24158 - sanxiyn:cast, r=nrc

Fix #13993.
Fix #17167.

9 years agoRemove pretty-expanded from failing tests
Alex Crichton [Wed, 8 Apr 2015 23:27:10 +0000 (16:27 -0700)]
Remove pretty-expanded from failing tests

This commit removes pretty-expanded from all tests that wind up calling panic!
one way or another now that its internals are unstable.

9 years agostd: Stabilize io::Error::from_raw_os_error
Alex Crichton [Wed, 8 Apr 2015 23:41:14 +0000 (16:41 -0700)]
std: Stabilize io::Error::from_raw_os_error

This commit stabilizes the old `io::Error::from_os_error` after being renamed to
use the `raw_os_error` terminology instead. This function is often useful when
writing bindings to OS functions but only actually converting to an I/O error at
a later point.

9 years agostd: Stabilize Clone::clone_from
Alex Crichton [Wed, 8 Apr 2015 23:38:38 +0000 (16:38 -0700)]
std: Stabilize Clone::clone_from

This method hasn't really changed since is inception, and it can often be a
nice performance win for some situations. This method also imposes no burden on
implementors or users of `Clone` as it's just a default method on the side.

9 years agostd: Destabilize the internals of panic!
Alex Crichton [Wed, 8 Apr 2015 22:48:46 +0000 (15:48 -0700)]
std: Destabilize the internals of panic!

Now that we have a `#[allow_internal_unstable]` attribute for macros there's no
need for these two `begin_unwind` functions to be stable. Right now the `panic!`
interface is the only one we wish to stabilize, so remove the stability markers
from these functions.

While this is a breaking change, it is highly unlikely to break any actual code.
It is recommended to use the `panic!` macro instead if it breaks explicit calls
into `std::rt`.

[breaking-change]
cc #24208

9 years agoRemove `ignore-tidy-linelength` from tests that no longer need it
Luke Gallagher [Wed, 8 Apr 2015 22:20:51 +0000 (08:20 +1000)]
Remove `ignore-tidy-linelength` from tests that no longer need it

9 years agoconfigure: Add --enable-debug-jemalloc
Brian Anderson [Wed, 8 Apr 2015 22:12:08 +0000 (15:12 -0700)]
configure: Add --enable-debug-jemalloc

9 years agoAuto merge of #24144 - richo:ptr-formatter, r=alexcrichton
bors [Wed, 8 Apr 2015 22:08:31 +0000 (22:08 +0000)]
Auto merge of #24144 - richo:ptr-formatter, r=alexcrichton

~~I believe this should fix the issue. Opening a PR to ensure noone duplicates effort, I'm running check now.~~

Closes #24091

9 years agoAdd --enable-debug to control multiple perf options
Brian Anderson [Wed, 8 Apr 2015 21:21:36 +0000 (14:21 -0700)]
Add --enable-debug to control multiple perf options

9 years agoAllow plugins to register LLVM passes
Keegan McAllister [Wed, 8 Apr 2015 19:52:58 +0000 (12:52 -0700)]
Allow plugins to register LLVM passes

9 years agoconfigure: Add --enable-debuginfo
Brian Anderson [Wed, 8 Apr 2015 20:57:37 +0000 (13:57 -0700)]
configure: Add --enable-debuginfo

9 years agoconfigure: Clarify --enable-debug-assertions status message
Brian Anderson [Wed, 8 Apr 2015 20:31:26 +0000 (13:31 -0700)]
configure: Clarify --enable-debug-assertions status message

9 years agoconfigure: Disable LLVM asserts by default
Brian Anderson [Wed, 8 Apr 2015 20:27:12 +0000 (13:27 -0700)]
configure: Disable LLVM asserts by default

9 years agoconfigure: Clarify help message for --enable-debug-assertions
Brian Anderson [Wed, 8 Apr 2015 20:25:20 +0000 (13:25 -0700)]
configure: Clarify help message for --enable-debug-assertions

9 years agoconfigure: Disable debug assertions by default
Brian Anderson [Wed, 8 Apr 2015 20:23:44 +0000 (13:23 -0700)]
configure: Disable debug assertions by default

9 years agoconfigure: Rename --enable-debug to --enable-debug-assertions
Brian Anderson [Wed, 8 Apr 2015 20:17:46 +0000 (13:17 -0700)]
configure: Rename --enable-debug to --enable-debug-assertions

9 years agoconfigure: Remove obsolete --disable-verify option
Brian Anderson [Wed, 8 Apr 2015 19:16:45 +0000 (12:16 -0700)]
configure: Remove obsolete --disable-verify option

rust-installer never verifies.

9 years agoconfigure: Remove obsolete --nightly flag
Brian Anderson [Wed, 8 Apr 2015 19:06:29 +0000 (12:06 -0700)]
configure: Remove obsolete --nightly flag

9 years agoAuto merge of #24029 - nagisa:print-locking, r=alexcrichton
bors [Wed, 8 Apr 2015 19:03:09 +0000 (19:03 +0000)]
Auto merge of #24029 - nagisa:print-locking, r=alexcrichton

write_fmt calls write for each formatted field. The default implementation of write_fmt is used,
which will call write on not-yet-locked stdout (and write locking after), therefore making print!
in multithreaded environment still interleave contents of two separate prints.

I’m not sure whether we want to do this change, though, because it has the same deadlock hazard which we tried to avoid by not locking inside write_fmt itself (see [this comment](https://github.com/rust-lang/rust/blob/80def6c2447d23a624e611417f24cf0ab2a5a676/src/libstd/io/stdio.rs#L267)).

Spotted on [reddit].

cc @alexcrichton

[reddit]: http://www.reddit.com/r/rust/comments/31comh/println_with_multiple_threads/

9 years agoImplement reentrant mutexes and make stdio use them
Simonas Kazlauskas [Fri, 3 Apr 2015 21:46:54 +0000 (00:46 +0300)]
Implement reentrant mutexes and make stdio use them

write_fmt calls write for each formatted field. The default implementation of write_fmt is used,
which will call write on not-yet-locked stdout (and write locking after), therefore making print!
in multithreaded environment still interleave contents of two separate prints.

This patch implements reentrant mutexes, changes stdio handles to use these mutexes and overrides
write_fmt to lock the stdio handle for the whole duration of the call.

9 years agoAuto merge of #24195 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 8 Apr 2015 15:59:10 +0000 (15:59 +0000)]
Auto merge of #24195 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #24143, #24149, #24167, #24178
- Failed merges:

9 years agoRollup merge of #24178 - steveklabnik:new_toc, r=nikomatsakis
Steve Klabnik [Wed, 8 Apr 2015 15:34:12 +0000 (11:34 -0400)]
Rollup merge of #24178 - steveklabnik:new_toc, r=nikomatsakis

Basically, the overall structure is this:

* Getting Started - getting an environment up and running
* Learn Rust - project-based learning the basics
* Effective Rust - higher level concepts that lead to writing good rust
* Syntax and Semantics - chunks of exactly what it sounds like
* Nightly Rust - unstable stuff, a staging area for documenting features
* Glossary - self-explanatory

There's a number of weaknesses with the current TOC, but I'll just focus on the strengths of the new one:

We start off with getting our environment set up. That's "getting started".

Then, we basically present you with two choices: do you want to start small, with bits of syntax? Or do you want to dive in with projects?

I'm guessing more people will choose the second, so that's the next part: "Learn Rust." I don't have any chapters here, but this would have an updated guessing game, a tutorial on building a little `wc` clone, and something else I haven't decided yet. Lots of options. But the idea is to just dive in and get your hands dirty. I'll heavily link to the 'syntax and semantics' sections that are relevant.

Then, a section I'm calling 'Effective Rust'. it feels greedy to steal that title, so I'm hoping to give it another name. These are higher-level things than syntax that Rust programmers should know: error handling is a great example. Most of these are sort of 'how do I use the standard library together' kinds of things. This also contains informations about systems programming that those new to it might not know: the stack vs the heap, for example.

Then, "Syntax and Semantics." This has one section for each bit of Rust. Small, focused, but explains _everything_. These are positioned to be almost entirely in-order, but heavily cross-link, so you can go out of order if you want to, but you can also use it as a reference.

Next, "Nightly Rust," where documenting unstable things goes. If we want to get good feedback on new features, they'll need to be documented, but we don't want to taint the main docs, so that's what this is for.

Finally, the glossary. Straightforward enough.

--------------------------------

This is going to be a terrible PR to review, so I just did the TOC re-organization, with basically no editing. So it'll be a bit jumbled at first. But next steps are to go through and edit / revise / tweak / add stuff to get it in tip-top shape for 1.0!

9 years agoRollup merge of #24167 - hauleth:remove-incorrect-example-from-mpsc, r=steveklabnik
Steve Klabnik [Wed, 8 Apr 2015 15:34:12 +0000 (11:34 -0400)]
Rollup merge of #24167 - hauleth:remove-incorrect-example-from-mpsc, r=steveklabnik

As beta is now released and is "suggested" version of `rustc` then there should be no code (in documentation) that will not compile with it. This one does not.

So according to [this great talk](http://delete-your-code.herokuapp.com/), I am doing what should be done.

9 years agoRollup merge of #24149 - bombless:update-faq, r=steveklabnik
Steve Klabnik [Wed, 8 Apr 2015 15:34:12 +0000 (11:34 -0400)]
Rollup merge of #24149 - bombless:update-faq, r=steveklabnik

I think "let is used to introduce variables" is incorrent.
You can use
```rust
match (42, true) {
    (x, y) => { /* ... */ }
}
```
to replace
```rust
let x = 42;
let y = true;
```
so it's nothing special for `let`.

9 years agoRollup merge of #24143 - michaelsproul:extended-errors, r=pnkfelix
Steve Klabnik [Wed, 8 Apr 2015 15:34:11 +0000 (11:34 -0400)]
Rollup merge of #24143 - michaelsproul:extended-errors, r=pnkfelix

I've taken another look at extended errors - fixing up the printing and adding a few more for match expressions.

With regards to printing, the previous behaviour was to just print the error message string directly, despite it containing indentation which caused it to overflow the standard terminal width of 80 columns (try `rustc --explain E0004`). The first approach I considered was to strip the leading whitespace from each line and lay out the text dynamically, inserting spaces in between. This approach became quite messy when taking multi-paragraph errors into account (and seemed overkill). The approach I settled on removes the indentation in the string itself and begins each message with a newline that is stripped before printing.

I feel like complete extended errors would be nice to have for 1.0.0 and I'm happy to spearhead an effort to get them written. Brian got me onto writing them at an SF meetup and I think it shouldn't be too hard to get the remaining 80 or so written with the help of people who don't really work on compiler innards.

9 years agoModify the ExprUseVisitor to walk each part of an AutoRef, and in
Niko Matsakis [Wed, 8 Apr 2015 08:31:51 +0000 (04:31 -0400)]
Modify the ExprUseVisitor to walk each part of an AutoRef, and in
particular to treat an AutoUnsize as as kind of "instantaneous" borrow
of the value being unsized. This prevents us from feeding uninitialized
data.

This caused a problem for the eager reborrow of comparison traits,
because that wound up introducing a "double AutoRef", which was not
being thoroughly checked before but turned out not to type check.
Fortunately, we can just remove that "eager reborrow" as it is no longer
needed now that `PartialEq` doesn't force both LHS and RHS to have the
same type (and even if we did have this problem, the better way would be
to lean on introducing a common supertype).

9 years agoAdd tests for #22289, #22370 and #22384
Luke Gallagher [Wed, 8 Apr 2015 13:23:43 +0000 (23:23 +1000)]
Add tests for #22289, #22370 and #22384

Closes #22289
Closes #22370
Closes #22384

9 years agoAuto merge of #24021 - pnkfelix:fn-params-outlive-body, r=nikomatsakis
bors [Wed, 8 Apr 2015 12:57:58 +0000 (12:57 +0000)]
Auto merge of #24021 - pnkfelix:fn-params-outlive-body, r=nikomatsakis

Encode more precise scoping rules for function params

Function params outlive everything in the body (incl temporaries).  Thus if we assign them their own `CodeExtent`, the region inference can properly show that it is sound to have temporaries with destructors that reference the parameters (because such temporaries will be dropped before the parameters are dropped).

Fix #23338

9 years agoAddress review nit by making `map_id` take an `FnMut`.
Felix S. Klock II [Wed, 8 Apr 2015 11:55:01 +0000 (13:55 +0200)]
Address review nit by making `map_id` take an `FnMut`.

9 years agoAuto merge of #23998 - nrc:impl-self, r=nikomatsakis
bors [Wed, 8 Apr 2015 09:58:05 +0000 (09:58 +0000)]
Auto merge of #23998 - nrc:impl-self, r=nikomatsakis

Closes #23909

r? @nikomatsakis (or anyone else, really)

9 years agoAuto merge of #24120 - aturon:range-perf, r=alexcrichton
bors [Wed, 8 Apr 2015 07:02:06 +0000 (07:02 +0000)]
Auto merge of #24120 - aturon:range-perf, r=alexcrichton

A recent change to the implementation of range iterators meant that,
even when stepping by 1, the iterators *always* involved checked
arithmetic.

This commit reverts to the earlier behavior (while retaining the
refactoring into traits).

Fixes #24095
Closes #24119
cc #24014

r? @alexcrichton