bors [Sun, 26 May 2019 06:09:08 +0000 (06:09 +0000)]
Auto merge of #61201 - Centril:rollup-975knrk, r=Centril
Rollup of 9 pull requests
Successful merges:
- #61087 (Tweak `self` arg not as first argument of a method diagnostic)
- #61114 (Vec: avoid creating slices to the elements)
- #61144 (Suggest borrowing for loop head on move error)
- #61149 (Fix spelling in release notes)
- #61161 (MaybeUninit doctest: remove unnecessary type ascription)
- #61173 (Auto-derive Encode and Decode implementations of DefPathTable)
- #61184 (Add additional trace statements to the const propagator)
- #61189 (Turn turbo 🐟 🍨 into an error)
- #61193 (Add comment to explain why we change the layout for Projection)
bors [Sun, 26 May 2019 03:26:10 +0000 (03:26 +0000)]
Auto merge of #60852 - alexcrichton:std-backtrace, r=sfackler
std: Depend on `backtrace` crate from crates.io
This commit removes all in-tree support for generating backtraces in
favor of depending on the `backtrace` crate on crates.io. This resolves
a very longstanding piece of duplication where the standard library has
long contained the ability to generate a backtrace on panics, but the
code was later extracted and duplicated on crates.io with the
`backtrace` crate. Since that fork each implementation has seen various
improvements one way or another, but typically `backtrace`-the-crate has
lagged behind libstd in one way or another.
The goal here is to remove this duplication of a fairly critical piece
of code and ensure that there's only one source of truth for generating
backtraces between the standard library and the crate on crates.io.
Recently I've been working to bring the `backtrace` crate on crates.io
up to speed with the support in the standard library which includes:
* Support for `StackWalkEx` on MSVC to recover inline frames with
debuginfo.
* Using `libbacktrace` by default on MinGW targets.
* Supporting `libbacktrace` on OSX as an option.
* Ensuring all the requisite support in `backtrace`-the-crate compiles
with `#![no_std]`.
* Updating the `libbacktrace` implementation in `backtrace`-the-crate to
initialize the global state with the correct filename where necessary.
After reviewing the code in libstd the `backtrace` crate should be at
exact feature parity with libstd today. The backtraces generated should
have the same symbols and same number of frames in general, and there's
not known divergence from libstd currently.
Note that one major difference between libstd's backtrace support and
the `backtrace` crate is that on OSX the crates.io crate enables the
`coresymbolication` feature by default. This feature, however, uses
private internal APIs that aren't published for OSX. While they provide
more accurate backtraces this isn't appropriate for libstd distributed
as a binary, so libstd's dependency on the `backtrace` crate explicitly
disables this feature and forces OSX to use `libbacktrace` as a
symbolication strategy.
The long-term goal of this refactoring is to eventually move us towards
a world where we can drop `libbacktrace` entirely and simply use Gimli
and the surrounding crates for backtrace support. That's still aways off
but hopefully will much more easily enabled by having the source of
truth for backtraces live in crates.io!
Procedurally if we go forward with this I'd like to transfer the
`backtrace-rs` crate to the rust-lang GitHub organization as well, but I
figured I'd hold off on that until we get closer to merging.
Instead of `self.deref_mut().as_mut_ptr()` to get a raw pointer to the buffer, use `self.buf.ptr_mut()`. This (a) avoids creating a unique reference to all existing elements without any need, and (b) creates a pointer that can actually be used for the *entire* buffer, and not just for the part of it covered by `self.deref_mut()`.
I also got worried about `RawVec::ptr` returning a `*mut T` from an `&self`, so I added both a mutable and an immutable version.
Cc @Gankro in particular for the `assume` changes -- I don't know why that is not in `Unique`, but I moved it up from `Vec::deref` to `RawVec::ptr` to avoid having to repeat it everywhere.
Rollup merge of #61087 - estebank:parsepalooza, r=Centril
Tweak `self` arg not as first argument of a method diagnostic
Mention that `self` is only valid on "associated functions"
```
error: unexpected `self` argument in function
--> $DIR/self-in-function-arg.rs:1:15
|
LL | fn foo(x:i32, self: i32) -> i32 { self }
| ^^^^ not valid as function argument
|
= note: `self` is only valid as the first argument of an associated function
```
When it is a method, mention it must be first
```
error: unexpected `self` argument in function
--> $DIR/trait-fn.rs:4:20
|
LL | fn c(foo: u32, self) {}
| ^^^^ must be the first associated function argument
```
Move a bunch of error recovery methods to `diagnostics.rs` away from `parser.rs`.
Alex Crichton [Wed, 15 May 2019 14:30:15 +0000 (07:30 -0700)]
std: Depend on `backtrace` crate from crates.io
This commit removes all in-tree support for generating backtraces in
favor of depending on the `backtrace` crate on crates.io. This resolves
a very longstanding piece of duplication where the standard library has
long contained the ability to generate a backtrace on panics, but the
code was later extracted and duplicated on crates.io with the
`backtrace` crate. Since that fork each implementation has seen various
improvements one way or another, but typically `backtrace`-the-crate has
lagged behind libstd in one way or another.
The goal here is to remove this duplication of a fairly critical piece
of code and ensure that there's only one source of truth for generating
backtraces between the standard library and the crate on crates.io.
Recently I've been working to bring the `backtrace` crate on crates.io
up to speed with the support in the standard library which includes:
* Support for `StackWalkEx` on MSVC to recover inline frames with
debuginfo.
* Using `libbacktrace` by default on MinGW targets.
* Supporting `libbacktrace` on OSX as an option.
* Ensuring all the requisite support in `backtrace`-the-crate compiles
with `#![no_std]`.
* Updating the `libbacktrace` implementation in `backtrace`-the-crate to
initialize the global state with the correct filename where necessary.
After reviewing the code in libstd the `backtrace` crate should be at
exact feature parity with libstd today. The backtraces generated should
have the same symbols and same number of frames in general, and there's
not known divergence from libstd currently.
Note that one major difference between libstd's backtrace support and
the `backtrace` crate is that on OSX the crates.io crate enables the
`coresymbolication` feature by default. This feature, however, uses
private internal APIs that aren't published for OSX. While they provide
more accurate backtraces this isn't appropriate for libstd distributed
as a binary, so libstd's dependency on the `backtrace` crate explicitly
disables this feature and forces OSX to use `libbacktrace` as a
symbolication strategy.
The long-term goal of this refactoring is to eventually move us towards
a world where we can drop `libbacktrace` entirely and simply use Gimli
and the surrounding crates for backtrace support. That's still aways off
but hopefully will much more easily enabled by having the source of
truth for backtraces live in crates.io!
Procedurally if we go forward with this I'd like to transfer the
`backtrace-rs` crate to the rust-lang GitHub organization as well, but I
figured I'd hold off on that until we get closer to merging.
bors [Sat, 25 May 2019 22:42:12 +0000 (22:42 +0000)]
Auto merge of #56595 - ljedrz:x_py_clippy_fix, r=oli-obk
Add clippy and fix commands to x.py
Since they are kind of similar in nature, I have used the same approach as for `cargo check`. At least some of the boilerplate could probably be shared, but I'd prefer to gather some feedback before I decide to merge them more aggressively.
This works reasonably well for `clippy`; with `-A clippy::all` and some extra `#![feature(rustc_private)]`s almost the whole codebase can be processed. There are some concerns, though:
- unlike `check`, in order to be able to traverse all the crates, some of them need to be marked with the `#![feature(rustc_private)]` attribute
- `-W clippy::all` breaks on any error. Is there a way to produce errors but not have them break the progress?
- I'm not sure how to redirect the errors in a way that would show colors; for now I was able to de-jsonize and print them (something not needed for `check`)
`cargo fix` is much more stubborn; it refuses to acknowledge crates like `core` and `std`, so it doesn't progress much at all.
Since this is a bit more tricky than I have envisioned, I need some guidance:
- is this the right approach or am I doing something very wrong ^^?
- why are the extra `rustc_private` features necessary? I was hoping for the same treatment as `check`
- are changes in `clippy` and `cargo fix` needed e.g. in order to produce errors in the same manner as `check` or did I miss something?
- do we need this level of file granularity (e.g. for futureproofing) or can `check`, `clippy` and `fix` files be condensed?
Esteban Küber [Thu, 23 May 2019 19:54:27 +0000 (12:54 -0700)]
Tweak `self` arg not as first argument of a method diagnostic
Mention that `self` is only valid on "associated functions"
```
error: unexpected `self` argument in function
--> $DIR/self-in-function-arg.rs:1:15
|
LL | fn foo(x:i32, self: i32) -> i32 { self }
| ^^^^ not valid as function argument
|
= note: `self` is only valid as the first argument of an associated function
```
When it is a method, mention it must be first
```
error: unexpected `self` argument in function
--> $DIR/trait-fn.rs:4:20
|
LL | fn c(foo: u32, self) {}
| ^^^^ must be the first associated function argument
```
bors [Sat, 25 May 2019 04:10:07 +0000 (04:10 +0000)]
Auto merge of #61150 - Centril:rollup-wmm7qga, r=Centril
Rollup of 13 pull requests
Successful merges:
- #61026 (Tweak macro parse errors when reaching EOF during macro call parse)
- #61095 (Update cargo)
- #61096 (tidy: don't short-circuit on license error)
- #61107 (Fix a couple docs typos)
- #61110 (Revert edition-guide toolstate override)
- #61111 (Fixed type-alias-bounds lint doc)
- #61113 (Deprecate `FnBox`. `Box<dyn FnOnce()>` can be called directly, since 1.35)
- #61116 (Remove the incorrect warning from README.md)
- #61118 (Dont ICE on an attempt to use GAT without feature gate)
- #61121 (improve debug-printing of scalars)
- #61125 (Updated my mailmap entry)
- #61134 (Annotate each `reverse_bits` with `#[must_use]`)
- #61138 (Move async/await tests to their own folder)
Rollup merge of #61138 - varkor:async-await-tests, r=cramertj
Move async/await tests to their own folder
This moves run-pass and ui async/await tests to their own folder `src/test/ui/async-await` and organises some into subfolders. (It does not move rustdoc tests for async/await.)
I also did some drive-by cleaning up of issues/error code tests into their own folders (which already existed). These are in separate commits, so easy to separate out if that's more desirable.
Rollup merge of #61111 - Cerberuser:patch-1, r=steveklabnik
Fixed type-alias-bounds lint doc
The example code under type-alias-bounds lint produced two warnings - one from the lint itself and another from the dead_code lint, and only the second one was in the doc. This looked like an error, so I've added `#[allow(dead_code)]` and replaced the example output with the expected one.
bors [Sat, 25 May 2019 01:20:07 +0000 (01:20 +0000)]
Auto merge of #60441 - vext01:try-to-kill-projection-params, r=oli-obk
Make place projections concrete.
**I'm not sure if we want this. I'm raising the PR for discussion**
Whilst doing some work on our Rust fork, I noticed the following:
Once upon a time (commit 9bd35c07c26) there were two kinds of
projection: one for places, and one for constants. It therefore made
sense to share the `Projection` struct for both. Although the different
use-cases used different concrete types, sharing was made possible by
type-parameterisation of `Projection`.
Since then, however, the usage of projections in constants has
disappeared, meaning that (forgetting lifetimes for a moment) the
parameterised type is only every instantiated under one guise. So it may
as well be a concrete type. Right?
What do people think? This is entirely untested, although it does check.
If we *don't* want this, then we should at least update the incorrect comment against `Projection`.
bors [Fri, 24 May 2019 19:22:13 +0000 (19:22 +0000)]
Auto merge of #60777 - pietroalbini:azure-pipelines, r=alexcrichton
Add Azure Pipelines configuration
Huge thanks to @johnterickson and @willsmythe for writing the initial config! :heart:
I applied some changes to the initial config and disabled most of the builders since we're not going to run all of them during the initial step for the evaluation.
[More details about our plans for the Azure Pipelines evaluation.](https://internals.rust-lang.org/t/update-on-the-ci-investigation/10056)
r? @alexcrichton @kennytm
cc @rust-lang/infra @ethomson @rylev