Commit Graph

61348 Commits

Author SHA1 Message Date
Guillaume Gomez
747b9e590f Rollup merge of #39662 - Henning-K:patch-1, r=frewsxcv
Fixes #39661

Clarifies the potential ambiguity.
2017-02-12 19:16:29 +01:00
Guillaume Gomez
be0e7498f0 Rollup merge of #39654 - ollie27:rustdoc_attributes, r=GuillaumeGomez
rustdoc: Show attributes on all item types

Currently attributes are only shown for structs, unions and enums but
they should be shown for all items. For example it is useful to know if a
function is `#[no_mangle]`.
2017-02-12 19:16:28 +01:00
bors
282fa87b55 Auto merge of #39680 - canndrew:uninhabited_from-infinite-loop, r=arielb1
Add recursion limit to inhabitedness check

Fixes #39489.
Add test aswell.
2017-02-12 07:20:31 +00:00
bors
410d807e46 Auto merge of #39554 - zackmdavis:assert_eq_has_a_terrible_error_message_when_given_a_trailing_comma, r=BurntSushi
improve error message when two-arg assert_eq! receives a trailing comma

Previously, `assert_eq!(left, right,)` (respectively, `assert_ne!(left,
right,)`; note the trailing comma) would result in a confusing "requires
at least a format string argument" error. In reality, a format string is
optional, but the trailing comma puts us into the "match a token tree of
zero or more tokens" branch of the macro (in order to support the
optional format string), and passing the empty token tree into
`format_args!` results in the confusing error. If instead we match a
token tree of one or more tokens, we get a much more sensible
"unexpected end of macro invocation" error.

While we're here, fix up a stray space before a comma in the match
guards.

Resolves #39369.

-----

**Before:**
```
$ rustc scratch.rs
error: requires at least a format string argument
 --> scratch.rs:2:5
  |
2 |     assert_eq!(1, 2,);
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro outside of the current crate

error: aborting due to previous error
```

**After:**
```
$ ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc scratch.rs
error: unexpected end of macro invocation
 --> scratch.rs:2:20
  |
2 |     assert_eq!(1, 2,);
  |                    ^
```
2017-02-12 03:34:57 +00:00
bors
912bc14a6b Auto merge of #38945 - battisti:fix_thread_num, r=alexcrichton
treat setting the number of test-threads to 0 as an error

It is currently possible to call `cargo test -- --test-threads=0` which will cause cargo to hang until aborted. This change will fix that and will report an appropriate error to the user.
2017-02-12 00:54:57 +00:00
bors
ba7cf7cc5d Auto merge of #39747 - mattico:fix-llvm4-createcompileunit, r=alexcrichton
[LLVM 4.0] Fix CreateCompileUnit

This is largely identical to @dylanmckay's [patch](https://github.com/dylanmckay), except that it doesn't try to use `file_metadata()`. I don't think that is necessary because we don't want the compile unit to be added to  `debug_context.created_files`, though I'd like confirmation from someone who knows for sure. If that is needed, I can modify `file_metadata_()` so that it can be used from `compile_unit_metadata()`.
2017-02-11 22:10:53 +00:00
Matt Ickstadt
aebce5bd2a Fix as_ptr() drop problem 2017-02-11 15:41:03 -06:00
Matt Ickstadt
68fff62542 [LLVM 4.0] Fix CreateCompileUnit 2017-02-11 15:15:28 -06:00
Alexander Battisti
0a4c268a6b removed trailing whitespace 2017-02-11 20:04:05 +01:00
bors
bae454edc5 Auto merge of #39736 - frewsxcv:rollup, r=frewsxcv
Rollup of 9 pull requests

- Successful merges: #39174, #39660, #39676, #39692, #39701, #39710, #39721, #39724, #39725
- Failed merges:
2017-02-11 07:18:21 +00:00
Corey Farwell
56275f82a8 Rollup merge of #39725 - Aaronepower:master, r=steveklabnik
Updated nightly book with installing nightly instructions
2017-02-10 23:41:40 -05:00
Corey Farwell
0e6b370929 Rollup merge of #39724 - malbarbo:android, r=alexcrichton
Allow rustc data structures compile to android

flock structure is defined in asm*/fcntl.h. This file on android is
generated from the linux kernel source, so they are the same.
2017-02-10 23:41:39 -05:00
Corey Farwell
6866df669c Rollup merge of #39721 - whataloadofwhat:catch-unwind-bang, r=alexcrichton
Change std::panicking::try::Data into a union

No longer potentially call `mem::uninitialized::<!>()`

Fixes #39432
2017-02-10 23:41:38 -05:00
Corey Farwell
0fd89adcaa Rollup merge of #39710 - brson:151notes, r=alexcrichton
Update 1.15.1 relnotes

Matching what is on stable.
2017-02-10 23:41:37 -05:00
Corey Farwell
15bec3dd63 Rollup merge of #39701 - sgrif:sg-vec-reserve-docs, r=alexcrichton
Explicitly mention that `Vec::reserve` is based on len not capacity

I spent a good chunk of time tracking down a buffer overrun bug that
resulted from me mistakenly thinking that `reserve` was based on the
current capacity not the current length. It would be helpful if this
were called out explicitly in the docs.
2017-02-10 23:41:36 -05:00
Corey Farwell
92cf7aecb4 Rollup merge of #39692 - oli-obk:patch-2, r=aturon
remove wrong packed struct test

This UB was found by running the test under [Miri](https://github.com/solson/miri) which rejects these unsafe unaligned loads. 😄
2017-02-10 23:41:35 -05:00
Corey Farwell
4269e5207e Rollup merge of #39676 - alexcrichton:fix-again, r=brson
Actually fix manifest generation

The previous fix contained an error where `toml::encode` returned a runtime
error, so this version just constructs a literal `toml::Value`.
2017-02-10 23:41:34 -05:00
Corey Farwell
bf750890c9 Rollup merge of #39660 - alexcrichton:shasum-dirs, r=brson
Don't include directory names in shasums

Right now we just run `shasum` on an absolute path but right now the shasum
files only include filenames, so let's use `current_dir` and just the file name
to only have the file name emitted.
2017-02-10 23:41:33 -05:00
Corey Farwell
17dcc51438 Rollup merge of #39174 - rspeer:iter-nth-doc-fix, r=alexcrichton
Fix a misleading statement in `Iterator.nth()`

The `Iterator.nth()` documentation says "Note that all preceding elements will be consumed". I assumed from that that the preceding elements would be the *only* ones that were consumed, but in fact the returned element is consumed as well.

The way I read the documentation, I assumed that `nth(0)` would not discard anything (there are 0 preceding elements, and maybe it just peeks at the start of the iterator somehow), so I added a sentence clarifying that it does. I also rephrased it to avoid the stunted "i.e." phrasing.
2017-02-10 23:41:32 -05:00
bors
f140a6c6ef Auto merge of #39642 - stjepang:specialize-slice-partialord, r=alexcrichton
Specialize `PartialOrd<A> for [A] where A: Ord`

This way we can call `cmp` instead of `partial_cmp` in the loop, removing some burden of optimizing `Option`s away from the compiler.

PR #39538 introduced a regression where sorting slices suddenly became slower, since `slice1.lt(slice2)` was much slower than `slice1.cmp(slice2) == Less`. This problem is now fixed.

To verify, I benchmarked this simple program:
```rust
fn main() {
    let mut v = (0..2_000_000).map(|x| x * x * x * 18913515181).map(|x| vec![x, x ^ 3137831591]).collect::<Vec<_>>();
    v.sort();
}
```

Before this PR, it would take 0.95 sec, and now it takes 0.58 sec.
I also tried changing the `is_less` lambda to use `cmp` and `partial_cmp`. Now all three versions (`lt`, `cmp`, `partial_cmp`) are equally performant for sorting slices - all of them take 0.58 sec on the
benchmark.

Tangentially, as soon as we get `default impl`, it might be a good idea to implement a blanket default impl for `lt`, `gt`, `le`, `ge` in terms of `cmp` whenever possible. Today, those four functions by default are only implemented in terms of `partial_cmp`.

r? @alexcrichton
2017-02-11 04:37:27 +00:00
bors
064a0ee131 Auto merge of #39490 - RReverser:em-linker, r=alexcrichton
Add Emscripten-specific linker

Emscripten claims to accept most GNU linker options, but in fact most of `-Wl,...` are useless for it and instead it requires some additional special options which are easier to handle in a separate trait.

Currently added:
 - `export_symbols`: works on executables as special Emscripten case since staticlibs/dylibs aren't compiled to JS, while exports are required to be accessible from JS.
Fixes #39171.
 - `optimize` - translates Rust's optimization level to Emscripten optimization level (whether passed via `-C opt-level=...` or `-O...`).
Fixes #36899.
 - `debuginfo` - translates debug info; Emscripten has 5 debug levels while Rust has 3, so chose to translate `-C debuginfo=1` to `-g3` (preserves whitespace, variable and function names for easy debugging).
Fixes #36901.
 - `no_default_libraries` - tells Emscripten to exclude `memcpy` and co.

TODO (in future PR): dynamic linking via `SIDE_MODULE` / `MAIN_MODULE` mechanism.
2017-02-10 23:50:46 +00:00
bors
2425b22774 Auto merge of #39438 - clarcharr:box_from, r=alexcrichton
Conversions between slices and boxes

This allows conversion for `Copy` slices, `str`, and `CStr` into their boxed counterparts.

This also adds the method `CString::into_boxed_c_str`.

I would like to add similar implementations for `OsStr` as well, but I have not figured out how.
2017-02-10 21:11:29 +00:00
whataloadofwhat
ca92c51682 Change std::panicking::try::Data into a union
No longer potentially call `mem::uninitialized::<!>()`

Fixes #39432
2017-02-10 19:20:28 +00:00
Aaron Power
5c295110fd Updated installing nightly instructions 2017-02-10 18:44:32 +00:00
Marco A L Barbosa
a8364acafb Allow rustc data structures compile to android
flock structure is defined in asm*/fcntl.h. This file on android is
generated from the linux kernel source, so they are the same.
2017-02-10 16:34:10 -02:00
Ingvar Stepanyan
f35b598bbf Disable memory init file until further notice
It's support is currently too buggy in both Rust tests and Cargo.
2017-02-10 17:34:05 +00:00
Ingvar Stepanyan
84c2a67160 Reenable exception catching in Emscripten even on optimized targets 2017-02-10 17:31:04 +00:00
Ingvar Stepanyan
eed6168a3b Add Emscripten-specific linker
It claims to accept most GNU linker options, but in fact most of them
have no effect and instead it requires some special options which are
easier to handle in a separate trait.

Currently added:
 - `export_symbols`: works on executables as special Emscripten case
since staticlibs/dylibs aren't compiled to JS, while exports are
required to be accessible from JS.
Fixes #39171.
 - `optimize` - translates Rust's optimization level to Emscripten
optimization level (whether passed via `-C opt-level=...` or `-O...`).
Fixes #36899.
 - `debuginfo` - translates debug info; Emscripten has 5 debug levels
while Rust has 3, so chose to translate `-C debuginfo=1` to `-g3`
(preserves whitespace, variable and function names for easy debugging).
Fixes #36901.
 - `no_default_libraries` - tells Emscripten to exlude `memcpy` and co.
2017-02-10 17:31:04 +00:00
bors
bc524d3d55 Auto merge of #39708 - jethrogb:patch-4, r=frewsxcv
Update set operations documentation

Reminding people of set terminology.
2017-02-10 14:26:18 +00:00
Rob Speer
11d36aec83 iterator docs: Move paragraph about discarding; clarify "consumed" 2017-02-10 01:35:29 -05:00
Rob Speer
ebf29ef073 Rephrase my proposed edit ("objects" -> "elements") 2017-02-10 01:31:14 -05:00
Rob Speer
5cc5e0851e Fix a misleading statement in Iterator.nth()
The `Iterator.nth()` documentation says "Note that all preceding elements will be consumed". I assumed from that that the preceding elements would be the *only* ones that were consumed, but in fact the returned element is consumed as well.

The way I read the documentation, I assumed that `nth(0)` would not discard anything (as there are 0 preceding elements), so I added a sentence clarifying that it does. I also rephrased it to avoid the stunted "i.e." phrasing.
2017-02-10 01:31:14 -05:00
bors
f80514426a Auto merge of #39712 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #39587, #39674, #39693, #39700, #39705, #39707
- Failed merges:
2017-02-10 04:50:08 +00:00
Corey Farwell
84ad515793 Rollup merge of #39707 - durka:parsimonious-span-note, r=jonathandturner
change span_notes to notes in E0368/E0369

Fixes #39650.

All the uses of `span_note` in these errors were reusing the same span as the original error, which causes unnecessary repetition.

For an example, see the changes to [src/test/ui/span/issue-39018.stderr](https://github.com/rust-lang/rust/pull/39707/files?diff=unified#diff-46336f62958fdb34233db414cb9914a1R4).

r? @jonathandturner
2017-02-09 19:43:26 -05:00
Corey Farwell
3199b2478a Rollup merge of #39705 - tspiteri:name-trait-fn-params, r=aturon
name anonymous fn parameters in libcore traits

This follows the discussion in rust-lang/rfcs#1685. The patch gives names to anonymous parameters in libcore traits. It would have two benefits I can think of: firstly it would provide names to tools that can use the names from the traits, and secondly core/std can serve as an example when writing traits; this change helps by not encouraging the use of anonymous parameters.
2017-02-09 19:43:25 -05:00
Corey Farwell
af1ddb9ec5 Rollup merge of #39700 - msopena:master, r=est31
Adding compile fail test for const_indexing feature

First attempt at contributing to rust. Picked up an easy feature to test.

Issue #39059
r? @est31
2017-02-09 19:43:24 -05:00
Corey Farwell
ae5d8fc929 Rollup merge of #39693 - durka:patch-36, r=petrochenkov
driver: restore partially deleted comment

Fixes #39689. Comment was lost in commit 811b8747 (#31916 @nagisa).
2017-02-09 19:43:23 -05:00
Corey Farwell
ed7f3c4635 Rollup merge of #39674 - jseyfried:fix_token_tree_parsing_ICE, r=nrc
parser: fix ICE when parsing token trees after an error

Fixes #39388, fixes #39616.
r? @nrc
2017-02-09 19:43:21 -05:00
Corey Farwell
41653fd26a Rollup merge of #39587 - Keruspe:master, r=alexcrichton
rustbuild: support setting verbosity in config.toml

Most if not all the configuration is settable trhough config.toml but the verbosity isn't yet.

This avoids having to pass -v to x.py on each command if you want verbosity to be always on.
2017-02-09 19:43:20 -05:00
Brian Anderson
e491f39914 Update 1.15.1 relnotes 2017-02-10 00:30:02 +00:00
Alex Burka
9fffd14171 change span_notes to notes in E0368/E0369 2017-02-09 22:45:42 +00:00
Jethro Beekman
ba82a76db9 Update set operations documentation
Reminding people of set terminology.
2017-02-09 14:16:16 -08:00
bors
24a70eb598 Auto merge of #39694 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #39604, #39619, #39670, #39678, #39682, #39683
- Failed merges:
2017-02-09 21:58:10 +00:00
Trevor Spiteri
e626a6807c name anonymous fn parameters in libcore traits 2017-02-09 22:31:21 +01:00
Sean Griffin
b3937ea862 Explicitly mention that Vec::reserve is based on len not capacity
I spent a good chunk of time tracking down a buffer overrun bug that
resulted from me mistakenly thinking that `reserve` was based on the
current capacity not the current length. It would be helpful if this
were called out explicitly in the docs.
2017-02-09 13:58:48 -05:00
Mario
ec4a3cc371 Adding compile fail test for const_indexing feature 2017-02-09 19:39:46 +01:00
Corey Farwell
55c17a5994 Rollup merge of #39683 - solson:fix-unaligned-load-librustc_metadata, r=bluss
Fix unaligned load in librustc_metadata::index.

The derived `Clone` impl contains UB and will be unsafe when we fix https://github.com/rust-lang/rust/issues/27060. See [this comment](https://github.com/rust-lang/rust/issues/27060#issuecomment-278617096) for more context.

r? @bluss
2017-02-09 12:14:24 -05:00
Corey Farwell
7e2b2f30cd Rollup merge of #39682 - solson:fix-unaligned-read, r=eddyb
Fix unsafe unaligned loads in test.

r? @eddyb
cc @Aatch @nikomatsakis

The `#[derive(PartialEq, Debug)]` impls on a packed struct contain undefined behaviour. Both generated impls take references to unaligned fields, which will fail to compile once we correctly treat that as unsafe (see https://github.com/rust-lang/rust/issues/27060).

This UB was found by running the test under [Miri](https://github.com/solson/miri/) which rejects these unsafe unaligned loads. 😄

Here's a simpler example:

```rust
struct Packed {
    a: u8,
    b: u64,
}
```

It expands to:

```rust
    fn fmt(&self, __arg_0: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        match *self {
            Packed { a: ref __self_0_0, b: ref __self_0_1 } => { // BAD: these patterns are unsafe
                let mut builder = __arg_0.debug_struct("Packed");
                let _ = builder.field("a", &&(*__self_0_0));
                let _ = builder.field("b", &&(*__self_0_1));
                builder.finish()
            }
        }
    }
```

and

```rust
    fn eq(&self, __arg_0: &Packed) -> bool {
        match *__arg_0 {
            Packed { a: ref __self_1_0, b: ref __self_1_1 } => // BAD: these patterns are unsafe
            match *self {
                Packed { a: ref __self_0_0, b: ref __self_0_1 } => // BAD: these patterns are unsafe
                true && (*__self_0_0) == (*__self_1_0) &&
                    (*__self_0_1) == (*__self_1_1),
            },
        }
    }
```
2017-02-09 12:14:23 -05:00
Corey Farwell
7bd0da7e89 Rollup merge of #39678 - vadimcn:top-level-expn, r=michaelwoerister
Exclude top-level macro expansions from source location override.

It occurred to me that a simple heuristic can address the issue #36382: any macros that expand into items (including `include!()`) don't need to be stepped over because there's not code to step through above a function scope level.

r? @michaelwoerister
2017-02-09 12:14:22 -05:00
Corey Farwell
711b95f6b1 Rollup merge of #39670 - JanZerebecki:fix-mailmap-gifnksm, r=steveklabnik
Fix mailmap for @gifnksm

cc rust-lang-nursery/thanks#71
2017-02-09 12:14:21 -05:00