Commit graph

94330 commits

Author SHA1 Message Date
Esteban Küber
74fb3bbee4 On type inference errors use the type argument name when possible
```
error[E0282]: type annotations needed in `std::result::Result<i32, E>`
 --> file7.rs:3:13
  |
3 |     let b = Ok(4);
  |         -   ^^ cannot infer type for `E` in `std::result::Result<i32, E>`
  |         |
  |         consider giving `b` a type`
```
2019-05-31 18:33:59 -07:00
Esteban Küber
65c2a7b18b Alternative wording for inference failure 2019-05-31 18:33:59 -07:00
Esteban Küber
8bb094dac5 Add more detail to type inference error
When encountering code where type inference fails, add more actionable
information:

```
fn main() {
    let foo = Vec::new();
}
```

```
error[E0282]: type annotations needed for `std::vec::Vec<_>`
  --> $DIR/vector-no-ann.rs:2:16
   |
LL |     let foo = Vec::new();
   |         ---   ^^^^^^^^ cannot infer type for `T`
   |         |
   |         consider giving `foo` the type `std::vec::Vec<_>` with the type parameter `T` specified
```

We still need to modify type printing to optionally accept a
`TypeVariableTable` in order to properly print `std::vec::Vec<T>`.

CC #25633.
2019-05-31 18:33:59 -07:00
bors
84f729d0d4 Auto merge of #61394 - pietroalbini:rollup-lzugnb4, r=pietroalbini
Rollup of 11 pull requests

Successful merges:

 - #60897 (error: remove StringError from Debug output)
 - #61304 (Speed up Azure CI installing Windows dependencies)
 - #61319 (Swap order of `unsafe async fn` to `async unsafe fn`)
 - #61342 (Set ellipsis_inclusive_range_patterns lint to warn)
 - #61344 (Add regression test for const generics ICE)
 - #61359 (Fix links in Deref documentation)
 - #61363 (Stabilize iter_nth_back feature)
 - #61369 (Fixed lifetime misspelling)
 - #61372 (Migrate some books to mdbook version 0.2)
 - #61374 (Explicitly suggest 'type_ascription' feature)
 - #61382 (Fixed a typo in core::convert::AsMut)

Failed merges:

r? @ghost
2019-06-01 00:57:37 +00:00
bors
041bec87c0 Auto merge of #61300 - indygreg:upgrade-cross-make, r=sanxiyn
Update musl-cross-make to 0.9.8

This version uses musl 1.1.22 and GCC 6.4.0 by default. It also
contains support for newer binutils and GCC versions, should we
want to bump those as well. But I'm purposefully limiting this
patch in order to reduce the surface area for controversy.
2019-05-31 22:16:09 +00:00
Esteban Küber
d6ea6b972d fix tidy 2019-05-31 13:50:04 -07:00
varkor
5e3ff4c2f1 Add test for condition in trait const param 2019-05-31 20:49:19 +01:00
bors
7840a0b753 Auto merge of #57967 - eddyb:rmangle, r=michaelwoerister
Introduce Rust symbol mangling scheme.

This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 ~~- but with some differences, see https://github.com/rust-lang/rfcs/pull/2603#issuecomment-458410463 for details~~ (@michaelwoerister integrated my proposed changes into the RFC itself).

On nightly, you can now control the mangling scheme with `-Z symbol-mangling-version`, which can be:
* `legacy`: the older mangling version, still the default currently
* `v0`: the new RFC mangling version, as implemented by this PR

To test the new mangling, set `RUSTFLAGS=-Zsymbol-mangling-version=v0` (or change [`rustflags` in `.cargo/config.toml`](https://doc.rust-lang.org/cargo/reference/config.html#configuration-keys)). Please note that only symbols from crates built with that flag will use the new mangling, and that tool support (e.g. debuggers) will be limited initially, and it may take a while for everything to be upstreamed. However, `RUST_BACKTRACE` should work out of the box with either mangling version.

<hr/>

The demangling implementation PR is https://github.com/alexcrichton/rustc-demangle/pull/23
~~(this PR already uses it via a git dependency, to allow testing)~~.

Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel.

*Notes for reviewers*:
* ~~only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)~~
~~based on #58140~~
* the "harness" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater
* ~~there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now~~ (we're gating this on `-Z symbol-mangling-version=v0`, see above)

r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
2019-05-31 17:10:11 +00:00
Ralf Jung
f23cbeab1d miri unsizing: fix projecting into a field of an operand 2019-05-31 18:57:47 +02:00
Eduard-Mihai Burtescu
3652ea4594 test: add a more complex symbol-name testcase. 2019-05-31 19:24:15 +03:00
Eduard-Mihai Burtescu
9cf35bfbe7 rustc_codegen_utils: remove symbol name dumping/checking harness, and mw impl. 2019-05-31 18:24:55 +03:00
Eduard-Mihai Burtescu
6386a31c5b rustc_codegen_utils: update mw's symbol mangler implementation. 2019-05-31 18:24:54 +03:00
Eduard-Mihai Burtescu
0e5f27b169 rustc_codegen_utils: add harness for dumping/checking symbol names, and mw mangling impl. 2019-05-31 18:24:54 +03:00
Eduard-Mihai Burtescu
e3315075f9 test: force legacy mangling for run-make-fulldeps/a-b-a-linker-guard. 2019-05-31 18:24:54 +03:00
Eduard-Mihai Burtescu
5fd3e89d70 test: support both (legacy and v0) choices of mangling. 2019-05-31 18:24:53 +03:00
Eduard-Mihai Burtescu
408bf9de34 rustc_codegen_utils: don't ignore Ctor path components in symbols. 2019-05-31 18:24:53 +03:00
Eduard-Mihai Burtescu
2092963a18 rustc_codegen_utils: add new mangling scheme implementation. 2019-05-31 18:24:42 +03:00
Eduard-Mihai Burtescu
654d0596d3 rustc_codegen_utils: test demangler output, not just symbol names. 2019-05-31 18:23:03 +03:00
Eduard-Mihai Burtescu
e898905141 Update rustc-demangle version. 2019-05-31 18:23:02 +03:00
bors
75f464481e Auto merge of #61298 - matthiaskrgr:submodule_upd, r=oli-obk
submodules: update clippy from fb33fad0 to d2f51228

Changes:
````
Rustup to https://github.com/rust-lang/rust/pull/61203
rustup https://github.com/rust-lang/rust/pull/60928
rustup https://github.com/rust-lang/rust/pull/61164 (which is included in https://github.com/rust-lang/rust/pull/61274)
````

Fixes #61287

r? @oli-obk
2019-05-31 14:06:17 +00:00
Pietro Albini
e32386d70e
Rollup merge of #61382 - OptimisticPeach:patch-1, r=Centril
Fixed a typo in core::convert::AsMut

Just missing a space, and added a comma to make more idiomatic.
2019-05-31 13:34:08 +02:00
Pietro Albini
e36b90752c
Rollup merge of #61374 - VirrageS:master, r=Centril
Explicitly suggest 'type_ascription' feature

Closes: #61325

r? @estebank
2019-05-31 13:34:07 +02:00
Pietro Albini
f100dfbb3e
Rollup merge of #61372 - mati865:books, r=Centril,GuillaumeGomez
Migrate some books to mdbook version 0.2

There are 3 books still using old version but they need more effort so I hope to do them in subsequent PR if I find the time.
2019-05-31 13:34:06 +02:00
Pietro Albini
f20b5ccdaf
Rollup merge of #61369 - Vallentin:patch-1, r=varkor
Fixed lifetime misspelling
2019-05-31 13:34:03 +02:00
Pietro Albini
562602c150
Rollup merge of #61363 - lzutao:stabilize-iter_nth_back, r=Centril
Stabilize iter_nth_back feature

FCP done in https://github.com/rust-lang/rust/issues/56995#issuecomment-491145691

Closes #56995

r? @Centril
2019-05-31 13:34:02 +02:00
Pietro Albini
7b83862f10
Rollup merge of #61359 - GuillaumeGomez:fix-deref-doc-links, r=Manishearth
Fix links in Deref documentation

Fixes #61358.

In commonmark, the "link alias" has to be right after the link. Screenshot:

<img width="970" alt="Screenshot 2019-05-30 at 19 01 58" src="https://user-images.githubusercontent.com/3050060/58650155-3b594e00-830e-11e9-956c-4dadefa40ff0.png">

r? @Manishearth
2019-05-31 13:34:00 +02:00
Pietro Albini
2106d57c35
Rollup merge of #61344 - varkor:const-failed-to-life-ice, r=Centril
Add regression test for const generics ICE

Closes https://github.com/rust-lang/rust/issues/60879.
2019-05-31 13:33:58 +02:00
Pietro Albini
860deae4c6
Rollup merge of #61342 - memoryruins:ellipsis_inclusive_range_patterns, r=Centril
Set ellipsis_inclusive_range_patterns lint to warn

Continuing #54910, the `ellipsis_inclusive_range_patterns` lint is set to warn.

r? @Centril
2019-05-31 13:33:57 +02:00
Pietro Albini
4f7c41a535
Rollup merge of #61319 - Centril:async-unsafe-fn-order, r=cramertj
Swap order of `unsafe async fn` to `async unsafe fn`

Change the order of `unsafe async fn` to `async unsafe fn`.

I had intended to do this a while back but didn't get around to it...

This should be done because:
- It is the order used by `const unsafe fn` so therefore it is consistent.
- This keeps all the "effect/restriction" modifiers to the left of `unsafe` (which according to some is not an effect) instead of mixing them such that we are more forward compatible with some sort of effect system.

r? @cramertj
2019-05-31 13:33:55 +02:00
Pietro Albini
90d4ef3af2
Rollup merge of #61304 - lzybkr:iwr_progress, r=alexcrichton
Speed up Azure CI installing Windows dependencies

There is known issue where PowerShell is unreasonably slow downloading
files due to an issue with rendering the progress bar, see this [issue](https://github.com/PowerShell/PowerShell/issues/2138)

That issue is fixed in PowerShell Core (available in Azure Pipelines as
pwsh.exe) but it can also be worked around by setting:

    $ProgressPreference = 'SilentlyContinue'

I measured downloading LLVM and it took about 220s before, 5s after, so the improvement is significant.
2019-05-31 13:33:54 +02:00
Pietro Albini
eebe62aaa1
Rollup merge of #60897 - seanmonstar:patch-4, r=sfackler
error: remove StringError from Debug output

Seeing `StringError("something something")` in debug output can cause
 someone to think there was an error dealing with `String`s, not that the
error type is just a string. So, remove that noise.

For example:

```
io error: Custom { kind: InvalidData, error: StringError("corrupt data") }
```

With this change:

```
io error: Custom { kind: InvalidData, error: "corrupt data" }
```
2019-05-31 13:33:51 +02:00
bors
db4c783319 Auto merge of #60166 - oli-obk:type_name, r=eddyb
Make the `type_name` intrinsic deterministic

cc @eddyb for the printing infrastructure
cc @Centril for the deterministic (coherent?) output

r? @sfackler
2019-05-31 10:42:31 +00:00
Wesley Wiser
3b7223deaf Doc comment fixes for rustc::mir::interpret::InterpretCx 2019-05-31 05:01:35 -04:00
John Kåre Alsaker
66a376ea4f Store CtxtInterners for local values in AllArenas 2019-05-31 10:21:34 +02:00
John Kåre Alsaker
6d387463aa Remove GlobalArenas and use Arena instead 2019-05-31 09:44:37 +02:00
Yuki Okushi
8f34a50cc5 Remove ty::BrFresh and new_bound 2019-05-31 15:09:04 +09:00
Lzu Tao
1c26bbf628 Stabilize reverse_bits feature 2019-05-31 04:43:53 +00:00
Esteban Küber
860dce794c Remove unecessary -Z continue-parse-after-error from tests 2019-05-30 18:57:17 -07:00
Esteban Küber
ad0d3b5d40 Move code from parser to diagnostics 2019-05-30 18:19:48 -07:00
Esteban Küber
1ee45da2b9 Remove ArgSource::Recovery 2019-05-30 18:02:40 -07:00
Esteban Küber
b3ac88ad92 Recover gracefully from argument with missing type or param name 2019-05-30 17:59:05 -07:00
varkor
7e92607f5a Fix unwrapping usize issue in HasMutInterior 2019-05-31 01:19:59 +01:00
varkor
eb0afe1845 Add more information in ConstEvalFailure error 2019-05-31 01:19:59 +01:00
varkor
f2210a9971 Update LLVM 2019-05-31 00:49:06 +01:00
OptimisticPeach
fc21f33d4d
Fixed some typos. 2019-05-30 19:37:23 -04:00
Mazdak Farrokhzad
2ebfbb4fab Parse 'async unsafe fn' instead of 'unsafe async fn'. 2019-05-31 00:53:10 +02:00
varkor
c3febc0884 Make "panic did not include expected string" message consistent
Note messages are typically lowercase.
2019-05-30 21:58:33 +01:00
Janusz Marcinkiewicz
4c5eb8ecfc Explicitly suggest 'type_ascription' feature 2019-05-30 22:44:39 +02:00
bors
3ade426ede Auto merge of #61353 - alexcrichton:less-tools, r=pietroalbini
ci: Favor SCRIPT instead of RUST_CHECK_TARGET

Since #61212 we've been timing out on OSX, and this looks to be because
we're building tools like Cargo and the RLS twice instead of once. This
turns out to be a slight bug in our configuration. CI builders using the
`RUST_CHECK_TARGET` directive actually execute `make all` just before
their acual target. In `make all` we're building a stage2 cargo, and
then in `make dist` we're building a stage1 cargo.

Other builders use `SCRIPT` which provides explicit control over what
`x.py` script, for example, is used to execute the build. This moves
almost all targets to using `SCRIPT` to ensure that we're explicitly
specifying what's being built where. Additionally this updates the logic
of `RUST_CHECK_TARGET` to remove the pre-flight tidy as well as the
pre-flight `make all`. The system LLVM builder (run on PRs) now
explicitly runs tidy first and then runs the rest of the test suite.
2019-05-30 19:52:11 +00:00
Christian Vallentin
66aa18bb44
Fixed lifetime misspelling 2019-05-30 21:29:32 +02:00