Tyler Mandry [Tue, 15 Oct 2019 23:07:47 +0000 (16:07 -0700)]
Rollup merge of #65293 - tmandry:turbo-expander, r=matthewjasper
Optimize `try_expand_impl_trait_type`
A lot of time was being spent expanding some large `impl Future` types in fuchsia. This PR takes the number of types being visited in one expansion from >3 billion to about a thousand, and eliminates the compile time regression in https://github.com/rust-lang/rust/issues/65147 (in fact, compile times are better than they were before).
Thanks to @Mark-Simulacrum for helping identify the issue and to @matthewjasper for suggesting this change.
Tyler Mandry [Tue, 15 Oct 2019 23:07:41 +0000 (16:07 -0700)]
Rollup merge of #64623 - matthewjasper:underscore-imports, r=petrochenkov
Remove last uses of gensyms
Underscore bindings now use unique `SyntaxContext`s to avoid collisions. This was the last use of gensyms in the compiler, so this PR also removes them.
Rollup merge of #65428 - phansch:rename_db_var, r=Centril
Refactor: Rename `db` locals to `diag`
https://github.com/rust-lang/rust/pull/64272 replaced `DiagnosticBuilder` with `Diagnostic` in some places. This PR just renames the db variable from `db` to `diag` where it wasn't renamed.
Philipp Hansch [Tue, 15 Oct 2019 06:12:55 +0000 (08:12 +0200)]
Refactor: Rename `db` locals to `diag`
https://github.com/rust-lang/rust/pull/64272 replaced
`DiagnosticBuilder` with `Diagnostic` in some places. This commit just
renames the DB variable from `db` to `diag` where it wasn't renamed.
1. We know that `p2` is a binding so we can invert as `p2 @ p1`:
```rust
error: pattern on wrong side of `@`
--> $DIR/intersection-patterns.rs:13:9
|
LL | Some(x) @ y => {}
| -------^^^-
| | |
| | binding on the right, should be to the left
| pattern on the left, should be to the right
| help: switch the order: `y @ Some(x)`
```
2. Otherwise we emit a generic diagnostic for the lack of support for intersection patterns:
```rust
error: left-hand side of `@` must be a binding
--> $DIR/intersection-patterns.rs:23:9
|
LL | Some(x) @ Some(y) => {}
| -------^^^-------
| | |
| | also a pattern
| interpreted as a pattern, not a binding
|
= note: bindings are `x`, `mut x`, `ref x`, and `ref mut x`
```
For more on and-patterns, see e.g. https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/pattern-matching#and-pattern.
Tyler Mandry [Tue, 15 Oct 2019 00:52:38 +0000 (17:52 -0700)]
Rollup merge of #65340 - bjorn3:cg_ssa_refactor4, r=eddyb
Several changes to the codegen backend organization
* Split functions from values in cg_ssa `BackendTypes`.
* Remove `is_const_integral` function from `ConstMethods`.
* Actually register the invalid monomorphization of intrinsic long diagnostic and remove the `diagnostics` method from `CodegenBackends`, as it was unused.
* Add cg_ssa and cg_utils provided methods to `default_provide`, so codegen backend don't have to do it themself.
Tyler Mandry [Tue, 15 Oct 2019 00:52:37 +0000 (17:52 -0700)]
Rollup merge of #65332 - RalfJung:fmt, r=cramertj
std::fmt: reorder docs
This moves the "Formatting Parameters" section up above right after the discussion of named and positional arguments. Then comes the "Syntax" section, summarizing the discussion of format string syntax.
And only *then* we get to "Formatting Traits" -- that section has some *huge* code examples, so it really should not interrupt the discussion of the grammar. Also users are much more likely to come here to learn about the format string grammar than to come here to learn about the `Binary` trait.
bors [Mon, 14 Oct 2019 10:00:51 +0000 (10:00 +0000)]
Auto merge of #65399 - Centril:rollup-6lzj0w5, r=Centril
Rollup of 7 pull requests
Successful merges:
- #65215 (Add long error explanation for E0697)
- #65292 (Print lifetimes with backticks)
- #65362 (syntax: consolidate function parsing in item.rs)
- #65363 (Remove implicit dependencies on syntax::pprust)
- #65379 (refactor session::config::build_session_options_and_crate_config)
- #65392 (Move `Nonterminal::to_tokenstream` to parser & don't rely directly on parser in lowering)
- #65395 (Add some tests for fixed ICEs)
I'm not exactly sure what happened in https://github.com/rust-lang/rust/pull/65361#issuecomment-541420179 so in an effort to bisect the error I'm extracting out the first commit so it can hopefully land (I suspect the error is in the 2nd-3rd commits.)
Rollup merge of #65363 - Centril:less-pprust, r=Mark-Simulacrum
Remove implicit dependencies on syntax::pprust
Part of https://github.com/rust-lang/rust/pull/65324.
The main goal here is to facilitate the eventual move of pprust out from libsyntax and because an AST definition typically should not depend on its pretty printer.
bors [Mon, 14 Oct 2019 01:45:26 +0000 (01:45 +0000)]
Auto merge of #65240 - michaelwoerister:sp-review-3, r=Mark-Simulacrum
self-profiling: Add events for metadata loading (plus a small dep-tracking optimization)
This PR
- adds self-profiling events related to loading things from crate metadata
- makes the compiler cache the `DepNodeIndex` of upstream crates, so that they don't have to be looked up over and over.
It means an allocation is required to create an empty `TokenStream`, but
all other operations are simpler and marginally faster due to not having
to check for `None`. Overall it simplifies the code for a negligible
performance effect.
The commit also removes `TokenStream::empty` by implementing `Default`,
which is now possible.
bors [Sun, 13 Oct 2019 17:18:56 +0000 (17:18 +0000)]
Auto merge of #65388 - Centril:rollup-rhg0dvs, r=Centril
Rollup of 10 pull requests
Successful merges:
- #65214 (Split non-CAS atomic support off into target_has_atomic_load_store)
- #65246 (vxWorks: implement get_path() and get_mode() for File fmt::Debug)
- #65312 (improve performance of signed saturating_mul)
- #65336 (Fix typo in task::Waker)
- #65346 (nounwind tests and cleanup)
- #65347 (Fix #[unwind(abort)] with Rust ABI)
- #65366 (Implement Error::source on IntoStringError + Remove superfluous cause impls)
- #65369 (Don't discard value names when using address or memory sanitizer)
- #65370 (Add `dyn` to `Any` documentation)
- #65373 (Fix typo in docs for `Rc`)
Rollup merge of #65370 - Cerberuser:patch-1, r=jonas-schievink
Add `dyn` to `Any` documentation
I noticed that in documentation to `Any` trait the old trait object syntax is used, which could be confusing for newcomers, since we generally recommend using `dyn Trait` instead of just `Trait`. This PR changes the documentation comment, so that it uses `&dyn Any`, `&mut dyn Any` and `Box<dyn Any>`, correspondingly.
Rollup merge of #65369 - tmiasko:sanitizers-keep-names, r=varkor
Don't discard value names when using address or memory sanitizer
The value names are used when reporting issues found by address
sanitizer or memory sanitizer. Avoid discarding names when those
sanitizers are enabled, unless explicitly requested to do otherwise.
Rollup merge of #65366 - faern:source-on-intostringerror, r=bluss
Implement Error::source on IntoStringError + Remove superfluous cause impls
IntoStringError only implemented `Error::cause`, which is deprecated. This implemements `Error::source` instead.
`Error::cause` will still work as before, thanks to the default implementation.
I think this was the only/last `Error` impl in the standard library to have a cause, but not a source.
Rollup merge of #65346 - RalfJung:nounwind-tests, r=nagisa
nounwind tests and cleanup
This is a follow-up to @pnkfelix' https://github.com/rust-lang/rust/pull/65020. In particular it adds some tests as @nagisa asked. It also does a cleanup that the original PR omitted to reduce backporting risks.
I hope I finally managed to write an uncontroversial PR in this area. ;) This should not change any behavior, just test it better.
Rollup merge of #65214 - Amanieu:cfg_atomic, r=alexcrichton
Split non-CAS atomic support off into target_has_atomic_load_store
This PR implements my proposed changes in https://github.com/rust-lang/rust/issues/32976#issuecomment-518542029 by removing `target_has_atomic = "cas"` and splitting `target_has_atomic` into two separate `cfg`s:
* `target_has_atomic = 8/16/32/64/128`: This indicates the largest width that the target can atomically CAS (which implies support for all atomic operations).
* ` target_has_atomic_load_store = 8/16/32/64/128`: This indicates the largest width that the target can support loading or storing atomically (but may not support CAS).