]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #36334 - GuillaumeGomez:run_but, r=steveklabnik
Guillaume Gomez [Wed, 14 Sep 2016 15:15:36 +0000 (17:15 +0200)]
Rollup merge of #36334 - GuillaumeGomez:run_but, r=steveklabnik

Set run button transparent instead of invisible

r? @steveklabnik

And of course a screenshot:

![screenshot from 2016-09-08 01-15-45](https://cloud.githubusercontent.com/assets/3050060/18331849/31fe1f8c-7562-11e6-9ae9-1dab44089ec6.png)

7 years agoAuto merge of #36041 - ahmedcharles:try, r=nrc
bors [Wed, 14 Sep 2016 05:41:34 +0000 (22:41 -0700)]
Auto merge of #36041 - ahmedcharles:try, r=nrc

Replace try! with ?.

7 years agoAuto merge of #35021 - japaric:rustc-builtins, r=alexcrichton
bors [Tue, 13 Sep 2016 22:08:12 +0000 (15:08 -0700)]
Auto merge of #35021 - japaric:rustc-builtins, r=alexcrichton

crate-ify compiler-rt into compiler-builtins

libcompiler-rt.a is dead, long live libcompiler-builtins.rlib

This commit moves the logic that used to build libcompiler-rt.a into a
compiler-builtins crate on top of the core crate and below the std crate.
This new crate still compiles the compiler-rt instrinsics using gcc-rs
but produces an .rlib instead of a static library.

Also, with this commit rustc no longer passes -lcompiler-rt to the
linker. This effectively makes the "no-compiler-rt" field of target
specifications a no-op. Users of `no_std` will have to explicitly add
the compiler-builtins crate to their crate dependency graph *if* they
need the compiler-rt intrinsics - this is a [breaking-change]. Users
of the `std` have to do nothing extra as the std crate depends
on compiler-builtins.

Finally, this a step towards lazy compilation of std with Cargo as the
compiler-rt intrinsics can now be built by Cargo instead of having to
be supplied by the user by some other method.

closes #34400

---

r? @alexcrichton

7 years agoLink test to compiler builtins and make unstable
Alex Crichton [Tue, 13 Sep 2016 19:27:26 +0000 (12:27 -0700)]
Link test to compiler builtins and make unstable

This commit fixes a test which now needs to explicitly link to the
`compiler_builtins` crate as well as makes the `compiler_builtins` crate
unstable.

7 years agoAuto merge of #36181 - seanmonstar:likely, r=nikomatsakis
bors [Tue, 13 Sep 2016 17:54:55 +0000 (10:54 -0700)]
Auto merge of #36181 - seanmonstar:likely, r=nikomatsakis

core: add likely and unlikely intrinsics

I'm no good at reading assembly, but I have tried a stage1 compiler with this patch, and it does cause different asm output. Additionally, testing this compiler on my httparse crate with some `likely` usage added in to the branches does affect benchmarks. However, I'm sure a codegen test should be included, if anyone knows what it should look like.

There isn't an entry in `librustc_trans/context.rs` in this diff, because it already exists (`llvm.expect.i1` is used for array indices).

----

Even though this does affect httparse benchmarks, it doesn't seem to affect it the same way GCC's `__builtin_expect` affects picohttpparser. I was confused that the deviation on the benchmarks grew hugely when testing this, especially since I'm absolutely certain that the branchs where I added `likely` were always `true`. I chalk that up to GCC and LLVM handle branch prediction differently.

cc #26179

7 years agorustc: Don't pass --whole-archive for compiler-builtins
Alex Crichton [Tue, 13 Sep 2016 14:59:42 +0000 (07:59 -0700)]
rustc: Don't pass --whole-archive for compiler-builtins

This flag is intended for rlibs included once, not rlibs that are repeatedly
included.

7 years agoAuto merge of #36264 - matklad:zeroing-cstring, r=alexcrichton
bors [Tue, 13 Sep 2016 11:57:23 +0000 (04:57 -0700)]
Auto merge of #36264 - matklad:zeroing-cstring, r=alexcrichton

Zero first byte of CString on drop

Hi! This is one more attempt to ameliorate `CString::new("...").unwrap().as_ptr()` problem (related RFC: https://github.com/rust-lang/rfcs/pull/1642).

One of the biggest problems with this code is that it may actually work in practice, so the idea of this PR is to proactively break such invalid code.

Looks like writing a `null` byte at the start of the CString should do the trick, and I think is an affordable cost: zeroing a single byte in `Drop` should be cheap enough compared to actual memory deallocation which would follow.

I would actually prefer to do something like

```Rust
impl Drop for CString {
    fn drop(&mut self) {
        let pattern = b"CTHULHU FHTAGN ";
        let bytes = self.inner[..self.inner.len() - 1];
        for (d, s) in bytes.iter_mut().zip(pattern.iter().cycle()) {
            *d = *s;
        }
    }
}
```

because Cthulhu error should be much easier to google, but unfortunately this would be too expensive in release builds, and we can't implement things `cfg(debug_assertions)` conditionally in stdlib.

Not sure if the whole idea or my implementation (I've used ~~`transmute`~~ `mem::unitialized` to workaround move out of Drop thing) makes sense :)

7 years agoAuto merge of #36446 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 13 Sep 2016 08:39:36 +0000 (01:39 -0700)]
Auto merge of #36446 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #36357, #36380, #36389, #36397, #36402
- Failed merges:

7 years agoRollup merge of #36402 - kmcallister:gh-29331-array-docs, r=GuillaumeGomez
Guillaume Gomez [Tue, 13 Sep 2016 08:25:50 +0000 (10:25 +0200)]
Rollup merge of #36402 - kmcallister:gh-29331-array-docs, r=GuillaumeGomez

Tweak array docs

Fixes #29331.

r? @GuillaumeGomez

7 years agoRollup merge of #36397 - SuperFluffy:bufwriter_unnecessary_cmp, r=aturon
Guillaume Gomez [Tue, 13 Sep 2016 08:25:49 +0000 (10:25 +0200)]
Rollup merge of #36397 - SuperFluffy:bufwriter_unnecessary_cmp, r=aturon

Remove unnecessary `cmp::min` from BufWriter::write

The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.

7 years agoRollup merge of #36389 - jfirebaugh:E0297, r=GuillaumeGomez
Guillaume Gomez [Tue, 13 Sep 2016 08:25:49 +0000 (10:25 +0200)]
Rollup merge of #36389 - jfirebaugh:E0297, r=GuillaumeGomez

Update E0297 to new error format

Fixes #35521.
Part of #35233.

I didn't attempt the bonus of narrowing the span to focus on the "for `<pattern>`" piece (it's my first time contributing), but I'm happy to do so given some hints.

r? @jonathandturner

7 years agoRollup merge of #36380 - kylog:fix-typo, r=steveklabnik
Guillaume Gomez [Tue, 13 Sep 2016 08:25:49 +0000 (10:25 +0200)]
Rollup merge of #36380 - kylog:fix-typo, r=steveklabnik

book: fix a typo

7 years agoRollup merge of #36357 - kmcallister:gh-29362-mem-docs, r=GuillaumeGomez
Guillaume Gomez [Tue, 13 Sep 2016 08:25:49 +0000 (10:25 +0200)]
Rollup merge of #36357 - kmcallister:gh-29362-mem-docs, r=GuillaumeGomez

Tweak std::mem docs (#29362)

r? @steveklabnik

7 years agorustc: Always link compiler-builtins last
Alex Crichton [Tue, 13 Sep 2016 04:24:40 +0000 (21:24 -0700)]
rustc: Always link compiler-builtins last

All crates depend on compiler-builtins, so we need to always include the crate
last.

7 years agoit's also compiler-rt.lib on windows-gnu
Jorge Aparicio [Sun, 4 Sep 2016 21:24:26 +0000 (16:24 -0500)]
it's also compiler-rt.lib on windows-gnu

7 years agono emutls for you, windows
Jorge Aparicio [Sun, 4 Sep 2016 17:57:18 +0000 (12:57 -0500)]
no emutls for you, windows

7 years agoit's libcompiler-rt.lib on windows
Jorge Aparicio [Sun, 4 Sep 2016 15:40:22 +0000 (10:40 -0500)]
it's libcompiler-rt.lib on windows

7 years agocrate-ify compiler-rt into compiler-builtins
Jorge Aparicio [Mon, 25 Jul 2016 02:42:11 +0000 (21:42 -0500)]
crate-ify compiler-rt into compiler-builtins

libcompiler-rt.a is dead, long live libcompiler-builtins.rlib

This commit moves the logic that used to build libcompiler-rt.a into a
compiler-builtins crate on top of the core crate and below the std crate.
This new crate still compiles the compiler-rt instrinsics using gcc-rs
but produces an .rlib instead of a static library.

Also, with this commit rustc no longer passes -lcompiler-rt to the
linker. This effectively makes the "no-compiler-rt" field of target
specifications a no-op. Users of `no_std` will have to explicitly add
the compiler-builtins crate to their crate dependency graph *if* they
need the compiler-rt intrinsics. Users of the `std` have to do nothing
extra as the std crate depends on compiler-builtins.

Finally, this a step towards lazy compilation of std with Cargo as the
compiler-rt intrinsics can now be built by Cargo instead of having to
be supplied by the user by some other method.

closes #34400

7 years agoAuto merge of #36019 - frewsxcv:take-into-inner, r=alexcrichton
bors [Tue, 13 Sep 2016 03:33:47 +0000 (20:33 -0700)]
Auto merge of #36019 - frewsxcv:take-into-inner, r=alexcrichton

Introduce `into_inner` method on `std::io::Take`.

https://github.com/rust-lang/rust/issues/23755

7 years agoAuto merge of #35960 - nikomatsakis:incr-comp-krate-edges, r=michaelwoerister
bors [Tue, 13 Sep 2016 00:15:26 +0000 (17:15 -0700)]
Auto merge of #35960 - nikomatsakis:incr-comp-krate-edges, r=michaelwoerister

fix a few errant `Krate` edges

Exploring the effect of small changes on `syntex` reuse, I discovered the following sources of unnecessary edges from `Krate`

r? @michaelwoerister

7 years agocheck stack discipline of tasks
Niko Matsakis [Mon, 12 Sep 2016 21:43:44 +0000 (17:43 -0400)]
check stack discipline of tasks

7 years agoAuto merge of #36354 - mikhail-m1:master, r=jonathandturner
bors [Mon, 12 Sep 2016 21:05:41 +0000 (14:05 -0700)]
Auto merge of #36354 - mikhail-m1:master, r=jonathandturner

fix span for errors E0537, E0535 & E0536

fix #36182 as part of #35233

7 years agoAuto merge of #36204 - c4rlo:patch-3, r=GuillaumeGomez
bors [Mon, 12 Sep 2016 17:54:08 +0000 (10:54 -0700)]
Auto merge of #36204 - c4rlo:patch-3, r=GuillaumeGomez

README.md: fix a "\" in table heading to be "/"

7 years agoAuto merge of #36414 - nnethercote:char_lit, r=jseyfried
bors [Mon, 12 Sep 2016 14:43:57 +0000 (07:43 -0700)]
Auto merge of #36414 - nnethercote:char_lit, r=jseyfried

Improve char_lit's readability and speed

This is my first contribution to rustc. Please let me know if I've done anything wrong. (I ran `make tidy` before making the pull request.)

7 years agoAuto merge of #36406 - arielb1:constant-padding, r=eddyb
bors [Mon, 12 Sep 2016 11:38:55 +0000 (04:38 -0700)]
Auto merge of #36406 - arielb1:constant-padding, r=eddyb

use `adt::trans_const` when translating constant closures and tuples

The previous way dropped padding on the floor.

Fixes #36401

r? @eddyb

7 years agoAuto merge of #36360 - orbea:docdir, r=alexcrichton
bors [Mon, 12 Sep 2016 08:33:40 +0000 (01:33 -0700)]
Auto merge of #36360 - orbea:docdir, r=alexcrichton

Allow setting --docdir

This will allow setting `--docdir` during configure, this is useful because not all linux distributions install documentation to `/usr/share/doc`.  For example in Slackware documentation is installed to `/usr/doc/$PRGNAM-$VERSION` and `/usr/share/doc` is a symlink to `/usr/doc`.

To use this `./configure --docdir=/usr/doc/$PRGNAM-$VERSION` can be used.

7 years agoLazily construct panic messages in char_lit().
Nicholas Nethercote [Mon, 12 Sep 2016 04:31:51 +0000 (14:31 +1000)]
Lazily construct panic messages in char_lit().

This reduces the time taken to run
`rustc -Zparse-only rustc-benchmarks/issue-32278-big-array-of-strings`
from 0.18s to 0.15s on my machine, and reduces the number of
instructions (as measured by Cachegrind) from 1.34B to 1.01B.

With the change applied, the time to fully compile that benchmark is
1.96s, so this is a 1.5% improvement.

7 years agoAvoid an unnecessary intermediate value in char_lit().
Nicholas Nethercote [Mon, 12 Sep 2016 03:03:21 +0000 (13:03 +1000)]
Avoid an unnecessary intermediate value in char_lit().

This makes the function more concise and easier to understand.

7 years agoAuto merge of #36355 - bluss:vec-extend-from-slice-aliasing-workaround, r=alexcrichton
bors [Mon, 12 Sep 2016 05:28:24 +0000 (22:28 -0700)]
Auto merge of #36355 - bluss:vec-extend-from-slice-aliasing-workaround, r=alexcrichton

Work around pointer aliasing issue in Vec::extend_from_slice, extend_with_element

Due to missing noalias annotations for &mut T in general (issue #31681),
in larger programs extend_from_slice and extend_with_element may both
compile very poorly. What is observed is that the .set_len() calls are
not lifted out of the loop, even for `Vec<u8>`.

Use a local length variable for the Vec length instead, and use a scope
guard to write this value back to self.len when the scope ends or on
panic. Then the alias analysis is easy.

This affects extend_from_slice, extend_with_element, the vec![x; n]
macro, Write impls for Vec<u8>, BufWriter, etc (but may / may not
have triggered since inlining can be enough for the compiler to get it right).

Fixes #32155
Fixes #33518
Closes #17844

7 years agoAuto merge of #36344 - sanxiyn:llvm-components, r=alexcrichton
bors [Mon, 12 Sep 2016 02:06:35 +0000 (19:06 -0700)]
Auto merge of #36344 - sanxiyn:llvm-components, r=alexcrichton

Use LLVM_COMPONENTS to run tests just for supported targets

This is already done for simd-ffi test, but not for atomic-lock-free test.

Fix #35023.

7 years agoUse question_mark feature in librustc_metadata.
Ahmed Charles [Sat, 27 Aug 2016 14:53:05 +0000 (07:53 -0700)]
Use question_mark feature in librustc_metadata.

7 years agoUse question_mark feature in librustc_const_eval.
Ahmed Charles [Sat, 27 Aug 2016 14:51:55 +0000 (07:51 -0700)]
Use question_mark feature in librustc_const_eval.

7 years agoUse question_mark feature in librustc_back.
Ahmed Charles [Sat, 27 Aug 2016 14:48:39 +0000 (07:48 -0700)]
Use question_mark feature in librustc_back.

7 years agoUse question_mark feature in libstd.
Ahmed Charles [Sat, 27 Aug 2016 14:33:36 +0000 (07:33 -0700)]
Use question_mark feature in libstd.

7 years agoUse question_mark feature in libserialize.
Ahmed Charles [Sat, 27 Aug 2016 14:16:17 +0000 (07:16 -0700)]
Use question_mark feature in libserialize.

7 years agoUse question_mark feature in librustc.
Ahmed Charles [Sat, 27 Aug 2016 13:50:17 +0000 (06:50 -0700)]
Use question_mark feature in librustc.

7 years agoUse question_mark feature in librustc_mir.
Ahmed Charles [Sat, 27 Aug 2016 09:32:28 +0000 (02:32 -0700)]
Use question_mark feature in librustc_mir.

7 years agoUse question_mark feature in librustc_incremental.
Ahmed Charles [Sat, 27 Aug 2016 09:31:17 +0000 (02:31 -0700)]
Use question_mark feature in librustc_incremental.

7 years agoUse question_mark feature in librustc_errors.
Ahmed Charles [Sat, 27 Aug 2016 09:21:36 +0000 (02:21 -0700)]
Use question_mark feature in librustc_errors.

7 years agoUse question_mark feature in libcore.
Ahmed Charles [Sat, 27 Aug 2016 09:12:25 +0000 (02:12 -0700)]
Use question_mark feature in libcore.

7 years agoFix typo in bootstrap/lib.rs.
Ahmed Charles [Sat, 27 Aug 2016 09:10:09 +0000 (02:10 -0700)]
Fix typo in bootstrap/lib.rs.

7 years agoUse question_mark feature in compiletest.
Ahmed Charles [Sat, 27 Aug 2016 08:47:03 +0000 (01:47 -0700)]
Use question_mark feature in compiletest.

7 years agoUse question_mark feature in linkchecker.
Ahmed Charles [Sat, 27 Aug 2016 08:42:56 +0000 (01:42 -0700)]
Use question_mark feature in linkchecker.

7 years agouse `adt::trans_const` when translating constant closures and tuples
Ariel Ben-Yehuda [Sun, 11 Sep 2016 22:53:43 +0000 (01:53 +0300)]
use `adt::trans_const` when translating constant closures and tuples

Fixes #36401

7 years agoAuto merge of #36308 - dtolnay:inputitem, r=alexcrichton
bors [Sun, 11 Sep 2016 22:12:27 +0000 (15:12 -0700)]
Auto merge of #36308 - dtolnay:inputitem, r=alexcrichton

Point macros 1.1 errors to the input item

Moved from https://github.com/alexcrichton/rust/pull/6 to continue discussion. Fixes #36218.

Before:

```rust
error[E0106]: missing lifetime specifier
  --> src/main.rs:10:10
   |
10 | #[derive(Serialize, Deserialize)]
   |          ^ expected lifetime parameter

error[E0038]: the trait `T` cannot be made into an object
  --> src/main.rs:15:15
   |
15 | #[derive(Serialize, Deserialize)]
   |          ^^^^^^^^^^ the trait `T` cannot be made into an object
```

After:

```rust
error[E0106]: missing lifetime specifier
  --> src/main.rs:11:1
   |
11 | struct A {
   | ^ expected lifetime parameter

error[E0038]: the trait `T` cannot be made into an object
  --> src/main.rs:16:1
   |
16 | struct B<'a> {
   | ^ the trait `T` cannot be made into an object
```

7 years agoTweak array docs
Keegan McAllister [Sat, 10 Sep 2016 17:47:05 +0000 (10:47 -0700)]
Tweak array docs

Fixes #29331.

7 years agoAuto merge of #36369 - uweigand:s390x, r=alexcrichton
bors [Sun, 11 Sep 2016 17:53:24 +0000 (10:53 -0700)]
Auto merge of #36369 - uweigand:s390x, r=alexcrichton

Add s390x support

This adds support for building the Rust compiler and standard
library for s390x-linux, allowing a full cross-bootstrap sequence
to complete.  This includes:

- Makefile/configure changes to allow native s390x builds
- Full Rust compiler support for the s390x C ABI
  (only the non-vector ABI is supported at this point)
- Port of the standard library to s390x
- Update the liblibc submodule to a version including s390x support
- Testsuite fixes to allow clean "make check" on s390x

Caveats:

- Resets base cpu to "z10" to bring support in sync with the default
  behaviour of other compilers on the platforms.  (Usually, upstream
  supports all older processors; a distribution build may then chose
  to require a more recent base version.)  (Also, using zEC12 causes
  failures in the valgrind tests since valgrind doesn't fully support
  this CPU yet.)

- z13 vector ABI is not yet supported.  To ensure compatible code
  generation, the -vector feature is passed to LLVM.  Note that this
  means that even when compiling for z13, no vector instructions
  will be used.  In the future, support for the vector ABI should be
  added (this will require common code support for different ABIs
  that need different data_layout strings on the same platform).

- Two test cases are (temporarily) ignored on s390x to allow passing
  the test suite.  The underlying issues still need to be fixed:
  * debuginfo/simd.rs fails because of incorrect debug information.
    This seems to be a LLVM bug (also seen with C code).
  * run-pass/union/union-basic.rs simply seems to be incorrect for
    all big-endian platforms.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
7 years agoRemove unnecessary `cmp::min` from BufWriter::write
Richard Janis Goldschmidt [Sun, 11 Sep 2016 14:48:04 +0000 (16:48 +0200)]
Remove unnecessary `cmp::min` from BufWriter::write

The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.

7 years agoUpdate E0297 to new error format
John Firebaugh [Sat, 10 Sep 2016 20:22:19 +0000 (13:22 -0700)]
Update E0297 to new error format

7 years agoAuto merge of #36351 - pnkfelix:fix-36278-size-miscalc, r=eddyb
bors [Sat, 10 Sep 2016 20:10:29 +0000 (13:10 -0700)]
Auto merge of #36351 - pnkfelix:fix-36278-size-miscalc, r=eddyb

When sizing DST, don't double-count nested struct prefixes.

When computing size of `struct P<T>(Q<T>)`, don't double-count prefix added by `Q`

Fix #36278. Fix #36294.

7 years agoTweak std::mem docs
Keegan McAllister [Fri, 9 Sep 2016 03:04:05 +0000 (20:04 -0700)]
Tweak std::mem docs

Fixes #29362.

7 years agobook: fix a typo
Kylo Ginsberg [Sat, 10 Sep 2016 14:58:30 +0000 (07:58 -0700)]
book: fix a typo

7 years agoAuto merge of #36378 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sat, 10 Sep 2016 14:03:27 +0000 (07:03 -0700)]
Auto merge of #36378 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 6 pull requests

- Successful merges: #35691, #36045, #36311, #36314, #36326, #36346
- Failed merges:

7 years agoRollup merge of #36346 - oli-obk:patch-1, r=arielb1
Guillaume Gomez [Sat, 10 Sep 2016 13:57:51 +0000 (15:57 +0200)]
Rollup merge of #36346 - oli-obk:patch-1, r=arielb1

clean up `get_vtable`'s doc comment

7 years agoRollup merge of #36326 - JDemler:master, r=steveklabnik
Guillaume Gomez [Sat, 10 Sep 2016 13:57:51 +0000 (15:57 +0200)]
Rollup merge of #36326 - JDemler:master, r=steveklabnik

Fixed typo in nomicon

7 years agoRollup merge of #36314 - tshepang:not-needed, r=GuillaumeGomez
Guillaume Gomez [Sat, 10 Sep 2016 13:57:50 +0000 (15:57 +0200)]
Rollup merge of #36314 - tshepang:not-needed, r=GuillaumeGomez

doc: we got coercion going on here, so no need to be this explicit

7 years agoRollup merge of #36311 - frewsxcv:instant-elapsed-example, r=GuillaumeGomez
Guillaume Gomez [Sat, 10 Sep 2016 13:57:50 +0000 (15:57 +0200)]
Rollup merge of #36311 - frewsxcv:instant-elapsed-example, r=GuillaumeGomez

Add doc example for `std::time::Instant::elapsed`.

None

7 years agoRollup merge of #36045 - ollie27:rustdoc_titles3, r=steveklabnik
Guillaume Gomez [Sat, 10 Sep 2016 13:57:50 +0000 (15:57 +0200)]
Rollup merge of #36045 - ollie27:rustdoc_titles3, r=steveklabnik

rustdoc: Add missing item types to page titles

Most pages include the item type in the title such as "Struct std::vec::Vec". However it is missing from the pages for foreign functions, type definitions, macros, statics and constants. This adds them so for example, instead of a title of "std::u32::MAX" it is "Constant std::u32::MAX" to match the others.

[before](https://doc.rust-lang.org/nightly/std/u32/constant.MAX.html) [after](https://ollie27.github.io/rust_doc_test/std/u32/constant.MAX.html)
[before](https://doc.rust-lang.org/nightly/std/io/type.Result.html) [after](https://ollie27.github.io/rust_doc_test/std/io/type.Result.html)

Previous discussions: #34345, #35003

7 years agoRollup merge of #35691 - jaredwy:update-error-63, r=jonathandturner
Guillaume Gomez [Sat, 10 Sep 2016 13:57:50 +0000 (15:57 +0200)]
Rollup merge of #35691 - jaredwy:update-error-63, r=jonathandturner

Update the wording for E0063. This will truncate the fields to 3.

Instead of listing every field it will now show missing `a`, `z`, `b`, and 1 other field
This is for #35218 as part of #35233

r? @jonathandturner

7 years agoAuto merge of #36333 - apasel422:issue-35668, r=eddyb
bors [Sat, 10 Sep 2016 09:24:27 +0000 (02:24 -0700)]
Auto merge of #36333 - apasel422:issue-35668, r=eddyb

Handle `ReEmpty` for `impl Trait`

Closes #35668

r? @eddyb

7 years agofix span for errors E0537, E0535 & E0536
Mikhail Modin [Thu, 8 Sep 2016 19:02:49 +0000 (22:02 +0300)]
fix span for errors E0537, E0535 & E0536

7 years agoAuto merge of #36332 - llogiq:static_consts_feature, r=nikomatsakis
bors [Sat, 10 Sep 2016 04:35:30 +0000 (21:35 -0700)]
Auto merge of #36332 - llogiq:static_consts_feature, r=nikomatsakis

add static_in_const feature gate

also updates tests and deletes the spurious .bk files I inadvertently added last time.

r? @nikomatsakis

7 years agoAdd ExpnId to expanded procedural macro code
David Tolnay [Fri, 9 Sep 2016 21:53:15 +0000 (14:53 -0700)]
Add ExpnId to expanded procedural macro code

7 years agoAdd s390x support
Ulrich Weigand [Fri, 9 Sep 2016 21:00:23 +0000 (23:00 +0200)]
Add s390x support

This adds support for building the Rust compiler and standard
library for s390x-linux, allowing a full cross-bootstrap sequence
to complete.  This includes:

- Makefile/configure changes to allow native s390x builds
- Full Rust compiler support for the s390x C ABI
  (only the non-vector ABI is supported at this point)
- Port of the standard library to s390x
- Update the liblibc submodule to a version including s390x support
- Testsuite fixes to allow clean "make check" on s390x

Caveats:

- Resets base cpu to "z10" to bring support in sync with the default
  behaviour of other compilers on the platforms.  (Usually, upstream
  supports all older processors; a distribution build may then chose
  to require a more recent base version.)  (Also, using zEC12 causes
  failures in the valgrind tests since valgrind doesn't fully support
  this CPU yet.)

- z13 vector ABI is not yet supported.  To ensure compatible code
  generation, the -vector feature is passed to LLVM.  Note that this
  means that even when compiling for z13, no vector instructions
  will be used.  In the future, support for the vector ABI should be
  added (this will require common code support for different ABIs
  that need different data_layout strings on the same platform).

- Two test cases are (temporarily) ignored on s390x to allow passing
  the test suite.  The underlying issues still need to be fixed:
  * debuginfo/simd.rs fails because of incorrect debug information.
    This seems to be a LLVM bug (also seen with C code).
  * run-pass/union/union-basic.rs simply seems to be incorrect for
    all big-endian platforms.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
7 years agoAuto merge of #36256 - rjgoldsborough:make-configure-detect-nodejs-36207, r=alexcrichton
bors [Fri, 9 Sep 2016 21:04:31 +0000 (14:04 -0700)]
Auto merge of #36256 - rjgoldsborough:make-configure-detect-nodejs-36207, r=alexcrichton

adding a check to bootstrap script

and a check to the rust config script

refs #36207

first crack at making configure detect nodejs

7 years agoAuto merge of #36331 - petrochenkov:tyadt, r=eddyb
bors [Fri, 9 Sep 2016 11:57:11 +0000 (04:57 -0700)]
Auto merge of #36331 - petrochenkov:tyadt, r=eddyb

Refactor `TyStruct`/`TyEnum`/`TyUnion` into `TyAdt`

r? @eddyb

7 years agoAuto merge of #36324 - nrc:save-docs, r=eddyb
bors [Fri, 9 Sep 2016 08:43:46 +0000 (01:43 -0700)]
Auto merge of #36324 - nrc:save-docs, r=eddyb

save-analysis bits and pieces

7 years agoUpdate the wording for E0063. This will truncate the fields to 3.
Jared Wyles [Fri, 5 Aug 2016 22:26:09 +0000 (08:26 +1000)]
Update the wording for E0063. This will truncate the fields to 3.
Instead of listing every field it will now show missing `a`, `z`, `b`, and 1 other field

7 years agoAllow setting --docdir
orbea [Fri, 9 Sep 2016 06:18:20 +0000 (23:18 -0700)]
Allow setting --docdir

7 years agoAuto merge of #36322 - uweigand:nonblocking, r=alexcrichton
bors [Fri, 9 Sep 2016 05:30:12 +0000 (22:30 -0700)]
Auto merge of #36322 - uweigand:nonblocking, r=alexcrichton

Fix argument to FIONBIO ioctl

The FIONBIO ioctl takes as argument a pointer to an integer, which
should be either 0 or 1 to indicate whether nonblocking mode is to
be switched off or on.  The type of the pointed-to variable is "int".

However, the set_nonblocking routine in libstd/sys/unix/net.rs passes
a pointer to a libc::c_ulong variable.  This doesn't matter on all
32-bit platforms and on all litte-endian platforms, but it will
break on big-endian 64-bit platforms.

Found while porting Rust to s390x (a big-endian 64-bit platform).

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
7 years agoAuto merge of #36321 - uweigand:enum-abi, r=eddyb
bors [Fri, 9 Sep 2016 02:15:50 +0000 (19:15 -0700)]
Auto merge of #36321 - uweigand:enum-abi, r=eddyb

Follow target ABI sign-/zero-extension rules for enum types

While attempting to port Rust to s390x, I ran into an ABI violation
(that caused rust_eh_personality to be miscompiled, breaking unwinding).
The problem is that this function returns an enum type, which is
supposed to be sign-extended according to the s390x ABI.  However,
common code would ignore target sign-/zero-extension rules for any
types that do not satisfy is_integral(), which includes enums.

For the general case of Rust enum types, which map to structure types
with a discriminant, that seems correct.  However, in the special case
of simple enums that map directly to C enum types (i.e. LLVM integers),
this is incorrect; we must follow the target extension rules for those.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
7 years agotweaking the nodejs cmd sanity check
Jake Goldsborough [Fri, 9 Sep 2016 00:51:06 +0000 (17:51 -0700)]
tweaking the nodejs cmd sanity check

7 years agoWork around pointer aliasing issue in Vec::extend_from_slice, extend_with_element
Ulrik Sverdrup [Thu, 8 Sep 2016 21:48:08 +0000 (23:48 +0200)]
Work around pointer aliasing issue in Vec::extend_from_slice, extend_with_element

Due to missing noalias annotations for &mut T in general (issue #31681),
in larger programs extend_from_slice and extend_with_element may both
compile very poorly. What is observed is that the .set_len() calls are
not lifted out of the loop, even for `Vec<u8>`.

Use a local length variable for the Vec length instead, and use a scope
guard to write this value back to self.len when the scope ends or on
panic. Then the alias analysis is easy.

This affects extend_from_slice, extend_with_element, the vec![x; n]
macro, Write impls for Vec<u8>, BufWriter, etc (but may / may not
have triggered since inlining can be enough for the compiler to get it right).

7 years agoAuto merge of #36173 - petrochenkov:unstat, r=nikomatsakis
bors [Thu, 8 Sep 2016 22:57:02 +0000 (15:57 -0700)]
Auto merge of #36173 - petrochenkov:unstat, r=nikomatsakis

Issue deprecation warnings for safe accesses to extern statics

Fixes https://github.com/rust-lang/rust/issues/35112
cc https://github.com/rust-lang/rust/issues/36247

7 years agoIssue deprecation warnings for safe accesses to extern statics
Vadim Petrochenkov [Fri, 26 Aug 2016 16:23:42 +0000 (19:23 +0300)]
Issue deprecation warnings for safe accesses to extern statics

7 years agofix feature error, test fallout
Andre Bogus [Thu, 8 Sep 2016 20:59:21 +0000 (22:59 +0200)]
fix feature error, test fallout

7 years agoAddress comments
Vadim Petrochenkov [Mon, 5 Sep 2016 22:26:02 +0000 (01:26 +0300)]
Address comments

7 years agoRefactor `TyStruct`/`TyEnum`/`TyUnion` into `TyAdt`
Vadim Petrochenkov [Mon, 5 Sep 2016 22:26:02 +0000 (01:26 +0300)]
Refactor `TyStruct`/`TyEnum`/`TyUnion` into `TyAdt`

7 years agoPoint compile-fail errors to the input item instead of the derive
David Tolnay [Thu, 8 Sep 2016 17:41:48 +0000 (10:41 -0700)]
Point compile-fail errors to the input item instead of the derive

7 years agoAuto merge of #35745 - jroesch:soundness-fix-29859, r=nikomatsakis
bors [Thu, 8 Sep 2016 17:40:31 +0000 (10:40 -0700)]
Auto merge of #35745 - jroesch:soundness-fix-29859, r=nikomatsakis

Fix soundness bug described in #29859

This is an attempt at fixing the problems described in #29859 based on an IRC conversation between @nikomatsakis and I today. I'm waiting on a full build to come back, otherwise both tests trigger the correct error.

7 years agoFor size of `struct P<T>(Q<T>)`, don't double-count the prefix added by `Q`.
Felix S. Klock II [Thu, 8 Sep 2016 17:18:07 +0000 (19:18 +0200)]
For size of `struct P<T>(Q<T>)`, don't double-count the prefix added by `Q`.

Fix #36278. Fix #36294.

7 years agoAuto merge of #36048 - GuillaumeGomez:code_clean, r=brson
bors [Thu, 8 Sep 2016 14:20:51 +0000 (07:20 -0700)]
Auto merge of #36048 - GuillaumeGomez:code_clean, r=brson

Clean code a bit

7 years agoclean up `get_vtable`'s doc comment
Oliver Schneider [Thu, 8 Sep 2016 10:58:05 +0000 (12:58 +0200)]
clean up `get_vtable`'s doc comment

7 years agoUse LLVM_COMPONENTS to run tests just for supported targets
Seo Sanghyeon [Thu, 8 Sep 2016 09:43:21 +0000 (18:43 +0900)]
Use LLVM_COMPONENTS to run tests just for supported targets

7 years agoAuto merge of #36316 - jseyfried:custom_derive_internal_unstable, r=eddyb
bors [Thu, 8 Sep 2016 08:44:51 +0000 (01:44 -0700)]
Auto merge of #36316 - jseyfried:custom_derive_internal_unstable, r=eddyb

Avoid instaiblity errors in code generated by `syntax_ext::deriving::call_intrinsic()`

r? @eddyb

7 years agoadded feature description to reference
Andre Bogus [Thu, 8 Sep 2016 05:34:41 +0000 (07:34 +0200)]
added feature description to reference

7 years agoAuto merge of #36310 - jstnlef:remove-extraneous-not-equal-impl, r=sfackler
bors [Thu, 8 Sep 2016 05:30:48 +0000 (22:30 -0700)]
Auto merge of #36310 - jstnlef:remove-extraneous-not-equal-impl, r=sfackler

Removing the extraneous not_equal implementation for slices

Happened to stumble upon this one awhile back. Seemed a bit silly to have both the equals and not equals implementation when they're so similar.

7 years agoadded feature gate test
Andre Bogus [Thu, 8 Sep 2016 05:29:37 +0000 (07:29 +0200)]
added feature gate test

7 years agowarning → error, lowercase
Andre Bogus [Thu, 8 Sep 2016 05:26:55 +0000 (07:26 +0200)]
warning → error, lowercase

7 years agoAuto merge of #36214 - jseyfried:stackless_expansion, r=nrc
bors [Thu, 8 Sep 2016 02:02:51 +0000 (19:02 -0700)]
Auto merge of #36214 - jseyfried:stackless_expansion, r=nrc

macros: stackless expansion

After this PR, macro expansion cannot overflow the stack unless the expanded crate is too deep to fold.
Everything but the stackless placeholder expansion commit is also groundwork for macro modularization.

r? @nrc or @eddyb

7 years agoFix duplicate error code
Jared Roesch [Thu, 8 Sep 2016 00:22:19 +0000 (17:22 -0700)]
Fix duplicate error code

7 years agoSet run button transparent instead of invisible
Guillaume Gomez [Wed, 7 Sep 2016 23:16:06 +0000 (01:16 +0200)]
Set run button transparent instead of invisible

7 years agoAuto merge of #36292 - japaric:musl-root, r=alexcrichton
bors [Wed, 7 Sep 2016 22:45:14 +0000 (15:45 -0700)]
Auto merge of #36292 - japaric:musl-root, r=alexcrichton

rustbuild: per target musl-root

config.toml now accepts a target.$TARGET.musl-root key that lets you
override the "build" musl-root value, which is set via the --musl-root
flag or via the build.musl-root key.

With this change, it's now possible to compile std for several musl
targets at once. Here's are the sample commands to do such thing:

```
$ configure \
    --enable-rustbuild \
    --target=x86_64-unknown-linux-musl,arm-unknown-linux-musleabi \
    --musl-root=/musl/x86_64-unknown-linux-musl/

$ edit config.toml && tail config.toml
[target.arm-unknown-linux-musleabi]
musl-root = "/x-tools/arm-unknown-linux-musleabi/arm-unknown-linux-musleabi/sysroot/usr"

$ make
```

r? @alexcrichton
With this we should be able to start producing releases of std for arm musl targets

7 years agoImprove `directory` computation during invocation collection.
Jeffrey Seyfried [Mon, 5 Sep 2016 04:08:38 +0000 (04:08 +0000)]
Improve `directory` computation during invocation collection.

7 years agoImplement stackless placeholder expansion.
Jeffrey Seyfried [Fri, 2 Sep 2016 03:35:59 +0000 (03:35 +0000)]
Implement stackless placeholder expansion.

7 years agoStrip unconfigured nodes in the `InvocationCollector` fold.
Jeffrey Seyfried [Wed, 7 Sep 2016 22:24:01 +0000 (22:24 +0000)]
Strip unconfigured nodes in the `InvocationCollector` fold.

7 years agoHandle `ReEmpty` for `impl Trait`
Andrew Paseltiner [Wed, 7 Sep 2016 22:26:53 +0000 (18:26 -0400)]
Handle `ReEmpty` for `impl Trait`

Closes #35668

7 years agoRefactor code out of the folder implementation for `StripUnconfigured`.
Jeffrey Seyfried [Fri, 2 Sep 2016 01:44:23 +0000 (01:44 +0000)]
Refactor code out of the folder implementation for `StripUnconfigured`.

7 years agoadd static_in_const feature gate
Andre Bogus [Wed, 7 Sep 2016 21:18:46 +0000 (23:18 +0200)]
add static_in_const feature gate

also updates tests and deletes the spurious .bk files I inadvertently
added last time.

7 years agoFixed typo in nomicon
Jakob Demler [Wed, 7 Sep 2016 20:15:32 +0000 (22:15 +0200)]
Fixed typo in nomicon