Commit Graph

1043 Commits

Author SHA1 Message Date
Igor Matuszewski 2fa30ecf77 Add libc to rustc-workspace-hack 2020-12-05 18:08:33 +01:00
Igor Matuszewski bd37d7d827 Update RLS and Rustfmt 2020-12-05 16:40:24 +01:00
LeSeulArtichaut 0cf5a8ad15 Create `rustc_ty_library` 2020-12-02 20:28:41 +01:00
Guillaume Gomez 8a35b93c4d Add rustc_lexer as dependency to rustc_passes 2020-12-02 10:42:50 +01:00
Ralf Jung 4eb64c842b update Miri 2020-11-30 18:15:19 +01:00
Linus Färnstrand f9220c3b14 Bump dependencies invalidly assuming memory layout of SocketAddr
Bumps net2, socket2 and miow.
Helps unblock https://github.com/rust-lang/rust/pull/78802
2020-11-29 10:51:03 +01:00
Eric Huss c46e8964ae Update cargo 2020-11-24 09:33:37 -08:00
Alex Crichton f99410bb4b std: Update the backtrace crate submodule
This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.
2020-11-20 11:56:07 -08:00
bors 74285eb3a8 Auto merge of #78088 - fusion-engineering-forks:panic-fmt-lint, r=estebank
Add lint for panic!("{}")

This adds a lint that warns about `panic!("{}")`.

`panic!(msg)` invocations with a single argument use their argument as panic payload literally, without using it as a format string. The same holds for `assert!(expr, msg)`.

This lints checks if `msg` is a string literal (after expansion), and warns in case it contained braces. It suggests to insert `"{}", ` to use the message literally, or to add arguments to use it as a format string.

![image](https://user-images.githubusercontent.com/783247/96643867-79eb1080-1328-11eb-8d4e-a5586837c70a.png)

This lint is also a good starting point for adding warnings about `panic!(not_a_string)` later, once [`panic_any()`](https://github.com/rust-lang/rust/pull/74622) becomes a stable alternative.
2020-11-20 03:40:20 +00:00
LeSeulArtichaut f59d03038c Move `rustc_ty` -> `rustc_ty_utils` 2020-11-19 21:57:29 +01:00
Mara Bos 53ddb73fd3
Rollup merge of #79120 - calebcartwright:update-rustfmt, r=Mark-Simulacrum
update rustfmt to v1.4.27

Fixes https://github.com/rust-lang/rustfmt/issues/4528
2020-11-17 16:13:55 +01:00
Mara Bos d6da5254a0
Rollup merge of #78138 - fortanix:raoul/dlmalloc0.2, r=Mark-Simulacrum
Upgrade dlmalloc to version 0.2

In preparation of adding dynamic memory management support for SGXv2-enabled platforms, the dlmalloc crate has been refactored. More specifically, support has been added to implement platform specification outside of the dlmalloc crate. (see https://github.com/alexcrichton/dlmalloc-rs/pull/15)

This PR upgrades dlmalloc to version 0.2 for the `wasm` and `sgx` targets.

As the dlmalloc changes have received a positive review, but have not been merged yet, this PR contains a commit to prevent tidy from aborting CI prematurely.

cc: `@jethrogb`
2020-11-17 10:06:16 +01:00
Caleb Cartwright 74d54660c1 update rustfmt to v1.4.27 2020-11-16 19:30:21 -06:00
bors 603ab5bd6e Auto merge of #79064 - ehuss:rustbook-logs, r=Mark-Simulacrum
Fix displaying errors when rustbook tests fail.

This ensures that output from mdbook is displayed when running the rustbook wrapper. I believe this was a regression as a result of #69115 where it was changed from running `rustdoc` directly to using rustbook.
2020-11-15 15:39:58 +00:00
Jonas Schievink 568354f01f
Rollup merge of #79063 - calebcartwright:update-rustfmt, r=Mark-Simulacrum
Update rustfmt to v1.4.26
2020-11-15 13:40:07 +01:00
Dylan DPC 335a2554f9
Rollup merge of #78963 - richkadel:llvm-coverage-counters-2.0.4, r=tmandry
Added some unit tests as requested

As discussed in PR #78267, for example:

* https://github.com/rust-lang/rust/pull/78267#discussion_r515404722
* https://github.com/rust-lang/rust/pull/78267#discussion_r515405958

r? ```````@tmandry```````
FYI: ```````@wesleywiser```````

This is pretty much self contained, but depending on feedback and timing, I may have a chance to add a few more unit tests requested against `counters.rs`. I'm looking at those now.
2020-11-15 03:02:46 +01:00
Eric Huss 5b9e9d018f Fix displaying errors when rustbook tests fail. 2020-11-14 17:37:02 -08:00
Caleb Cartwright a49848a607 Update rustfmt to v1.4.26 2020-11-14 18:47:34 -06:00
Raoul Strackx 292f15ce87 Upgrading dlmalloc to 0.2.1 2020-11-12 21:40:52 +01:00
Caleb Cartwright cd314ae99c update rustfmt 2020-11-11 21:28:24 -06:00
Rich Kadel bd0eb07af2 Added some unit tests as requested
As discussed in PR #78267, for example:

* https://github.com/rust-lang/rust/pull/78267#discussion_r515404722
* https://github.com/rust-lang/rust/pull/78267#discussion_r515405958
2020-11-11 16:40:17 -08:00
Vishnunarayan K I 86a7831f0b formatting 2020-11-10 00:21:25 +05:30
Dylan DPC 0aed74aa43
Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis
Update Chalk to 0.36.0

This PR updates Chalk and fixes a number of bugs in the chalk integration code.

cc `@rust-lang/wg-traits`
r? `@nikomatsakis`
2020-11-09 19:06:46 +01:00
Vishnunarayan K I a4e94ec9b8 update gsgdt 2020-11-09 22:39:12 +05:30
Vishnunarayan K I ea1460773f make MIR graphviz generation use gsgdt
gsgdt [https://crates.io/crates/gsgdt] is a crate which provides an
interface for stringly typed graphs. It also provides generation of
graphviz dot format from said graph.
2020-11-09 22:39:06 +05:30
Alessandro Ghedini bff2e46248 Bump Rustfmt and RLS
Should hopefully fix #78341 and #78340.
2020-11-06 18:44:06 +00:00
bors f92b931045 Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27
Add non_autolinks lint

Part of #77501.

r? `@jyn514`
2020-11-06 04:17:41 +00:00
Guillaume Gomez f467b8d77c Extend automatic_links lint to take into account URLs without link syntax 2020-11-05 10:22:08 +01:00
Eric Huss bdbcaf02c5 Update cargo 2020-11-04 16:15:18 -08:00
Mara Bos 52405f7c0c
Rollup merge of #77950 - arlosi:sha256, r=eddyb
Add support for SHA256 source file hashing

Adds support for `-Z src-hash-algorithm sha256`, which became available in LLVM 11.

Using an older version of LLVM will cause an error `invalid checksum kind` if the hash algorithm is set to sha256.

r? `@eddyb`
cc #70401 `@est31`
2020-11-03 19:32:26 +01:00
Aaron Hill 23018a55d9
Implement rustc side of report-future-incompat 2020-10-30 20:02:14 -04:00
Matthew Jasper 4d60a80713 Address review comment and update chalk to 0.36.0 2020-10-30 19:39:33 +00:00
Matthew Jasper 299a65ff71 Update chalk 0.32.0 -> 0.35.0 2020-10-30 19:39:30 +00:00
Dylan DPC efbbdac163
Rollup merge of #78137 - tmiasko:compiletest-tracing, r=Mark-Simulacrum
Initialize tracing subscriber in compiletest tool

The logging in compiletest was migrated from log crate to a tracing, but
the initialization code was never changed, so logging is non-functional.

Initialize tracing subscriber using default settings.
2020-10-26 03:09:02 +01:00
Yuki Okushi e00e611c28
Rollup merge of #78209 - JohnTitor:compiler-builtins, r=Amanieu
Update `compiler_builtins` to 0.1.36

So, the libc build with cargo's `build-std` feature emits a lot of warnings like:
```
 warning: a method with this name may be added to the standard library in the future
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.35/src/int/udiv.rs:98:23
    |
98  |             q = n << (<$ty>::BITS - sr);
    |                       ^^^^^^^^^^^
...
268 |         udivmod_inner!(n, d, rem, u128)
    |         ------------------------------- in this macro invocation
    |
    = warning: once this method is added to the standard library, the ambiguity may cause an error or change in behavior!
    = note: for more information, see issue #48919 <rust-lang/rust/issues/48919>
    = help: call with fully qualified syntax `Int::BITS(...)` to keep using the current method
    = help: add `#![feature(int_bits_const)]` to the crate attributes to enable `num::<impl u128>::BITS`
    = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
```

(You can find the full log in https://github.com/rust-lang/libc/runs/1283695796?check_suite_focus=true for example.)

0.1.36 contains https://github.com/rust-lang/compiler-builtins/pull/332 so this version should remove this warning.

cc https://github.com/rust-lang/libc/issues/1942
2020-10-25 18:43:42 +09:00
bors 17cc9b6256 Auto merge of #77398 - wesleywiser:measureme_0_8, r=Mark-Simulacrum
Upgrade to measureme 9.0.0

I believe I did this correctly but there's still a reference to `measureme@0.7.1` coming from `rustc-ap-rustc_data_structures` and I'm not sure how to resolve that.

r? `@Mark-Simulacrum`

We'll also need to deploy the new version of the tools on perf.rlo.
2020-10-25 04:48:37 +00:00
Wesley Wiser 5ac5556d63 Upgrade to measureme 9.0.0 2020-10-24 22:39:42 -04:00
bors 7c533c89b3 Auto merge of #78310 - ebroto:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update.

This includes a Cargo.lock update: [ca11eeb ](ca11eeb563) (should be rollup=never)

r? `@Manishearth`
2020-10-25 00:24:49 +00:00
Jonas Schievink e34263d86a
Rollup merge of #77610 - hermitcore:dtors, r=m-ou-se
revise Hermit's mutex interface to support the behaviour of StaticMutex

rust-lang/rust#77147 simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. To support the new behavior of StaticMutex, we move part of the mutex implementation into libstd.

The interface to the OS changed. Consequently, I removed a few functions, which aren't longer needed.
2020-10-24 22:39:44 +02:00
Eduardo Broto ca11eeb563 Update Cargo.lock 2020-10-23 23:47:58 +02:00
Yuki Okushi 29461c1668
Rollup merge of #78169 - ehuss:update-cargo, r=ehuss
Update cargo

3 commits in 79b397d72c557eb6444a2ba0dc00a211a226a35a..dd83ae55c871d94f060524656abab62ec40b4c40
2020-10-15 14:41:21 +0000 to 2020-10-20 19:31:26 +0000
- Support glob patterns for package/target selection (rust-lang/cargo#8752)
- Update env_logger requirement from 0.7.0 to 0.8.1 (rust-lang/cargo#8795)
- Fix man page links inside `option` blocks. (rust-lang/cargo#8793)
2020-10-23 18:26:35 +09:00
Yuki Okushi 3a58ad91f6 Update `compiler_builtins` to 0.1.36 2020-10-22 07:10:25 +09:00
varkor 878c97e70c Update to rustc-demangle 0.1.18 2020-10-21 21:11:11 +01:00
varkor 2b9d22d3a9 Update rustc-demangle 2020-10-21 21:05:38 +01:00
Eric Huss e852a4abf0 Update cargo 2020-10-20 16:36:46 -07:00
Mara Bos 6b44662669 Parse the format string for the panic_fmt lint for better warnings. 2020-10-20 22:25:42 +02:00
Tomasz Miąsko 08d5e96736 Initialize tracing subscriber in compiletest tool
The logging in compiletest was migrated from log crate to a tracing, but
the initialization code was never changed, so logging is non-functional.

Initialize tracing subscriber using default settings.
2020-10-20 00:00:00 +00:00
Yuki Okushi 050eb4d7e4
Rollup merge of #77971 - jyn514:broken-intra-doc-links, r=mark-simulacrum
Deny broken intra-doc links in linkchecker

Since rustdoc isn't warning about these links, check for them manually.

This also fixes the broken links that popped up from the lint.
2020-10-17 05:36:49 +09:00
bors 8e6f69afc9 Auto merge of #77962 - bugadani:arena2, r=Mark-Simulacrum
Remove arena's dependency on `rustc_data_structures`

`rustc_arena` currently has a dependency on `rustc_data_structures` because of a trivial "don't inline me" function. This PR copies that function and removes the dependency.
2020-10-16 04:40:53 +00:00
Joshua Nelson 65835d1059 Deny broken intra-doc links in linkchecker
Since rustdoc isn't warning about these links, check for them manually.
2020-10-15 20:22:16 -04:00
Dániel Buga 52ff31a7eb Arena: Copy cold_path and remove rustc_data_structures dependency 2020-10-15 10:56:33 +02:00
Eric Huss 71bf7cfce1 Update cargo 2020-10-14 18:17:47 -07:00
Arlo Siemsen 3296d5ca7b Add support for SHA256 source file hashing for LLVM 11+. 2020-10-14 15:09:51 -07:00
Yuki Okushi 16612a9292
Rollup merge of #77239 - shepmaster:silicon-ci-plus, r=pietroalbini
Enable building Cargo for aarch64-apple-darwin

r? @ghost
2020-10-14 06:02:12 +09:00
Jake Goulding d909d69d3a Upgrade OpenSSL to 1.1.1h and add support for aarch64-apple-darwin 2020-10-12 13:57:39 -04:00
Pietro Albini f3d07b36ed
build-manifest: allow configuring the number of threads 2020-10-12 19:53:28 +02:00
Mateusz Mikuła 5aa661757a Update crossbeam-channel to avoid UB 2020-10-11 23:40:29 +02:00
Aaron Hill 44fdfd66ab
Bump backtrace-rs
Fixes #77791
2020-10-11 13:52:20 -04:00
Stefan Lankes 98fcc3fbc7
using the latest version of libhermit-rs 2020-10-11 11:53:54 +02:00
bors cae8bc1f23 Auto merge of #77731 - cuviper:big-endian-backtrace, r=alexcrichton
Update the backtrace crate to fix big-endian ELF

Pulls in rust-lang/backtrace-rs#373.
Fixes #77410.

r? `@alexcrichton`
2020-10-10 12:51:15 +00:00
bors 7b06cb1052 Auto merge of #77747 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update.

This includes a `Cargo.lock` update: 7ea42be

r? `@Manishearth`
2020-10-09 17:14:39 +00:00
flip1995 7ea42be036
Update Cargo.lock 2020-10-09 12:46:26 +02:00
bors 6b8b396aee Auto merge of #77698 - vandenheuvel:chalkup, r=jackh726
Update chalk to 0.32.0

r? `@jackh726`
2020-10-09 10:32:52 +00:00
Josh Stone 4addede1e7 Update the backtrace crate to fix big-endian ELF 2020-10-08 17:17:28 -07:00
Bram van den Heuvel e185278534 Update chalk to 0.32.0 2020-10-08 13:17:01 +02:00
Joshua Nelson 8b22d079bf Upgrade to tracing 0.2.13
The primary motivation is to get the changes from
https://github.com/tokio-rs/tracing/pull/990. Example output:

```
$ RUSTDOC_LOG=debug rustdoc +rustc2
warning: some trace filter directives would enable traces that are disabled statically
 | `debug` would enable the DEBUG level for all targets
 = note: the static max level is `info`
 = help: to enable DEBUG logging, remove the `max_level_info` feature
```

- Remove useless test

  This was testing for an ICE when passing `RUST_LOG=rustc_middle`.  I
  noticed it because it started giving the tracing warning (because tests
  are not run with debug-logging enabled). Since this bug seems unlikely
  to re-occur, I just removed it altogether.
2020-10-07 19:27:10 -04:00
bors 59dafb876e Auto merge of #77630 - Dylan-DPC:rollup-kfwl55z, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #76784 (Add some docs to rustdoc::clean::inline and def_id functions)
 - #76911 (fix VecDeque::iter_mut aliasing issues)
 - #77400 (Fix suggestions for x.py setup)
 - #77515 (Update to chalk 0.31)
 - #77568 (inliner: use caller param_env)
 - #77571 (Use matches! for core::char methods)
 - #77582 (Move `EarlyOtherwiseBranch` to mir-opt-level 2)
 - #77590 (Update RLS and Rustfmt)
 - #77605 (Fix rustc_def_path to show the full path and not the trimmed one)
 - #77614 (Let backends access span information)
 - #77624 (Add c as a shorthand check alternative for new options #77603)

Failed merges:

r? `@ghost`
2020-10-06 23:07:17 +00:00
Dylan DPC 6951c3180e
Rollup merge of #77590 - Xanewok:update-rls, r=dtolnay
Update RLS and Rustfmt

refs: https://github.com/rust-lang/rls/pull/1701

cc @calebcartwright

r? @dtolnay
2020-10-07 00:16:10 +02:00
bors 98edd1fbf8 Auto merge of #77386 - joshtriplett:static-glibc, r=petrochenkov
Support static linking with glibc and target-feature=+crt-static

With this change, it's possible to build on a linux-gnu target and pass
RUSTFLAGS='-C target-feature=+crt-static' or the equivalent via a
`.cargo/config.toml` file, and get a statically linked executable.

Update to libc 0.2.78, which adds support for static linking with glibc.

Add `crt_static_respected` to the `linux_base` target spec.

Update `android_base` and `linux_musl_base` accordingly. Avoid enabling
crt_static_respected on Android platforms, since that hasn't been
tested.

Closes https://github.com/rust-lang/rust/issues/65447.
2020-10-06 21:11:04 +00:00
Jack Huey 23491084bc Update to chalk 0.31. Implement some unimplemented. Ignore some tests in compare mode chalk don't finish. 2020-10-06 14:14:25 -04:00
Igor Matuszewski 1b9c45bddc Update RLS and Rustfmt 2020-10-05 21:40:20 +02:00
Rich Kadel f5aebad28f Updates to experimental coverage counter injection
This is a combination of 18 commits.

Commit #2:

Additional examples and some small improvements.

Commit #3:

fixed mir-opt non-mir extensions and spanview title elements

Corrected a fairly recent assumption in runtest.rs that all MIR dump
files end in .mir. (It was appending .mir to the graphviz .dot and
spanview .html file names when generating blessed output files. That
also left outdated files in the baseline alongside the files with the
incorrect names, which I've now removed.)

Updated spanview HTML title elements to match their content, replacing a
hardcoded and incorrect name that was left in accidentally when
originally submitted.

Commit #4:

added more test examples

also improved Makefiles with support for non-zero exit status and to
force validation of tests unless a specific test overrides it with a
specific comment.

Commit #5:

Fixed rare issues after testing on real-world crate

Commit #6:

Addressed PR feedback, and removed temporary -Zexperimental-coverage

-Zinstrument-coverage once again supports the latest capabilities of
LLVM instrprof coverage instrumentation.

Also fixed a bug in spanview.

Commit #7:

Fix closure handling, add tests for closures and inner items

And cleaned up other tests for consistency, and to make it more clear
where spans start/end by breaking up lines.

Commit #8:

renamed "typical" test results "expected"

Now that the `llvm-cov show` tests are improved to normally expect
matching actuals, and to allow individual tests to override that
expectation.

Commit #9:

test coverage of inline generic struct function

Commit #10:

Addressed review feedback

* Removed unnecessary Unreachable filter.
* Replaced a match wildcard with remining variants.
* Added more comments to help clarify the role of successors() in the
CFG traversal

Commit #11:

refactoring based on feedback

* refactored `fn coverage_spans()`.
* changed the way I expand an empty coverage span to improve performance
* fixed a typo that I had accidently left in, in visit.rs

Commit #12:

Optimized use of SourceMap and SourceFile

Commit #13:

Fixed a regression, and synched with upstream

Some generated test file names changed due to some new change upstream.

Commit #14:

Stripping out crate disambiguators from demangled names

These can vary depending on the test platform.

Commit #15:

Ignore llvm-cov show diff on test with generics, expand IO error message

Tests with generics produce llvm-cov show results with demangled names
that can include an unstable "crate disambiguator" (hex value). The
value changes when run in the Rust CI Windows environment. I added a sed
filter to strip them out (in a prior commit), but sed also appears to
fail in the same environment. Until I can figure out a workaround, I'm
just going to ignore this specific test result. I added a FIXME to
follow up later, but it's not that critical.

I also saw an error with Windows GNU, but the IO error did not
specify a path for the directory or file that triggered the error. I
updated the error messages to provide more info for next, time but also
noticed some other tests with similar steps did not fail. Looks
spurious.

Commit #16:

Modify rust-demangler to strip disambiguators by default

Commit #17:

Remove std::process::exit from coverage tests

Due to Issue #77553, programs that call std::process::exit() do not
generate coverage results on Windows MSVC.

Commit #18:

fix: test file paths exceeding Windows max path len
2020-10-05 08:02:58 -07:00
Josh Triplett 16ebf750cf Update libc to 0.2.79
This also fixes issues with inconsistent `unsafe` on functions.
2020-10-04 22:12:07 -07:00
Dylan DPC fffeaa7b83
Rollup merge of #77407 - pietroalbini:less-build-manifest, r=Mark-Simulacrum
Improve build-manifest to work with the improved promote-release

This PR makes some changes to build-manifest to have it work better with the other improvements I'm making to [promote-release](https://github.com/rust-lang/promote-release).

A new way to invoke the tool was added: `./x.py run src/tools/build-manifest`. The new invocation disables the generation of `.sha256` files and the generation of GPG signatures, as those steps are not tied to the Rust version we're building the manifest of: handling them in `promote-release` will improve the maintenability of our release process. Invocations through the old command (`./x.py dist hash-and-sign`) are referred inside the source code as "legacy". The new invocation also enables internal parallelism, disabled on legacy to avoid overloading our old server.

Improvements were also made on how the checksums included in the manifest are generated:

* The manifest is first generated with placeholder checksums, and then a function walks through the manifes and calculates only the needed hashes. Before this PR, all the hashes were calculated beforehand, including the hashes of unused files.
* Calculating the hashes is now done in parallel with rayon, to better utilize all the available disk bandwidth.
* The `sha2` crate is now used instead of the `sha256sum` CLI tool: this avoids the overhead of calling another process, but more importantly enables hardware acceleration whenever available (the `sha256sum` CLI tool doesn't support it at all).

r? @Mark-Simulacrum
This PR is best reviewed commit-by-commit.
2020-10-05 02:29:33 +02:00
Yuki Okushi 6e25418474
Rollup merge of #75143 - oli-obk:tracing, r=RalfJung
Use `tracing` spans to trace the entire MIR interp stack

r? @RalfJung

While being very verbose, this allows really good tracking of what's going on. While I considered schemes like the previous indenter that we had (which we could get by using the `tracing-tree` crate), this will break down horribly with things like multithreaded rustc. Instead, we can now use `RUSTC_LOG` to restrict the things being traced. You could specify a filter in a way that only shows the logging of a specific frame.

![screenshot of command line output of the new formatting](https://user-images.githubusercontent.com/332036/89291343-aa40de00-d65a-11ea-9f6c-ea06c1806327.png)

If we lower the span's level to `debug`, then in `info` level logging we'd not see the frames, but in `debug` level we would see them. The filtering rules in `tracing` are super powerful, but  I'm not sure if we can specify a filter so we do see `debug` level events, but *not* the `frame` spans. The documentation at https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/struct.EnvFilter.html makes me think that we can only turn on things, not turn off things at a more precise level.

cc @hawkw
2020-10-04 11:44:49 +09:00
Pietro Albini acd8e59b66
build-manifest: calculate checksums lazily and in parallel
This commit improves the way build-manifest calculates the checksums
included in the manifest, speeding it up:

* Instead of calculating all the hashes beforehand and then using the
  ones we need, the manifest is first generated with placeholder hashes,
  and then a function walks through the manifest and calculates only the
  needed checksums.

* Calculating the checksums is now done in parallel with rayon, to
  better utilize all the available disk bandwidth.

* Calculating the checksums now uses the sha2 crate instead of the
  sha256sum CLI tool: this avoids the overhead of calling another
  process, but more importantly uses hardware acceleration whenever
  available (the CLI tool doesn't support it at all).
2020-10-01 17:30:24 +02:00
bors 9b77a6a200 Auto merge of #77145 - pietroalbini:refactor-build-manifest-versions, r=Mark-Simulacrum
Refactor versions detection in build-manifest

This PR refactors how `build-manifest` handles versions, making the following changes:

* `build-manifest` now detects the "package releases" on its own, without relying on rustbuild providing them through CLI arguments. This drastically simplifies calling the tool outside of `x.py`, and will allow to ship the prebuilt tool in a tarball in the future, with the goal of stopping to invoke `x.py` during `promote-release`.
* The `tar` command is not used to extract the version and the git hash from tarballs anymore. The `flate2` and `tar` crates are used instead. This makes detecting those pieces of data way faster, as the archive is decompressed just once and we stop parsing the archive once all the information is retrieved.
* The code to extract the version and the git hash now stores all the collected data dynamically, without requiring to add new fields to the `Builder` struct every time.

I tested the changes locally and it should behave the same as before.

r? `@Mark-Simulacrum`
2020-09-29 16:41:53 +00:00
Oliver Scherer 43c181bac4 Use `tracing` spans to trace the entire MIR interp stack 2020-09-28 20:07:57 +02:00
bors 4e3eb52493 Auto merge of #77265 - vandenheuvel:chalkup, r=Dylan-DPC
Update chalk to 0.29.0
2020-09-28 06:20:02 +00:00
bors 7f7a1cbfd3 Auto merge of #77229 - tmiasko:liveness, r=lcnr
Small improvements in liveness pass

* Remove redundant debug logging (`add_variable` already contains logging).
* Remove redundant fields for a number of live nodes and variables.
* Delay conversion from a symbol to a string until linting.
* Inline contents of specials struct.
* Remove unnecessary local variable exit_ln.
* Use newtype_index for Variable and LiveNode.
* Access live nodes directly through self.lnks[ln].

No functional changes intended (except those related to the logging).
2020-09-27 19:38:01 +00:00
Bram van den Heuvel ef7377eb05 Update chalk to 0.29.0 2020-09-27 15:54:07 +02:00
Tomasz Miąsko 57d38975cc liveness: Use newtype_index for Variable and LiveNode 2020-09-26 16:44:41 +02:00
Ralf Jung 7ff5b44a58
Rollup merge of #77127 - camelid:update-mdbook, r=Dylan-DPC
Update mdBook

0.4.2 -> 0.4.3

Also updated version requirement in `Cargo.toml` from 0.4.0 to 0.4.3.
2020-09-26 12:58:22 +02:00
bors b984ef6797 Auto merge of #77152 - vandenheuvel:update_chalk_further, r=jackh726
Update chalk to 0.28.0
2020-09-25 12:22:05 +00:00
Bram van den Heuvel 51c781f613 Upgrade chalk to 0.28.0 2020-09-24 20:54:33 +02:00
Pietro Albini 89ffab76b7
build-manifest: refactor detecting package versions 2020-09-24 19:26:43 +02:00
Bram van den Heuvel 5f67571e34 Update chalk to 0.27.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel 61b2a6f5e5 Update chalk to 0.26.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel ed784023e5 Update chalk to 0.25.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel cb660c6ab5 Update chalk to 0.24.0 2020-09-24 19:10:01 +02:00
Bram van den Heuvel 52eeff6fbe Update chalk to 0.23.0 2020-09-24 19:10:00 +02:00
Bram van den Heuvel b832a97a51 Update chalk to 0.22.0 2020-09-24 19:10:00 +02:00
flip1995 d445493479
Update Cargo.lock 2020-09-24 14:51:13 +02:00
Camelid 945a732dd6 Update mdBook
0.4.2 -> 0.4.3
2020-09-23 16:18:59 -07:00
Andreas Jonson 6586c37bec Move MiniSet to data_structures
remove the need for T to be copy from MiniSet as was done for MiniMap
2020-09-23 08:09:16 +02:00
bors 6d3acf5129 Auto merge of #76928 - lcnr:opaque-types-cache, r=tmandry
cache types during normalization

partially fixes #75992

reduces the following test from 14 to 3 seconds locally.

cc `@Mark-Simulacrum` would it make sense to add that test to `perf`?
```rust
#![recursion_limit="2048"]
#![type_length_limit="112457564"]

pub async fn h0(v: &String, x: &u64) { println!("{} {}", v, x) }
pub async fn h1(v: &String, x: &u64) { h0(v, x).await }
pub async fn h2(v: &String, x: &u64) { h1(v, x).await }
pub async fn h3(v: &String, x: &u64) { h2(v, x).await }
pub async fn h4(v: &String, x: &u64) { h3(v, x).await }
pub async fn h5(v: &String, x: &u64) { h4(v, x).await }
pub async fn h6(v: &String, x: &u64) { h5(v, x).await }
pub async fn h7(v: &String, x: &u64) { h6(v, x).await }
pub async fn h8(v: &String, x: &u64) { h7(v, x).await }
pub async fn h9(v: &String, x: &u64) { h8(v, x).await }

pub async fn h10(v: &String, x: &u64) { h9(v, x).await }
pub async fn h11(v: &String, x: &u64) { h10(v, x).await }
pub async fn h12(v: &String, x: &u64) { h11(v, x).await }
pub async fn h13(v: &String, x: &u64) { h12(v, x).await }
pub async fn h14(v: &String, x: &u64) { h13(v, x).await }
pub async fn h15(v: &String, x: &u64) { h14(v, x).await }
pub async fn h16(v: &String, x: &u64) { h15(v, x).await }
pub async fn h17(v: &String, x: &u64) { h16(v, x).await }
pub async fn h18(v: &String, x: &u64) { h17(v, x).await }
pub async fn h19(v: &String, x: &u64) { h18(v, x).await }

macro_rules! async_recursive {
    (29, $inner:expr) => { async { async_recursive!(28, $inner) }.await };
    (28, $inner:expr) => { async { async_recursive!(27, $inner) }.await };
    (27, $inner:expr) => { async { async_recursive!(26, $inner) }.await };
    (26, $inner:expr) => { async { async_recursive!(25, $inner) }.await };
    (25, $inner:expr) => { async { async_recursive!(24, $inner) }.await };
    (24, $inner:expr) => { async { async_recursive!(23, $inner) }.await };
    (23, $inner:expr) => { async { async_recursive!(22, $inner) }.await };
    (22, $inner:expr) => { async { async_recursive!(21, $inner) }.await };
    (21, $inner:expr) => { async { async_recursive!(20, $inner) }.await };
    (20, $inner:expr) => { async { async_recursive!(19, $inner) }.await };

    (19, $inner:expr) => { async { async_recursive!(18, $inner) }.await };
    (18, $inner:expr) => { async { async_recursive!(17, $inner) }.await };
    (17, $inner:expr) => { async { async_recursive!(16, $inner) }.await };
    (16, $inner:expr) => { async { async_recursive!(15, $inner) }.await };
    (15, $inner:expr) => { async { async_recursive!(14, $inner) }.await };
    (14, $inner:expr) => { async { async_recursive!(13, $inner) }.await };
    (13, $inner:expr) => { async { async_recursive!(12, $inner) }.await };
    (12, $inner:expr) => { async { async_recursive!(11, $inner) }.await };
    (11, $inner:expr) => { async { async_recursive!(10, $inner) }.await };
    (10, $inner:expr) => { async { async_recursive!(9, $inner) }.await };

    (9, $inner:expr) => { async { async_recursive!(8, $inner) }.await };
    (8, $inner:expr) => { async { async_recursive!(7, $inner) }.await };
    (7, $inner:expr) => { async { async_recursive!(6, $inner) }.await };
    (6, $inner:expr) => { async { async_recursive!(5, $inner) }.await };
    (5, $inner:expr) => { async { async_recursive!(4, $inner) }.await };
    (4, $inner:expr) => { async { async_recursive!(3, $inner) }.await };
    (3, $inner:expr) => { async { async_recursive!(2, $inner) }.await };
    (2, $inner:expr) => { async { async_recursive!(1, $inner) }.await };
    (1, $inner:expr) => { async { async_recursive!(0, $inner) }.await };
    (0, $inner:expr) => { async { h19(&String::from("owo"), &0).await; $inner }.await };
}

async fn f() {
    async_recursive!(14, println!("hello"));
}

fn main() {
    let _ = f();
}
```
r? `@eddyb` requires a perf run.
2020-09-22 22:52:07 +00:00
bors b01326ab03 Auto merge of #76680 - Julian-Wollersberger:nongeneric_ensure_sufficient_stack, r=jyn514
Make `ensure_sufficient_stack()` non-generic, using cargo-llvm-lines

Inspired by [this blog post](https://blog.mozilla.org/nnethercote/2020/08/05/how-to-speed-up-the-rust-compiler-some-more-in-2020/) from `@nnethercote,` I used [cargo-llvm-lines](https://github.com/dtolnay/cargo-llvm-lines/) on the rust compiler itself, to improve it's compile time. This PR contains only one low-hanging fruit, but I also want to share some measurements.

The function `ensure_sufficient_stack()` was monomorphized 1500 times, and with it the `stacker` and `psm` crates, for a total of 1.5% of all llvm IR lines. With some trickery I convert the generic closure into a dynamic one, and thus all that code is only monomorphized once.

# Measurements
Getting these numbers took some fiddling with CLI flags and I [modified](https://github.com/Julian-Wollersberger/cargo-llvm-lines/blob/master/src/main.rs#L115) cargo-llvm-lines to read from a folder instead of invoking cargo. Commands I used:
```
./x.py clean
RUSTFLAGS="--emit=llvm-ir -C link-args=-fuse-ld=lld -Z self-profile=profile" CARGOFLAGS_BOOTSTRAP="-Ztimings" RUSTC_BOOTSTRAP=1 ./x.py build -i --stage 1 library/std

# Then manually copy all .ll files into a folder I hardcoded in cargo-llvm-lines in main.rs#L115
cd ../cargo-llvm-lines
cargo run llvm-lines
```

The result is this list (see [first 500 lines](https://github.com/Julian-Wollersberger/cargo-llvm-lines/blob/master/llvm-lines-rustc-before.txt) ), before the change:
```
  Lines            Copies        Function name
  -----            ------        -------------
  16894211 (100%)  58417 (100%)  (TOTAL)
   2223855 (13.2%)   502 (0.9%)  rustc_query_system::query::plumbing::get_query_impl::{{closure}}
   1331918 (7.9%)   1287 (2.2%)  hashbrown::raw::RawTable<T>::reserve_rehash
    774434 (4.6%)  12043 (20.6%) core::ptr::drop_in_place
    294170 (1.7%)    499 (0.9%)  rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
    245410 (1.5%)   1552 (2.7%)  psm::on_stack::with_on_stack
    210311 (1.2%)      1 (0.0%)  rustc_target::spec::load_specific
    200962 (1.2%)    513 (0.9%)  rustc_query_system::query::plumbing::get_query_impl
    190704 (1.1%)      1 (0.0%)  rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::alloc_self_profile_query_strings
    180272 (1.1%)    468 (0.8%)  rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
    177396 (1.1%)    114 (0.2%)  rustc_query_system::query::plumbing::force_query_impl
    161134 (1.0%)    445 (0.8%)  rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
    141551 (0.8%)    186 (0.3%)  rustc_query_system::query::plumbing::incremental_verify_ich
    110191 (0.7%)      7 (0.0%)  rustc_middle::ty::context::_DERIVE_rustc_serialize_Decodable_D_FOR_TypeckResults::<impl rustc_serialize::serialize::Decodable<__D> for rustc_middle::ty::context::TypeckResults>::decode::{{closure}}
    108590 (0.6%)    420 (0.7%)  core::ops::function::FnOnce::call_once
     88488 (0.5%)     21 (0.0%)  rustc_query_system::dep_graph::graph::DepGraph<K>::try_mark_previous_green
     86368 (0.5%)      1 (0.0%)  rustc_middle::ty::query::stats::query_stats
     85654 (0.5%)   3973 (6.8%)  <&T as core::fmt::Debug>::fmt
     84475 (0.5%)      1 (0.0%)  rustc_middle::ty::query::Queries::try_collect_active_jobs
     81220 (0.5%)    862 (1.5%)  <hashbrown::raw::RawIterHash<T> as core::iter::traits::iterator::Iterator>::next
     77636 (0.5%)     54 (0.1%)  core::slice::sort::recurse
     66484 (0.4%)    461 (0.8%)  <hashbrown::raw::RawIter<T> as core::iter::traits::iterator::Iterator>::next
```

All `.ll` files together had 4.4GB. After my change they had 4.2GB. So a few percent less code LLVM has to process. Hurray!
Sadly, I couldn't measure an actual wall-time improvement. Watching YouTube while compiling added to much noise...

Here is the top of the list after the change:
```
  16460866 (100%)  58341 (100%)  (TOTAL)
   1903085 (11.6%)   504 (0.9%)  rustc_query_system::query::plumbing::get_query_impl::{{closure}}
   1331918 (8.1%)   1287 (2.2%)  hashbrown::raw::RawTable<T>::reserve_rehash
    777796 (4.7%)  12031 (20.6%) core::ptr::drop_in_place
    551462 (3.4%)   1519 (2.6%)  rustc_data_structures::stack::ensure_sufficient_stack::{{closure}}
```
Note that the total was reduced by 430 000 lines and `psm::on_stack::with_on_stack` has disappeared. Instead `rustc_data_structures::stack::ensure_sufficient_stack::{{closure}}` appeared. I'm confused about that one, but it seems to consist of inlined calls to `rustc_query_system::*` stuff.

Further note the other two big culprits in this list: `rustc_query_system` and `hashbrown`. These two are monomorphized many times, the query system summing to more than 20% of all lines, not even counting code that's probably inlined elsewhere.
Assuming compile times scale linearly with llvm-lines, that means a possible 20% compile time reduction.

Reducing eg. `get_query_impl` would probably need a major refactoring of the qery system though. _Everything_ in there is generic over multiple types, has associated types and passes generic Self arguments by value. Which means you can't simply make things `dyn`.

---------------------------------------
This PR is a small step to make rustc compile faster and thus make contributing to rustc less painful. Nonetheless I love Rust and I find the work around rustc fascinating :)
2020-09-21 17:32:57 +00:00
Ralf Jung 8fa75a2b3a
Rollup merge of #76628 - jyn514:default-config-files, r=Mark-Simulacrum
Add sample defaults for config.toml

- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`.
- Add default config files, with a README noting they're experimental and asking you to open an issue if you run into trouble. The config files have comments explaining why the defaults are set.
- Combine config files using the `merge` dependency.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.

Closes #76619
2020-09-21 10:40:28 +02:00
Joshua Nelson c9c8fb88cf Add sample defaults for config.toml
- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`
- Add default config files
- Combine config files using the merge dependency.
- Add comments to default config files
- Add a README asking to open an issue if the defaults are bad
- Give a loud error if trying to merge `.target`, since it's not
  currently supported
- Use an exhaustive match
- Use `<none>` in config.toml.example to avoid confusion
- Fix bugs in `Merge` derives

Previously, it would completely ignore the profile defaults if there
were any settings in `config.toml`. I sent an email to the `merge` maintainer
asking them to make the behavior in this commit the default.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.
2020-09-20 16:18:58 -04:00
Julian Wollersberger 53aaa1e532 To avoid monomorphizing `psm::on_stack::with_on_stack` 1500 times, I made a change in `stacker` to wrap the callback in `dyn`. 2020-09-20 19:07:52 +02:00
Ralf Jung 0e90875968 update Miri 2020-09-20 17:05:12 +02:00
Bastian Kauschke 1146c39da7 cache types during normalization 2020-09-19 17:27:13 +02:00
bors b3aae050cd Auto merge of #76880 - shepmaster:cc-rs, r=Mark-Simulacrum
Update cc crate to 1.0.60 to understand aarch64-apple-darwin with clang

r? `@Mark-Simulacrum`

/cc `@alexcrichton`
2020-09-19 13:31:23 +00:00
bors 4e8a8b49ae Auto merge of #76879 - shepmaster:zlib-sys, r=Mark-Simulacrum
Upgrade libz-sys to 1.1.2

The current version has warnings that become errors on new versions of clang shipped in XCode:

```
warning: src/zlib/gzlib.c:214:15: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
warning:         (void)snprintf(state->path, len + 1, "%s", (const char *)path);
warning:               ^
warning: src/zlib/gzlib.c:214:15: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
warning: 1 error generated.

warning: src/zlib/gzwrite.c:428:11: error: implicitly declaring library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, __builtin_va_list)' [-Werror,-Wimplicit-function-declaration
warning:     len = vsnprintf(next, state->size, format, va);
warning:           ^
warning: src/zlib/gzwrite.c:428:11: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf'
warning: 1 error generated.
```

r? `@Mark-Simulacrum`

/cc `@joshtriplett`
2020-09-19 06:28:37 +00:00
Pietro Albini 3bddfea7e2
build-manifest: stop receiving release numbers from bootstrap 2020-09-18 17:42:58 +02:00
bors fdc3405c20 Auto merge of #72412 - VFLashM:issue-72408-nested-closures-exponential, r=tmandry
Issue 72408 nested closures exponential

This fixes #72408.

Nested closures were resulting in exponential compilation time.

This PR is enhancing asymptotic complexity, but also increasing the constant, so I would love to see perf run results.
2020-09-18 14:08:39 +00:00
Jake Goulding 9803c9b252 Update cc crate to understand aarch64-apple-darwin with clang 2020-09-18 09:22:07 -04:00
Jake Goulding 15bd2365fc Upgrade libz-sys to 1.1.2 2020-09-18 09:18:10 -04:00
Valerii Lashmanov f583513dc2 Intorduced MiniMap - a tiny small storage optimized map implementation
This makes everything about 1% faster in rustc-perf,
mostly negating performance hit of previous commit.
2020-09-17 20:44:11 -05:00
Valerii Lashmanov 2f3296192b Only visit types once when walking the type tree
This fixes #72408.

Nested closures were resulting in exponential compilation time.

As a performance optimization this change introduces MiniSet,
which is a simple small storage optimized set.
2020-09-17 20:44:11 -05:00
Dylan DPC 1fd22fc34e
Rollup merge of #76689 - jyn514:update-pulldown, r=GuillaumeGomez
Upgrade to pulldown-cmark 0.8.0

Thanks to marcusklaas' hard work in https://github.com/raphlinus/pulldown-cmark/pull/469, this fixes a lot of rustdoc bugs!

- Get rid of unnecessary `RefCell`
- Fix duplicate warnings for broken implicit reference link
- Remove unnecessary copy of links

Closes https://github.com/rust-lang/rust/issues/73264, closes https://github.com/rust-lang/rust/issues/76687.
r? @euclio

I'm not sure if the switch away from `locate` fixes any open bugs - euclio mentioned some in https://github.com/raphlinus/pulldown-cmark/issues/165, but I didn't see any related issues open for rustdoc. Let me know if I missed one.
2020-09-16 01:30:44 +02:00
bors b5f55b7e15 Auto merge of #76549 - ehuss:lints-comments, r=wesleywiser
Auto-generate lint documentation.

This adds a tool which will generate the lint documentation in the rustc book automatically. This is motivated by keeping the documentation up-to-date, and consistently formatted. It also ensures the examples are correct and that they actually generate the expected lint. The lint groups table is also auto-generated. See https://github.com/rust-lang/compiler-team/issues/349 for the original proposal.

An outline of how this works:
- The `declare_lint!` macro now accepts a doc comment where the documentation is written. This is inspired by how clippy works.
- A new tool `src/tools/lint-docs` scrapes the documentation and adds it to the rustc book during the build.
    - It runs each example and verifies its output and embeds the output in the book.
    - It does a few formatting checks.
    - It verifies that every lint is documented.
- Groups are collected from `rustc -W help`.

I updated the documentation for all the missing lints. I have also added an "Explanation" section to each lint providing a reason for the lint and suggestions on how to resolve it.

This can lead towards a future enhancement of possibly showing these docs via the `--explain` flag to make them easily accessible and discoverable.
2020-09-14 05:54:44 +00:00
Joshua Nelson e4c28bf61a Upgrade to pulldown-cmark 0.8.0
Thanks to marcusklaas' hard work in https://github.com/raphlinus/pulldown-cmark/pull/469, this fixes a lot of rustdoc bugs!

- Get rid of unnecessary `RefCell`
- Fix duplicate warnings for broken implicit reference link
- Remove unnecessary copy of links
2020-09-13 20:15:01 -04:00
Eric Huss 45c1e0ae07 Auto-generate lint documentation. 2020-09-13 08:48:03 -07:00
Jonas Schievink a447c21afa Don't query unstable data when `staged_api` is off 2020-09-13 02:10:39 +02:00
bors bd51226305 Auto merge of #76632 - andjo403:updateDep, r=Mark-Simulacrum
update the version of itertools and parking_lot

this is to avoid compiling multiple version of the crates in rustc speeding up compilation of rustc

an old version of parking_lot is still used in measureme but new version will not be released for some time see [zulip chat](https://rust-lang.zulipchat.com/#narrow/stream/187831-t-compiler.2Fwg-self-profile/topic/new.20release.20of.20measureme)
2020-09-12 14:00:39 +00:00
Andreas Jonson b8752fff19 update the version of itertools and parking_lot
this is to avoid compiling multiple version of the crates in rustc
2020-09-12 08:26:53 +02:00
Thomas de Zeeuw 7c3e1ffd7a Update libc in Cargo.lock 2020-09-10 16:27:28 +02:00
Matt Brubeck 15ccdeb224 Update to hashbrown 0.9 2020-09-08 17:23:26 -07:00
bors fa79db83f6 Auto merge of #76210 - Mark-Simulacrum:tracing-update, r=oli-obk
Tracing update

This does not bring the more significant changes that are coming down the pipeline, but since I've already prepared the PR leaving it up :)

See https://github.com/rust-lang/rust/pull/76210#issuecomment-685065938:
> Unfortunately, tracing 0.1.20 — which contained the change to reduce the amount of code generated by the tracing macros — had to be yanked, as it broke previously-compiling code for some downstream crates. I've not yet had the chance to fix this and release a new patch. So, in order to benefit from the changes to reduce generated code, you'll need to wait until there's a new version of tracing as well as tracing-attributes and tracing-core.
2020-09-08 03:22:31 +00:00
bors 71569e4201 Auto merge of #75138 - jumbatm:session-diagnostic-derive, r=oli-obk
Add derive macro for specifying diagnostics using attributes.

Introduces `#[derive(SessionDiagnostic)]`, a derive macro for specifying structs that can be converted to Diagnostics using directions given by attributes on the struct and its fields. Currently, the following attributes have been implemented:
- `#[code = "..."]` -- this sets the Diagnostic's error code, and must be provided on the struct iself (ie, not on a field). Equivalent to calling `code`.
- `#[message = "..."]` -- this sets the Diagnostic's primary error message.
- `#[label = "..."]` -- this must be applied to fields of type `Span`, and is equivalent to `span_label`
- `#[suggestion(..)]` -- this allows a suggestion message to be supplied. This attribute must be applied to a field of type `Span` or `(Span, Applicability)`, and is equivalent to calling `span_suggestion`. Valid arguments are:
    - `message = "..."` -- this sets the suggestion message.
    - (Optional) `code = "..."` -- this suggests code for the suggestion. Defaults to empty.

`suggestion`also  comes with other variants: `#[suggestion_short(..)]`, `#[suggestion_hidden(..)]` and `#[suggestion_verbose(..)]` which all take the same keys.

Within the strings passed to each attribute, fields can be referenced without needing to be passed explicitly into the format string -- eg, `#[error = "{ident} already declared"] ` will set the error message to `format!("{} already declared", &self.ident)`. Any fields on the struct can be referenced in this way.

Additionally, for any of these attributes, Option fields can be used to only optionally apply the decoration -- for example:

```rust
#[derive(SessionDiagnostic)]
#[code = "E0123"]
struct SomeKindOfError {
    ...
    #[suggestion(message = "informative error message")]
    opt_sugg: Option<(Span, Applicability)>
    ...
}
```
will not emit a suggestion if `opt_sugg` is `None`.

We plan on iterating on this macro further; this PR is a start.

Closes #61132.

r? `@oli-obk`
2020-09-08 00:58:43 +00:00
bors 0e2c1281e9 Auto merge of #76044 - ecstatic-morse:dataflow-lattice, r=oli-obk
Support dataflow problems on arbitrary lattices

This PR implements last of the proposed extensions I mentioned in the design meeting for the original dataflow refactor. It extends the current dataflow framework to work with arbitrary lattices, not just `BitSet`s. This is a prerequisite for dataflow-enabled MIR const-propagation. Personally, I am skeptical of the usefulness of doing const-propagation pre-monomorphization, since many useful constants only become known after monomorphization (e.g. `size_of::<T>()`) and users have a natural tendency to hand-optimize the rest. It's probably worth exprimenting with, however, and others have shown interest cc `@rust-lang/wg-mir-opt.`

The `Idx` associated type is moved from `AnalysisDomain` to `GenKillAnalysis` and replaced with an associated `Domain` type that must implement `JoinSemiLattice`. Like before, each `Analysis` defines the "bottom value" for its domain, but can no longer override the dataflow join operator. Analyses that want to use set intersection must now use the `lattice::Dual` newtype. `GenKillAnalysis` impls have an additional requirement that `Self::Domain: BorrowMut<BitSet<Self::Idx>>`, which effectively means that they must use `BitSet<Self::Idx>` or `lattice::Dual<BitSet<Self::Idx>>` as their domain.

Most of these changes were mechanical. However, because a `Domain` is no longer always a powerset of some index type, we can no longer use an `IndexVec<BasicBlock, GenKillSet<A::Idx>>>` to store cached block transfer functions. Instead, we use a boxed `dyn Fn` trait object. I discuss a few alternatives to the current approach in a commit message.

The majority of new lines of code are to preserve existing Graphviz diagrams for those unlucky enough to have to debug dataflow analyses. I find these diagrams incredibly useful when things are going wrong and considered regressing them unacceptable, especially the pretty-printing of `MovePathIndex`s, which are used in many dataflow analyses. This required a parallel `fmt` trait used only for printing dataflow domains, as well as a refactoring of the `graphviz` module now that we cannot expect the domain to be a `BitSet`. Some features did have to be removed, such as the gen/kill display mode (which I didn't use but existed to mirror the output of the old dataflow framework) and line wrapping. Since I had to rewrite much of it anyway, I took the opportunity to switch to a `Visitor` for printing dataflow state diffs instead of using cursors, which are error prone for code that must be generic over both forward and backward analyses. As a side-effect of this change, we no longer have quadratic behavior when writing graphviz diagrams for backward dataflow analyses.

r? `@pnkfelix`
2020-09-07 21:29:43 +00:00
Caleb Cartwright 1ceb82488f Update RLS and Rustfmt 2020-09-05 15:40:07 -05:00
Jubilee Young b97d4131fe Refactor byteorder to std in rustc_middle
Use std::io::{Read, Write} and {to, from}_{le, be}_bytes methods in
order to remove byteorder from librustc_middle's dependency graph.
2020-09-04 21:51:17 -07:00
Jack Huey d66452c3e5 Upgrade chalk to 0.21 2020-09-04 19:12:54 -04:00
marmeladema 99c96c5bfe driver: replace `lazy_static` by `SyncLazy` from std 2020-09-01 22:06:47 +01:00
marmeladema 73a7204983 feature: replace `lazy_static` by `SyncLazy` from std 2020-09-01 22:06:47 +01:00
marmeladema 67b8f9491c hir: replace `lazy_static` by `SyncLazy` from std 2020-09-01 22:06:47 +01:00
marmeladema 1b650d0fea datastructures: replace `lazy_static` by `SyncLazy` from std 2020-09-01 22:06:47 +01:00
marmeladema bd49eec3d7 interface: use `OnceCell` from standard library 2020-09-01 22:06:39 +01:00
Mark Rousskov 77d4f94201 Bump tracing 2020-09-01 14:39:46 -04:00
jumbatm 93eaf15646 Add SessionDiagnostic derive macro.
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-09-01 22:02:45 +10:00
Tyler Mandry 8d328d785f
Rollup merge of #76178 - matklad:et, r=Mark-Simulacrum
Update expect-test to 1.0

The only change is that `expect_file` now uses path relative to the
current file (same as `include!`). Before, it used paths relative to
the workspace root, which makes no sense.
2020-08-31 19:18:31 -07:00
Eric Huss 103c497668 Update cargo 2020-08-31 14:08:53 -07:00
Aleksey Kladov 5716c3e18d Update expect-test to 1.0
The only change is that `expect_file` now uses path relative to the
current file (same as `include!`). Before, it used paths relative to
the workspace root, which makes no sense.
2020-08-31 21:04:09 +02:00
marmeladema 68500ffacb datastructures: replace `once_cell` crate with an impl from std 2020-08-30 20:06:14 +01:00
Dylan MacKenzie a88dc37c54 Add `regex` dependency to `librustc_mir` 2020-08-30 11:15:21 -07:00
bors 62850d882b Auto merge of #76090 - Dylan-DPC:rollup-eksndcr, r=Dylan-DPC
Rollup of 14 pull requests

Successful merges:

 - #75832 (Move to intra-doc links for wasi/ext/fs.rs, os_str_bytes.rs…)
 - #75852 (Switch to intra-doc links in `core::hash`)
 - #75874 (Shorten liballoc doc intra link while readable)
 - #75881 (Expand rustdoc theme chooser x padding)
 - #75885 (Fix another clashing_extern_declarations false positive.)
 - #75892 (Fix typo in TLS Model in Unstable Book)
 - #75910 (Add test for issue #27130)
 - #75917 (Move to intra doc links for core::ptr::non_null)
 - #75975 (Allow --bess ing expect-tests in tools)
 - #75990 (Add __fastfail for Windows on arm/aarch64)
 - #76015 (Fix loading pretty-printers in rust-lldb script)
 - #76022 (Clean up rustdoc front-end source code)
 - #76029 (Move to intra-doc links for library/core/src/sync/atomic.rs)
 - #76057 (Move retokenize hack to save_analysis)

Failed merges:

r? @ghost
2020-08-30 00:47:37 +00:00
Dylan DPC 9d7d24d516
Rollup merge of #76057 - matklad:remove-retokenize, r=petrochenkov
Move retokenize hack to save_analysis

closes #76046
2020-08-30 01:44:01 +02:00
bors ced37a53d9 Auto merge of #75775 - matklad:rustc-lexer-rustdoc-highlight, r=GuillaumeGomez
Use rustc_lexer for rustdoc syntax highlighting

r? @ghost
2020-08-29 22:42:08 +00:00
Ralf Jung d150cd2c30 bump Miri 2020-08-29 21:19:31 +02:00
bors 7fc048f071 Auto merge of #75754 - joshtriplett:wip-perf-snappy, r=Mark-Simulacrum
Switch to Snappy compression for metadata
2020-08-29 16:59:39 +00:00
bors fe8ab8a530 Auto merge of #76034 - flip1995:clippyup, r=Manishearth
Update Clippy

Bi-weekly Clippy update, as per the [new policy](https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md#syncing-back-changes-in-clippy-to-rust-langrust).

r? @Manishearth
2020-08-29 14:36:46 +00:00
Aleksey Kladov 6621895365 Move retokenize hack to save_analysis 2020-08-29 12:29:06 +02:00
bors 360a372f2c Auto merge of #75877 - vigoux:master, r=Amanieu
Update compiler-builtins

Update the compiler-builtins dependency to include latest changes.

This allows for `aarch64-unknown-linux-musl` to pass all tests.

Fixes #57820 and fixes #46651
2020-08-29 01:48:40 +00:00
flip1995 575e27d3ce
Update Cargo.lock 2020-08-28 18:43:41 +02:00
Thomas Vigouroux 392478c29e Update compiler-builtins
Fixes #57820 and #46651
2020-08-28 09:02:39 +02:00
Aleksey Kladov b4f4db946e Add expect test for rustdoc html highlighting
It's a unit-test in a sense that it only checks syntax highlighting.
However, the resulting HTML is written to disk and can be easily
inspected in the browser.

To update the test, run with `--bless` argument or set
`UPDATE_EXPEC=1` env var
2020-08-27 18:48:06 +02:00
bors c35007dbbe Auto merge of #75773 - matklad:snapshot-tests, r=Mark-Simulacrum
Introduce expect snapshot testing library into rustc

Snapshot testing is a technique for writing maintainable unit tests.
Unlike usual `assert_eq!` tests, snapshot tests allow
to *automatically* upgrade expected values on test failure.
In a sense, snapshot tests are inline-version of our beloved
UI-tests.

Example:

![expect](https://user-images.githubusercontent.com/1711539/90888810-3bcc8180-e3b7-11ea-9626-d06e89e1a0bb.gif)

A particular library we use, `expect_test` provides an `expect!`
macro, which creates a sort of self-updating string literal (by using
`file!` macro). Self-update is triggered by setting `UPDATE_EXPECT`
environmental variable (this info is printed during the test failure).
This library was extracted from rust-analyzer, where we use it for
most of our tests.

There are some other, more popular snapshot testing libraries:

* https://github.com/mitsuhiko/insta
* https://github.com/aaronabramov/k9

The main differences of `expect` are:

* first-class snapshot objects (so, tests can be written as functions,
  rather than as macros)
* focus on inline-snapshots (but file snapshots are also supported)
* restricted feature set (only `assert_eq` and `assert_debug_eq`)
* no extra runtime (ie, no `cargo insta`)

See rust-analyzer/rust-analyzer#5101 for a
an extended comparison.

It is unclear if this testing style will stick with rustc in the long
run. At the moment, rustc is mainly tested via integrated UI tests.
But in the library-ified world, unit-tests will become somewhat more
important (that's why use use `rustc_lexer` library-ified library as
an example in this PR). Given that the cost of removal shouldn't be
too high, it probably makes sense to just see if this flies!
2020-08-25 09:36:23 +00:00
Aleksey Kladov f7be59c593 Introduce expect snapshot testing library into rustc
Snapshot testing is a technique for writing maintainable unit tests.
Unlike usual `assert_eq!` tests, snapshot tests allow
to *automatically* upgrade expected values on test failure.
In a sense, snapshot tests are inline-version of our beloved
UI-tests.

Example:

![expect](https://user-images.githubusercontent.com/1711539/90888810-3bcc8180-e3b7-11ea-9626-d06e89e1a0bb.gif)

A particular library we use, `expect_test` provides an `expect!`
macro, which creates a sort of self-updating string literal (by using
`file!` macro). Self-update is triggered by setting `UPDATE_EXPECT`
environmental variable (this info is printed during the test failure).
This library was extracted from rust-analyzer, where we use it for
most of our tests.

There are some other, more popular snapshot testing libraries:

* https://github.com/mitsuhiko/insta
* https://github.com/aaronabramov/k9

The main differences of `expect` are:

* first-class snapshot objects (so, tests can be written as functions,
  rather than as macros)
* focus on inline-snapshots (but file snapshots are also supported)
* restricted feature set (only `assert_eq` and `assert_debug_eq`)
* no extra runtime (ie, no `cargo insta`)

See https://github.com/rust-analyzer/rust-analyzer/pull/5101 for a
an extended comparison.

It is unclear if this testing style will stick with rustc in the long
run. At the moment, rustc is mainly tested via integrated UI tests.
But in the library-ified world, unit-tests will become somewhat more
important (that's why use use `rustc_lexer` library-ified library as
an example in this PR). Given that the cost of removal shouldn't be
too high, it probably makes sense to just see if this flies!
2020-08-24 15:38:42 +02:00