Commit Graph

68073 Commits

Author SHA1 Message Date
bors
0253d98382 Auto merge of #44847 - estebank:unused-signature, r=nikomatsakis
Point at signature on unused lint

```
warning: struct is never used: `Struct`
  --> $DIR/unused-warning-point-at-signature.rs:22:1
   |
22 | struct Struct {
   | ^^^^^^^^^^^^^
```

Fix #33961.
2017-09-29 07:05:10 +00:00
bors
a379780fb6 Auto merge of #44811 - zilbuz:issue-44596/E0506, r=arielb1
MIR-borrowck: Adding notes to E0506

This PR adds notes to the MIR borrowck error E0506.

Part of #44596
2017-09-29 03:54:12 +00:00
bors
46ef6208f8 Auto merge of #44528 - tmnilsson:attr_proc_macro_cfg_process, r=jseyfried
Apply attr proc macros before cfg processing

Fixes #39336.
r? @jseyfried
2017-09-28 23:38:52 +00:00
bors
3c96d40d32 Auto merge of #44278 - Binero:master, r=BurntSushi
Allow replacing HashMap entries

This is an obvious API hole. At the moment the only way to retrieve an entry from a `HashMap` is to get an entry to it, remove it, and then insert a new entry. This PR allows entries to be replaced.
2017-09-28 18:52:49 +00:00
bors
688a858391 Auto merge of #44785 - alexcrichton:update-cargo, r=nikomatsakis
Update some minor dependencies

* run `cargo update`
* Update cargo submodule
* Update to the `cc` crate from `gcc`
2017-09-28 16:19:58 +00:00
Alex Crichton
7694ca419b Update to the cc crate
This is the name the `gcc` crate has moved to
2017-09-28 07:45:50 -07:00
bors
d88736905e Auto merge of #44806 - KiChjang:mir-err-notes-2, r=pnkfelix
Add span label to E0384 for MIR borrowck

Corresponds to `report_illegal_reassignment`.

Part of #44596.
2017-09-28 12:40:12 +00:00
bors
f22b9da1c3 Auto merge of #44790 - clarcharr:zip_bytes, r=sfackler
TrustedRandomAccess specialisation for Iterator::cloned when Item: Copy.

This should fix #44424. It also provides a potential fix for more iterators using `Iterator::cloned`.
2017-09-28 09:10:12 +00:00
bors
9cb90f4e23 Auto merge of #44779 - tjkirch:master, r=alexcrichton
Add aarch64-unknown-linux-musl target

This adds support for the aarch64-unknown-linux-musl target in the build and CI systems.

This addresses half of issue #42520.

The new file `aarch64_unknown_linux_musl.rs` is a copy of `aarch64_unknown_linux_gnu.rs` with "gnu" replaced by "musl", and the added logic in `build-arm-musl.sh` is similarly a near-copy of the arches around it, so overall the changes were straightforward.

Testing:

```
$ sudo ./src/ci/docker/run.sh cross
...
Dist std stage2 (x86_64-unknown-linux-gnu -> aarch64-unknown-linux-musl)
Building stage2 test artifacts (x86_64-unknown-linux-gnu -> aarch64-unknown-linux-musl)
   Compiling getopts v0.2.14
   Compiling term v0.0.0 (file:///checkout/src/libterm)
   Compiling test v0.0.0 (file:///checkout/src/libtest)
    Finished release [optimized] target(s) in 16.91 secs
Copying stage2 test from stage2 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / aarch64-unknown-linux-musl)
...
Build completed successfully in 0:55:22
```

```
$ rustup toolchain link local obj/build/x86_64-unknown-linux-gnu/stage2
$ rustup default local
```

After setting the local toolchain as default, and adding this in ~/.cargo/config:

```
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
```

...then the toolchain was able to build a working ripgrep as a test:

```
$ readelf -a target/aarch64-unknown-linux-musl/debug/rg | grep -i interpreter
$ readelf -a target/aarch64-unknown-linux-musl/debug/rg | grep NEEDED
$ file target/aarch64-unknown-linux-musl/debug/rg
target/aarch64-unknown-linux-musl/debug/rg: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=be11036b0988fac5dccc9f6487eb780b05186582, not stripped
```
2017-09-28 03:28:20 +00:00
Alex Crichton
041d3550f6 Update some minor dependencies 2017-09-27 15:40:57 -07:00
Alex Crichton
9b91b877ad Update the Cargo submodule 2017-09-27 15:40:57 -07:00
Nick Cameron
71a0be0792 Update the RLS again 2017-09-27 15:40:57 -07:00
Nick Cameron
bfcb290937 Add RLS and Rustfmt to the toolstate mechanism 2017-09-27 15:40:57 -07:00
Nick Cameron
c0ea270f70 Rename rls component to rls-preview on nightly 2017-09-27 15:40:57 -07:00
Nick Cameron
c5cad5a78d Update RLS and Rustfmt 2017-09-27 15:40:57 -07:00
bors
44d5090a6d Auto merge of #44782 - estebank:issue-36700, r=GuillaumeGomez
Point at parameter type on E0301

On "the parameter type `T` may not live long enough" error, point to the
parameter type suggesting lifetime bindings:

```
error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
27 | struct Foo<T> {
   |            - help: consider adding an explicit lifetime bound `T: 'static`...
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'static T` does not outlive the data it points at
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
```

Fix #36700.
2017-09-27 22:00:11 +00:00
Tomas Nilsson
0f97b6b73c Apply attr proc macros before cfg processing
Now items are not fully configured until right before expanding derives.
2017-09-27 22:08:45 +02:00
bors
0e6f4cf51c Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkov
Initial support for `..=` syntax

#28237

This PR adds `..=` as a synonym for `...` in patterns and expressions.
Since `...` in expressions was never stable, we now issue a warning.

cc @durka
r? @aturon
2017-09-27 16:04:31 +00:00
bors
1fd3a42c62 Auto merge of #44713 - zackmdavis:fn_main_in_a_comment_in_rustdoc_breaks_tests, r=QuietMisdreavus
don't let rustdoc get confused by text "fn main" in a line comment

~~~Resolves~~~ (edited) partially addresses #21299.

![rustdoc_fn_main](https://user-images.githubusercontent.com/1076988/30630993-9aeecc4a-9d97-11e7-8e56-2b973f23f683.png)

r? @QuietMisdreavus
2017-09-27 10:56:23 +00:00
bors
412ac93dce Auto merge of #44825 - dtolnay:cratelint, r=aturon
Allow unused extern crate again

This is a partial revert of #42588. There is a usability concern reported in #44294 that was not considered in the discussion of the PR, so I would like to back this out of 1.21. As is, I think users would have a worse and more confusing experience with this lint enabled by default. We can re-enabled once there are better diagnostics or the case in #44294 does not trigger the lint.
2017-09-27 08:20:11 +00:00
Keith Yeung
6d4989b821 Add span label to E0384 for MIR borrowck 2017-09-26 22:20:53 -07:00
bors
e53ab9104a Auto merge of #44812 - Mark-Simulacrum:rustdoc-debug, r=alexcrichton
Allow rustdoc to get compiled with debuginfo

Fixes #44810

cc @QuietMisdreavus
r? @alexcrichton
2017-09-27 04:57:34 +00:00
bors
f71b37bc28 Auto merge of #44802 - sfackler:vecdeque-oob, r=Gankro
Fix capacity comparison in reserve

You can otherwise end up in a situation where you don't actually resize
but still call into handle_cap_increase which then corrupts head/tail.

Closes #44800

Not totally sure the right way to write a test for this - there are some debug asserts the old bad behavior will hit but we don't build the stdlib with debug assertions by default.

r? @Gankro
2017-09-27 01:23:24 +00:00
Mark Simulacrum
33b5ec3d4d Allow rustdoc to get compiled with debuginfo 2017-09-26 17:12:19 -06:00
Zack M. Davis
9f68d62e0c don't let rustdoc get confused by text "fn main" in a line comment
This is in the matter of #21299.
2017-09-26 16:00:54 -07:00
bors
d4da744247 Auto merge of #44757 - jseyfried:fix_bad_derive_collection, r=nrc
macros: fix bug in collecting trait and impl items with derives.

Fixes #43023.
r? @nrc
2017-09-26 22:26:13 +00:00
Basile Desloges
b683538ef2 mir-borrowck: Edit compile-fail tests with E0506 error to also test on MIR borrowck 2017-09-26 21:56:37 +02:00
Badel2
5102309b1f bump rustfmt 2017-09-26 20:57:13 +02:00
bors
930d3b17dd Auto merge of #44741 - qmx:trans_fulfill_obligation_should_not_crash, r=nikomatsakis
use param_env on the trait_cache key

We bailed from making trans_fulfill_obligation return `Option` or `Result`, just made it less prone to crashing outside trans

r? @nikomatsakis
2017-09-26 18:29:57 +00:00
Basile Desloges
e28c73d71f mir-borrowck: Add span labels to report_illegal_mutation_of_borrowed() 2017-09-26 19:09:56 +02:00
Basile Desloges
34d36c0168 mir-borrowck: Add borrow data parameter to report_illegal_mutation_of_borrowed() 2017-09-26 19:09:56 +02:00
bors
1c4510adc8 Auto merge of #44736 - pnkfelix:mir-borrowck4, r=arielb1
Some fixes to mir-borrowck

Make the code more closely match the NLL RFC (updated description).

(The biggest visible fix the addition of the Shallow/Deep distinction, which means mir-borrowck stops falsely thinking that StorageDeads need deep access to their input L-value.)
2017-09-26 09:19:03 +00:00
bors
4b8bf391fd Auto merge of #44735 - tirr-c:issue-42143, r=arielb1
Friendlier error message for closure argument type mismatch

Rebased #42270.
Fixes #42143.

---

`test.rs`:

```rust
fn main() {
    foo(|_: i32, _: usize| ());
}

fn foo<F>(_: F) where F: Fn(&str, usize) {}
```

Before:

```
error[E0281]: type mismatch: `[closure@test.rs:2:9: 2:30]` implements the trait `std::ops::Fn<(i32, usize)>`, but the trait `for<'r> std::ops::Fn<(&'r str, usize)>` is required
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- implements `std::ops::Fn<(i32, usize)>`
  |     |
  |     expected &str, found i32
  |     requires `for<'r> std::ops::Fn<(&'r str, usize)>`
  |
  = note: required by `foo`
```

After (early):

```
error[E0631]: type mismatch in closure arguments
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- takes arguments of type `i32` and `usize`
  |     |
  |     expected arguments of type `&str` and `usize`
  |
  = note: required by `foo`
```

After (current):

```
error[E0631]: type mismatch in closure arguments
 --> test.rs:2:5
  |
2 |     foo(|_: i32, _: usize| ());
  |     ^^^ --------------------- found signature of `fn(i32, usize) -> _`
  |     |
  |     expected signature of `for<'r> fn(&'r str, usize) -> _`
  |
  = note: required by `foo`
```

~~Compiler output has been changed, and a few tests are failing. Help me writing/fixing tests!~~

r? @nikomatsakis
2017-09-26 05:02:03 +00:00
Jeffrey Seyfried
375332c6b9 Fix bug in collecting trait and impl items with derives. 2017-09-25 18:21:53 -07:00
bors
82ae9682ca Auto merge of #44297 - laumann:suggest-misspelt-methods, r=arielb1
Add suggestions for misspelled method names

Use the syntax::util::lev_distance module to provide suggestions when a
named method cannot be found.

Part of #30197
2017-09-25 23:09:06 +00:00
bors
6c476ce462 Auto merge of #44279 - smaeul:crt_static-deps, r=alexcrichton
Require rlibs for dependent crates when linking static executables

This handles the case for `CrateTypeExecutable` and `+crt_static`. I reworked the match block to avoid duplicating the `attempt_static` and error checking code again (this case would have been a copy of the `CrateTypeCdylib`/`CrateTypeStaticlib` case).

On `linux-musl` targets where `std` was built with `crt_static = false` in `config.toml`, this change brings the test suite from entirely failing to mostly passing.

This change should not affect behavior for other crate types, or for targets which do not respect `+crt_static`.
2017-09-25 20:37:02 +00:00
Esteban Küber
9c3fa4d3ef Point at signature on unused lint 2017-09-25 13:25:54 -07:00
bors
3df1f7b82d Auto merge of #44085 - bjorn3:no_llvm_write_metadata, r=arielb1
Allow writing metadata without llvm

# Todo:

* [x] Rebase
* [x] Fix eventual errors
* [x] <strike>Find some crate to write elf files</strike> (will do it later)

Cc #43842
2017-09-25 18:05:22 +00:00
Douglas Campos
9d52cb2f84 those changes break miri, PR will be issued later 2017-09-25 09:51:51 -04:00
Douglas Campos
043d873b32 fix tidy errors 2017-09-25 09:50:37 -04:00
Douglas Campos
119882eaa5 add comment per @nikomatsakis request 2017-09-25 09:50:37 -04:00
Douglas Campos
c900abf42d expose ParamEnv as a param 2017-09-25 09:50:37 -04:00
Douglas Campos
77d3ca1bad add ParamEnv to the trait_cache key 2017-09-25 09:50:37 -04:00
bors
91dbf52af3 Auto merge of #44809 - arielb1:small-scope, r=eddyb
encode region::Scope using fewer bytes

Now that region::Scope is no longer interned, its size is more important. This PR encodes region::Scope in 8 bytes instead of 12, which should speed up region inference somewhat (perf testing needed) and should improve the margins on #36799 by 64MB (that's not a lot, I did this PR mostly to speed up region inference).

This is a perf-sensitive PR. Please don't roll me up.

r? @eddyb

This is based on  #44743 so I could get more accurate measurements on #36799.
2017-09-25 12:52:02 +00:00
Felix S. Klock II
e319f4093c Remove now dead code. 2017-09-25 14:02:39 +02:00
Felix S. Klock II
d9d10c1628 Make mir-borrowck more closely match (draft) NLL RFC.
In particular:

 * introduce the shallow/deep distinction for read/write accesses

 * use the notions of prefixes, shallow prefixes, and supporting prefixes
   rather than trying to recreate the restricted sets from ast-borrowck.

 * Add shallow reads of Discriminant and ArrayLength, and treat them
   as artificial fields when doing prefix traversals.
2017-09-25 14:02:34 +02:00
Felix S. Klock II
c4c32b24bd More fine-grained delineation for mir-borrowck errors. 2017-09-25 13:02:17 +02:00
Ariel Ben-Yehuda
7bb0923e46 fix Debug impls 2017-09-25 13:47:19 +03:00
bors
dcb4378e18 Auto merge of #44646 - petrochenkov:scompress, r=michaelwoerister
Compress most of spans to 32 bits

As described in https://internals.rust-lang.org/t/rfc-compiler-refactoring-spans/1357/28

Closes https://github.com/rust-lang/rust/issues/15594
r? @michaelwoerister
2017-09-25 09:01:53 +00:00
David Tolnay
247b58b4f4
Allow unused extern crate again
This is a partial revert of #42588. There is a usability concern
reported in #44294 that was not considered in the discussion of the PR,
so I would like to back this out of 1.21. As is, I think users would
have a worse and more confusing experience with this lint enabled by
default. We can re-enabled once there are better diagnostics or the case
in #44294 does not trigger the lint.
2017-09-24 23:57:45 -07:00