Commit Graph

93802 Commits

Author SHA1 Message Date
Ralf Jung 082da0c698 rename Scalar::Bits to Scalar::Raw and bits field to data 2019-05-26 11:08:03 +02: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
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
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
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
ljedrz 2f3533b758 Add clippy and fix commands to x.py 2019-05-25 15:30:16 +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
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
Oliver Scherer db652fcde4 Render unresolved anon consts like closures 2019-05-25 10:07:01 +02:00
Oliver Scherer 669bc77886 `u8` is printed as a number, not a character 2019-05-25 10:07:01 +02:00
Oliver Scherer 9b5896ade3 Render const byte slices in MIR 2019-05-25 10:07:01 +02:00
Oliver Scherer fa17654f79 Make `ConstValue::Slice` solely take `[u8]` and `str` 2019-05-25 10:07:01 +02:00
Oliver Scherer af6ac1fa14 Refactor string constant printing to prep for byte string printing 2019-05-25 10:07:01 +02:00
Oliver Scherer 264c149c89 Add test showing how byte slices are printed in MIR 2019-05-25 10:07:01 +02:00
Oliver Scherer e694b63cd1 Don't use `ty::Const` without immediately interning 2019-05-25 10:07:01 +02:00
Oliver Scherer 9d82107f16 Print const chars escaped with surrounding quotes 2019-05-25 10:07:01 +02:00
Oliver Scherer 5713677862 Merge the string printing paths of ty::Const 2019-05-25 10:07:01 +02:00
Oliver Scherer a92d97ee70 There's a tcx in scope, don't use the tls one 2019-05-25 10:07:01 +02:00
Oliver Scherer 8d4f4cdada Reuse the pretty printing architecture for printing of constants 2019-05-25 10:07:01 +02:00
Oliver Scherer d85e866c0d Ignore .vscode even if it is a symlink 2019-05-25 10:07:01 +02:00
Oliver Scherer 86d65d8ec8 Remove unnecessary secondary recursion 2019-05-25 10:07:00 +02:00
bors 315ab95a9c 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)

Failed merges:

r? @ghost
2019-05-25 04:10:07 +00:00
Mazdak Farrokhzad 1cd3dddc94
Rollup merge of #61104 - spastorino:eval-place-to-op-iterate, r=oli-obk
Make eval_place_to_op iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:38 +02:00
Mazdak Farrokhzad dd33e8a84a
Rollup merge of #61103 - spastorino:find-iterate, r=oli-obk
Make find iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:37 +02:00
Mazdak Farrokhzad e30300d6e8
Rollup merge of #61099 - spastorino:ignore-borrow-iterate, r=oli-obk
Make ignore_borrow iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:36 +02:00
Mazdak Farrokhzad af015527aa
Rollup merge of #61094 - spastorino:find-local-iterate, r=oli-obk
Make find_local iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:34 +02:00
Mazdak Farrokhzad b4f6e5baeb
Rollup merge of #61093 - spastorino:borrow-of-local-data-iterate, r=oli-obk
Make borrow_of_local_data iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:33 +02:00
Mazdak Farrokhzad 1ce0288e2f
Rollup merge of #61092 - spastorino:sanitize-place-iterative, r=oli-obk
Make sanitize_place iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:32 +02:00
Mazdak Farrokhzad 19b5a10346
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.

r? @cramertj
2019-05-25 04:55:45 +02:00
Mazdak Farrokhzad 92f1cfd039
Rollup merge of #61134 - nvzqz:reverse_bits-must_use, r=varkor
Annotate each `reverse_bits` with `#[must_use]`

Because the name sounds like an in-place mutation like `[T]::reverse(&mut self)`, it may be confused for one.

This change was requested at https://github.com/rust-lang/rust/issues/48763#issuecomment-493743741.
2019-05-25 04:55:43 +02:00
Mazdak Farrokhzad 98052b032f
Rollup merge of #61125 - XAMPPRocky:master, r=jonas-schievink
Updated my mailmap entry
2019-05-25 04:55:41 +02:00
Mazdak Farrokhzad deaacafc11
Rollup merge of #61121 - RalfJung:miri-value-printing, r=oli-obk
improve debug-printing of scalars

* Prettier printing for `Pointer` and `Bits`.
* Don't print the `ScalarMaybeUndef(...)` around `Scalar`.

Before: `Immediate(ScalarMaybeUndef(Scalar(Ptr(Pointer { alloc_id: AllocId(3401), offset: Size { raw: 4 }, tag: Tagged(7723) }))))`
After: `Immediate(Scalar(AllocId(3401).0x4[<7723>]))`

Before: `Immediate(ScalarMaybeUndef(Scalar(Bits { size: 8, bits: 10 })))`
After: `Immediate(Scalar(0x000000000000000A))`

Before: `Immediate(ScalarMaybeUndef(Scalar(Bits { size: 1, bits: 1 })))`
After: `Immediate(Scalar(0x01))`

r? @oli-obk
2019-05-25 04:55:40 +02:00
Mazdak Farrokhzad 57139e2055
Rollup merge of #61118 - pnkfelix:issue-60654-dont-ice-on-gat, r=varkor
Dont ICE on an attempt to use GAT without feature gate

Fix #60654
2019-05-25 04:55:39 +02:00
Mazdak Farrokhzad 56e77b7851
Rollup merge of #61116 - scottmcm:vcpp-download-link, r=alexcrichton
Remove the incorrect warning from README.md

My problem was user error; thanks to @Zoxc for fixing me!

r? @alexcrichton
2019-05-25 04:55:37 +02:00
Mazdak Farrokhzad 8e5e1a0d3c
Rollup merge of #61113 - SimonSapin:fnbox, r=alexcrichton
Deprecate `FnBox`. `Box<dyn FnOnce()>` can be called directly, since 1.35

FCP completion: https://github.com/rust-lang/rust/issues/28796#issuecomment-439731515
2019-05-25 04:55:36 +02:00
Mazdak Farrokhzad 65ddf284b6
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.

[Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=%23%5Ballow(dead_code)%5D%0Atype%20SendVec%3CT%3A%20Send%3E%20%3D%20Vec%3CT%3E%3B)

According to guidelines,
r? @steveklabnik
2019-05-25 04:55:34 +02:00
Mazdak Farrokhzad f8b3ebea6f
Rollup merge of #61110 - ehuss:revert-edition-override, r=Mark-Simulacrum
Revert edition-guide toolstate override

Closes #60929
2019-05-25 04:55:33 +02:00