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).
Cerberuser [Sun, 13 Oct 2019 11:48:07 +0000 (18:48 +0700)]
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 #65069 - crgl:clone-from-vec-deque, r=bluss
Implement Clone::clone_from for VecDeque
See #28481. For simple data types with the target much longer than the source, this implementation can be significantly slower than the default (probably due to the use of truncate). However, it should be substantially faster when cloning from nested data structures with similar shapes or when cloning from VecDeques with similar lengths, hopefully more common use cases for clone_from.
Tomasz Miąsko [Sun, 13 Oct 2019 00:00:00 +0000 (00:00 +0000)]
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.
Linus Färnstrand [Sun, 13 Oct 2019 09:43:26 +0000 (11:43 +0200)]
Implement Error::source on IntoStringError
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.
Supercedes: https://github.com/rust-lang/rust/pull/65082
Depends on: https://github.com/rust-lang/rust/pull/65037
Tracking issue: https://github.com/rust-lang/rust/issues/47809
[RFC text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md)
steps taken:
* [x] add a `ReifyShim` that is similar to `VirtualShim` in behavior (see #54183)
* [x] add `ty::Instance::resolve_for_fn_ptr` (leave `ty::Instance::resolve_vtable` alone), migrate appropriate callers
* [x] `resolve_for_fn_ptr` returns the shim if calling a `#[track_caller]` function
bors [Sat, 12 Oct 2019 23:47:27 +0000 (23:47 +0000)]
Auto merge of #64873 - popzxc:prettify-test-time, r=wesleywiser
Enhance report-time option
## Short overview
This PR is a follow-up to a previously closed #64714 PR.
## Changes introduced by this PR
* `libtest` now retrieves the type of the test within `TestDesc` (available types are: `UnitTest`, `IntegrationTest`, `DocTest`, `Unknown`).
* `--report-time` subcommand of the `libtest` now supports colored output (disabled by default).
* Colorized output depends on the threshold values. Default values (proposed by @wesleywiser):
- For unit-tests: 50ms warn/100ms critical,
- For integration-tests: 500ms warn/1000ms critical,
- For doctests: same as for integration tests,
- For unknown tests: `TEST_WARN_TIMEOUT_S` warn/ `TEST_WARN_TIMEOUT_S * 2` critical (it will only applied single-threaded mode, because otherwise test will be interrupted after reaching `TEST_WARN_TIMEOUT_S`).
- These values can be overrided by setting environment variables (since those thresholds are somewhat constant for every project, it's more flexible to use environment variables than command line arguments).
* New optional flag `--ensure-test-time` for `libtest`. With this flag applied, exectuion time limit excesss will cause test failure.
## What have not been done
There was a comment that it would be nice to have an entry in the Cargo book about it.
However, changes introduced by this PR (and #64663 in which `report-time` flag was added) aren't related directly to `cargo`, it's more about `libtest` itself.
I'm considering that [The Unstable Book](https://doc.rust-lang.org/unstable-book/) is more appropriate place, but not sure if I'm right (and if so, how exactly it should be described).
As one possible option, this PR may be merged without denoting it in the documentation, and in the next PR adding support of this feature to the `cargo` itself, I'll add a note in the Cargo book.
## Scope of this PR
Logical scope of this PR is `libtest` only. However, to get test types, I had to modify also `libsyntax_ext` and `librustdoc` for them to provide information about test type.
## Rationale
Rationale for colored output was submitted in #64714
Providing the information about kind of test was also proposed in #64714, and as an additional benefit this information may be useful for the tools using `libtest` (e.g. `cargo`).
Adding flag to treat time limits excess seems logical to me, so projects that do care about test execution time won't have to invent a wheel.
## Backward compatibility
All the changes are completely backward compatible.
bors [Sat, 12 Oct 2019 06:25:03 +0000 (06:25 +0000)]
Auto merge of #65322 - tmandry:rollup-frr651r, r=tmandry
Rollup of 15 pull requests
Successful merges:
- #64337 (libstd: Fix typos in doc)
- #64986 (Function pointers as const generic arguments)
- #65048 (Added doc about behavior of extend on HashMap)
- #65191 (Add some regression tests)
- #65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation)
- #65205 (Add long error explanation for E0568)
- #65220 (Update LLVM for Emscripten exception handling support)
- #65263 (Deduplicate is_{freeze,copy,sized}_raw)
- #65266 (Mark Path::join as must_use)
- #65276 (Don't cc rust-lang/compiler for toolstate changes)
- #65277 (Query generator kind for error reporting)
- #65283 (stability: Do not use `buffer_lint` after lowering to HIR)
- #65289 (Fix suggested bound addition diagnostic)
- #65310 (deriving: avoid dummy Span on an artificial `type_ident` path)
- #65321 (Remove painful test that is not pulling its weight)