r? @alexcrichton for the Cargo.toml changes: with byteorder 1.3, the `i128` feature is a NOP, so we can remove it everywhere and then get rid of this crate in the workspace-hack.
Auto merge of #64510 - Centril:rollup-m03zsq8, r=Centril
Rollup of 10 pull requests
Successful merges:
- #63955 (Make sure interned constants are immutable)
- #64028 (Stabilize `Vec::new` and `String::new` as `const fn`s)
- #64119 (ci: ensure all tool maintainers are assignable on issues)
- #64444 (fix building libstd without backtrace feature)
- #64446 (Fix build script sanitizer check.)
- #64451 (when Miri tests are not passing, do not add Miri component)
- #64467 (Hide diagnostics emitted during --cfg parsing)
- #64497 (Don't print the "total" `-Ztime-passes` output if `--prints=...` is also given)
- #64499 (Use `Symbol` in two more functions.)
- #64504 (use println!() instead of println!(""))
Rollup merge of #64451 - RalfJung:miri-manifest, r=pietroalbini
when Miri tests are not passing, do not add Miri component
This makes build-manifest query the toolstate repo at https://github.com/rust-lang-nursery/rust-toolstate to figure out if the tests of the Miri component are passing. If they are not, we remove the component from the manifest, to avoid shipping a broken Miri.
Rollup merge of #64446 - ehuss:fix-sanitizer-build, r=alexcrichton
Fix build script sanitizer check.
#64166 changed the way the sanitizer build scripts work. However, they were changed so that they switch between new-style to old-style cargo fingerprints. This trips up on https://github.com/rust-lang/cargo/issues/6779.
It also causes rustbuild to panic. If you build stage1 std (with sanitizers off), and then enable sanitizers, it panics. (This is because the build scripts don't declare that they need to re-run.)
This PR will trip https://github.com/rust-lang/cargo/issues/6779 again, unfortunately. I've been having way too many unexplained rebuilds in rust-lang/rust recently, but at least I'll know why this time.
This doesn't fix all problems with the build scripts, but arguably they should be fixed in cargo. For example, the build scripts change which rerun-if statements they declare between runs which triggers https://github.com/rust-lang/cargo/issues/7362.
The test for this is:
1. Turn off sanitizers (which is the default)
2. `./x.py build --stage=1 src/libstd`
3. `./x.py build --stage=1 src/libstd` again should be a null build.
4. Enable sanitizers.
5. `./x.py build --stage=1 src/libstd` should rebuild with sanitizers enabled.
6. `./x.py build --stage=1 src/libstd` again should be a null build. This actually rebuilds due to https://github.com/rust-lang/cargo/issues/7362 because the rerun-if directives changed between step 3 and 5. A 3rd attempt should be a null build.
Rollup merge of #64119 - pietroalbini:validate-toolstate-maintainers, r=kennytm
ci: ensure all tool maintainers are assignable on issues
GitHub only allows people explicitly listed as collaborators on the repository or who commented on the issue/PR to be assignees, failing to create the issue if non-assignable people are assigned.
This adds an extra check on CI to make sure all the people listed as tool maintainers can be assigned to toolstate issues. The check won't be executed on PR builds due to the lack of a valid token.
Rollup merge of #63955 - RalfJung:intern, r=oli-obk
Make sure interned constants are immutable
This makes sure that interning for constants (not statics) creates only immutable allocations.
Previously, the "main" allocation of `const FOO: Cell<i32> = Cell::new(0);` was marked as mutable, but I don't think we want that. It can be only copied, not written to.
Also, "leftover" allocations (behind raw pointers etc) were left mutable. I don't think we want to support that. I tried asserting that these are all already immutable (to double-check our static checks), but that failed in this one:
```rust
const NON_NULL_PTR2: NonNull<u8> = unsafe { mem::transmute(&0) };
```
Seems like maybe we want more precise mutability annotation inside Miri for locals (like `&0` here) so that this would actually become immutable to begin with?
I also factored `intern_shallow` out of the visitor so that we don't have to construct a visitor when we do not plan to visit anything. That confused me at first.
Pietro Albini [Tue, 3 Sep 2019 09:33:29 +0000 (11:33 +0200)]
ci: ensure all tool maintainers are assignable on issues
GitHub only allows people explicitly listed as collaborators on the
repository or who commented on the issue/PR to be assignees, failing to
create the issue if non-assignable people are assigned.
This adds an extra check on CI to make sure all the people listed as
tool maintainers can be assigned to toolstate issues. The check won't be
executed on PR builds due to the lack of a valid token.
Auto merge of #64383 - pcpthm:btreeset-size-hint, r=dtolnay
Improve BTreeSet::Intersection::size_hint
A comment on `IntersectionInner` mentions `small_iter` should be smaller than `other_iter` but this condition is broken while iterating because those two iterators can be consumed at a different rate. I added a test to demonstrate this situation.
<del>I made `small_iter.len() < other_iter.len()` always true by swapping two iterators when that condition became false. This change affects the return value of `size_hint`. The previous result was also correct but this new version always returns smaller upper bound than the previous version.</del>
I changed `size_hint` to taking minimum of both lengths of iterators and renamed fields to `a` and `b` to match `Union` iterator.
Improve BTreeSet::Intersection::size_hint
The commented invariant that an iterator is smaller than other iterator
was violated after next is called and two iterators are consumed at
different rates.
Auto merge of #64491 - Centril:rollup-21wkl69, r=Centril
Rollup of 3 pull requests
Successful merges:
- #63872 (Document platform-specific behavior of the iterator returned by std::fs::read_dir)
- #64250 (save-analysis: Nest typeck tables when processing functions/methods)
- #64472 (Don't mark expression with attributes as not needing parentheses)
Rollup merge of #64472 - Mark-Simulacrum:unused-parens-attr, r=varkor
Don't mark expression with attributes as not needing parentheses
This is not perfectly correct as `#[attr] (5)` will still not lint, but it does seem good enough, in particular as the parentheses in that case are not unambiguously incorrect; I might personally prefer to see them for clarity.
impl A {
fn _inner1<U: Trait>(self, _: U::Assoc) {}
fn _inner2<U: Trait>(self) -> U::Assoc { unimplemented!() }
}
}
```
using `debug_assertions`-enabled rustc and by additionally passing `-Zsave-analysis`.
Unfortunately the original assertion fired is a *debug* one and from what I can tell we don't run the tests with these on, so I'm not adding a test here. If I missed it and there is a way to run tests with these on, I'd love to add a test case for this.
Auto merge of #64469 - matthewjasper:increase-hygiene-use, r=petrochenkov
Cleanup handling of hygiene for built-in macros
This makes most identifiers generated by built-in macros use def-site hygiene, not only the ones that previously used gensyms.
* `ExtCtxt::ident_of` now takes a `Span` and is preferred to `Ident::{from_str, from_str_and_span}`
* Remove `Span::with_legacy_ctxt`
* `assert` now uses call-site hygiene because it needs to resolve `panic` unhygienically.
* `concat_idents` now uses call-site hygiene because it wouldn't be very useful with def-site hygiene.
* everything else is moved to def-site hygiene
Auto merge of #64478 - Centril:rollup-bnt51w1, r=Centril
Rollup of 5 pull requests
Successful merges:
- #64457 (def_collector: Do not ICE on attributes on unnamed fields)
- #64463 (resolve: Tweak some expected/found wording)
- #64471 (Warn on no_start, crate_id attribute use)
- #64473 (Use try_fold instead of manually carrying an accumulator)
- #64475 (simplify the initialization)
Rollup merge of #64471 - Mark-Simulacrum:warn-depr-attr, r=Centril
Warn on no_start, crate_id attribute use
These attributes are now deprecated; they don't have any use anymore.
`no_start` stopped being applicable in 3ee916e50bd86768cb2a9141f9b2c52d2601b412 as part of #18967. Ideally we would've removed it pre-1.0, but since that didn't happen let's at least mark it deprecated.
`crate_id` was renamed to `crate_name` in 50ee1ec1b4f107122d8037ac7b0b312afa6eb0ac as part of #15319. Ideally we would've followed that up with a removal of crate_id itself as well, but that didn't happen; this PR finally marks it as deprecated at least.
Fixes https://github.com/rust-lang/rust/issues/43142 and resolves https://github.com/rust-lang/rust/issues/43144.
Rollup merge of #64457 - petrochenkov:macunfield, r=matthewjasper
def_collector: Do not ICE on attributes on unnamed fields
The primary issue here is that the expansion infra needs to visit a field in isolation, and fields don't know their own indices during expansion, so they have to be kept in some other place (e.g. `struct Definitions`).
Auto merge of #60584 - jonas-schievink:ice-panic-hook, r=oli-obk
Use `panic::set_hook` to print the ICE message
This allows custom frontends and backends to override the hook with their own, for example to point people to a different issue tracker.
ICE messages are printed in a slightly different order now. Nightly prints:
```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.36.0-nightly (08bfe1612 2019-05-02) running on x86_64-unknown-linux-gnu
```
After this PR, rustc prints:
```
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.36.0-dev running on x86_64-unknown-linux-gnu
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
```
Mark Rousskov [Sat, 14 Sep 2019 22:41:46 +0000 (18:41 -0400)]
Don't mark expression with attributes as not needing parentheses
This is not perfectly correct as `#[attr] (5)` will still not lint, but
it does seem good enough, in particular as the parentheses in that case
are not unambiguously incorrect.
Auto merge of #64466 - Centril:rollup-s3nlb9e, r=Centril
Rollup of 4 pull requests
Successful merges:
- #61797 (Stabilise weak_ptr_eq)
- #64290 (Provide a span if main function is not present in crate)
- #64406 (Ban non-extern rust intrinsics)
- #64462 (feature_gate: Remove dead code from attribute checking)
Rollup merge of #64462 - petrochenkov:remattr, r=Centril
feature_gate: Remove dead code from attribute checking
https://github.com/rust-lang/rust/pull/63468 is merged, so all attributes go through name resolution now, so we can remove code that previously performed some checks for attributes not going through resolution.
Rollup merge of #64290 - Mark-Simulacrum:span-no-main, r=estebank
Provide a span if main function is not present in crate
Unfortunately, the diagnostic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.
Tests are already updated for this change, so a dedicated test is not added.
Mark Rousskov [Sun, 8 Sep 2019 17:06:49 +0000 (13:06 -0400)]
Provide a span if main function is not present in crate
Unfortunately, the diagnotic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.
Auto merge of #64456 - Centril:rollup-ytqdwaq, r=Centril
Rollup of 17 pull requests
Successful merges:
- #63846 (Added table containing the system calls used by Instant and SystemTime.)
- #64116 (Fix minor typo in docs.)
- #64203 (A few cosmetic improvements to code & comments in liballoc and libcore)
- #64302 (Shrink `ObligationCauseCode`)
- #64372 (use randSecure and randABytes)
- #64374 (Box `DiagnosticBuilder`.)
- #64375 (Fast path for vec.clear/truncate )
- #64378 (Fix inconsistent link formatting.)
- #64384 (Trim rustc-workspace-hack)
- #64393 ( declare EnvKey before use to fix build error)
- #64420 (Inline `mark_neighbours_as_waiting_from`.)
- #64422 (Remove raw string literal quotes from error index descriptions)
- #64423 (Add self to .mailmap)
- #64425 (typo fix)
- #64431 (fn ptr is structural match)
- #64435 (codegen: use "_N" (like for other locals) instead of "argN", for argument names.)
- #64439 (fix #64430, confusing `owned_box` error message in no_std build)
Rollup merge of #64435 - eddyb:arguments-against-arg, r=rkruppe
codegen: use "_N" (like for other locals) instead of "argN", for argument names.
Based on #64408 (second commit is new), fixing something I mentioned in #64408 (which turned to be an immediate blocker for unifying relevant codepaths).
Rollup merge of #64420 - nnethercote:inline-mark_neighbours_as_waiting_from, r=Mark-Simulacrum
Inline `mark_neighbours_as_waiting_from`.
This function is very hot, doesn't get inlined because it's recursive,
and the function calls are significant.
This commit splits it into inlined and uninlined variants, and uses the
inlined variant for the hot call site. This wins several percent on a
few benchmarks.
Rollup merge of #64375 - kornelski:vecdrop, r=rkruppe
Fast path for vec.clear/truncate
For trivial types like `u8`, `vec.truncate()`/`vec.clear()` relies on the optimizer to remove the loop. This means more work in debug builds, and more work for the optimizer.
Avoiding this busywork is exactly what `mem::needs_drop::<T>()` is for.
Rollup merge of #64374 - nnethercote:box-DiagnosticBuilder, r=zackmdavis
Box `DiagnosticBuilder`.
It's a large type -- 176 bytes on 64-bit. And it's passed around and
returned from a lot of functions, including within `PResult`.
This commit boxes it, which reduces memory traffic. In particular,
`PResult` shrinks to 16 bytes in the best case; this reduces instruction
counts by up to 2% on various workloads. The commit touches a lot of
lines but it's almost all trivial plumbing changes.
Rollup merge of #64302 - nnethercote:shrink-ObligationCauseCode, r=zackmdavis
Shrink `ObligationCauseCode`
These commits reduce the size of `ObligationCauseCode` from 56 bytes to 32 bytes on 64-bit. This reduces instruction counts on various benchmarks by up to 1%, due to less `memcpy`ing.
Rollup merge of #64116 - ZeGentzy:patch-1, r=oli-obk
Fix minor typo in docs.
This comment is prolly refering to the comment in [const_eval_raw_provider](https://github.com/rust-lang/rust/pull/64116/files#diff-e0b58bb6712edaa8595ad7237542c958R616), not itself.
Rollup merge of #63846 - DevQps:32626-document-time-system-calls, r=rkruppe
Added table containing the system calls used by Instant and SystemTime.
# Description
See #32626 for a discussion on documenting system calls used by Instant and SystemTime.
## Changes
- Added a table containing the system calls used by each platform.
EDIT: If I can format this table better (due to the large links) please let me know.
I'd also be happy to learn a quick command to generate the docs on my host machine! Currently I am using: `python x.py doc --stage 0 src/libstd` but that gives me some `unrecognized intrinsic` errors. Advice is always welcome :)