Commit Graph

93836 Commits

Author SHA1 Message Date
Jad Ghalayini 03cce1d81e Added error message for E0284 2019-05-26 16:48:02 -04:00
bors dc6db14e1c Auto merge of #61210 - Centril:rollup-ofr6h5b, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #61077 (Don't arena-allocate static symbols.)
 - #61102 (Move path for iterate)
 - #61120 (Make eval_place iterate instead of recurse)
 - #61205 (docs: fix typo #61197)

Failed merges:

r? @ghost
2019-05-26 12:24:25 +00:00
Mazdak Farrokhzad e9933ee099
Rollup merge of #61205 - airt:docs-fix-typo-#61197, r=Centril
docs: fix typo #61197

Fixes #61197

Change `#[doc(inline)}` to `#[doc(inline)]` in the [#[doc]](https://doc.rust-lang.org/rustdoc/the-doc-attribute.html) documentation.
2019-05-26 13:37:59 +02:00
Mazdak Farrokhzad c3e1f99a69
Rollup merge of #61120 - spastorino:eval-place-iterate, r=oli-obk
Make eval_place iterate instead of recurse

r? @oli-obk
2019-05-26 13:37:57 +02:00
Mazdak Farrokhzad a40b82bead
Rollup merge of #61102 - spastorino:move-path-for-iterate, r=oli-obk
Move path for iterate

r? @oli-obk
2019-05-26 13:37:56 +02:00
Mazdak Farrokhzad 58eb22fdae
Rollup merge of #61077 - nnethercote:tweak-prefill, r=petrochenkov
Don't arena-allocate static symbols.

It's just a waste of memory. This also gets rid of the special case for
"".

r? @petrochenkov
2019-05-26 13:37:55 +02:00
bors 566f3d7b08 Auto merge of #61080 - mati865:mingw_pgo, r=sanxiyn
Ship profiler with windows-gnu

Fixes https://github.com/rust-lang/rust/issues/49409

I don't know if we can enable it for testing, windows-gnu jobs are already taking too long: https://github.com/rust-lang/rust/issues/59637.

r? @michaelwoerister

P.S.
I have tested only x86_64 build.
2019-05-26 09:40:11 +00:00
bors 2268d9923b 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)

Failed merges:

r? @ghost
2019-05-26 06:09:08 +00:00
airt dbf8c6df9d
docs: fix typo #61197 2019-05-26 12:17:33 +08:00
bors 572892c324 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.
2019-05-26 03:26:10 +00:00
Mazdak Farrokhzad 8d247e716b
Rollup merge of #61193 - spastorino:add-comment, r=RalfJung
Add comment to explain why we change the layout for Projection

r? @RalfJung

Addresses the comment in https://github.com/rust-lang/rust/pull/61104/files#r287556257
2019-05-26 02:13:35 +02:00
Mazdak Farrokhzad 6ae3c2b2a4
Rollup merge of #61189 - oli-obk:turbofish_ice, r=varkor
Turn turbo 🐟 🍨 into an error

Master branch part of #60989

r? @varkor
2019-05-26 02:13:33 +02:00
Mazdak Farrokhzad d8b828beea
Rollup merge of #61184 - wesleywiser:const_prop_tracing, r=oli-obk
Add additional trace statements to the const propagator

This makes it easier to figure out when const propagation fails.
2019-05-26 02:13:32 +02:00
Mazdak Farrokhzad f530f90b56
Rollup merge of #61173 - fabric-and-ink:minor-cleanup, r=varkor
Auto-derive Encode and Decode implementations of DefPathTable

See https://github.com/rust-lang/rust/pull/60647#discussion_r283394682
2019-05-26 02:13:31 +02:00
Mazdak Farrokhzad 7b8b23ceba
Rollup merge of #61161 - RalfJung:maybe-uninit, r=Centril
MaybeUninit doctest: remove unnecessary type ascription
2019-05-26 02:13:29 +02:00
Mazdak Farrokhzad fadd73830e
Rollup merge of #61149 - vishalsodani:master, r=Centril
Fix spelling in release notes
2019-05-26 02:13:28 +02:00
Mazdak Farrokhzad b4a3d44a87
Rollup merge of #61144 - estebank:issue-61108, r=matthewjasper
Suggest borrowing for loop head on move error

Fix #61108.
2019-05-26 02:13:27 +02:00
Mazdak Farrokhzad f185ee5fda
Rollup merge of #61114 - RalfJung:vec, r=Gankro
Vec: avoid creating slices to the elements

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.

Fixes https://github.com/rust-lang/rust/issues/60847
2019-05-26 02:13:25 +02:00
Mazdak Farrokhzad 24cc368118
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`.

Fix #51547. CC #60015.
2019-05-26 02:13:24 +02:00
Alex Crichton d1040fe329 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.
2019-05-25 17:09:45 -07:00
Santiago Pastorino 294dc18208 Make move_path_for iterate instead of recurse 2019-05-26 00:51:55 +02:00
bors 483567e097 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?

Hopes-to-fix: https://github.com/rust-lang/rust/issues/53896

Cc @alexcrichton, @zackmdavis
2019-05-25 22:42:12 +00:00
Santiago Pastorino a0700d062e Inline move_path_for_projection inside move_path_for 2019-05-25 23:52:43 +02:00
Santiago Pastorino e8beea7019 Make eval_place iterate instead of recurse 2019-05-25 23:36:55 +02:00
Santiago Pastorino e6aa4b8033 Add comment to explain why we change the layout for Projection 2019-05-25 22:28:15 +02:00
Oliver Scherer a15df94b69 Turn ICE on type arguments on variables into an error 2019-05-25 21:16:27 +02:00
Esteban Küber 4e68ddca90 review comments: move back some methods and clean up wording 2019-05-25 12:15:06 -07:00
Esteban Küber d1364d5284 Move some methods to `diagnostics.rs` away from `parser.rs`
Move a bunch of error recovery methods to `diagnostics.rs` away from
`parser.rs`.
2019-05-25 12:11:41 -07:00
Esteban Küber 976541884f 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
```
2019-05-25 12:05:18 -07:00
bors f492693982 Auto merge of #59276 - oli-obk:cleanups, r=eddyb
Cleanup (pretty) printing of `ty::Const`

r? @eddyb

addresses 5cd2806621 (r266243236) and 5cd2806621 (r266243336)
2019-05-25 16:08:11 +00:00
Oliver Scherer 0b732aa607 Update nll ui tests 2019-05-25 17:21:29 +02:00
Wesley Wiser 9bfbbd2a78 Add additional trace statements to the const propagator
This makes it easier to figure out when const propagation fails.
2019-05-25 11:02:59 -04:00
ljedrz 2f3533b758 Add clippy and fix commands to x.py 2019-05-25 15:30:16 +02:00
Fabian Drinck a5e9d8240e Auto-derive Encode and Decode implementations 2019-05-25 11:40:06 +02:00
bors 02f5786a32 Auto merge of #61151 - Centril:rollup-5rpyhfo, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #61092 (Make sanitize_place iterate instead of recurse)
 - #61093 (Make borrow_of_local_data iterate instead of recurse)
 - #61094 (Make find_local iterate instead of recurse)
 - #61099 (Make ignore_borrow iterate instead of recurse)
 - #61103 (Make find iterate instead of recurse)
 - #61104 (Make eval_place_to_op iterate instead of recurse)

Failed merges:

r? @ghost
2019-05-25 09:30:02 +00:00
Ralf Jung 428ab7e1bd shadow as_ptr as as_mut_ptr in Vec to avoid going through Deref 2019-05-25 10:36:07 +02:00
Ralf Jung 9d82826e55 add test checking that Vec push/pop does not invalidate pointers 2019-05-25 10:11:00 +02:00
varkor e694807650 Fix missing tcx 2019-05-25 10:07:02 +02:00
Oliver Scherer a0275e3bf3 Only print integers in symbol path's constants 2019-05-25 10:07:02 +02:00
Oliver Scherer dd327951eb Update ui tests 2019-05-25 10:07:02 +02:00
Oliver Scherer 825cfdbadc Print types for unevaluated constants 2019-05-25 10:07:02 +02:00
Oliver Scherer fa459a08e1 Fix rebase fallout 2019-05-25 10:07:02 +02:00
Oliver Scherer 52fa900d62 Break cycle during array length printing 2019-05-25 10:07:02 +02:00
Eduard-Mihai Burtescu 89b2fb631a rustc: integrate ty::Const into ty::print as print_const. 2019-05-25 10:07:02 +02:00
Oliver Scherer 28198bb3be Update ui tests 2019-05-25 10:07:02 +02:00
Oliver Scherer b816ec1eb4 Print unevaluted constants as `_` or as their source representation 2019-05-25 10:07:02 +02:00
Oliver Scherer ecee75d114 Use `write_char` to skip the formatting infrastructure 2019-05-25 10:07:02 +02:00
Oliver Scherer 90bb861b2e Fix tidy 2019-05-25 10:07:01 +02:00
Oliver Scherer fec79d3552 Print generic args in function calls in MIR 2019-05-25 10:07:01 +02:00
Oliver Scherer 0528954c80 Group common printing code during constant pretty printing 2019-05-25 10:07:01 +02:00