]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #65497 - choller:master, r=tmiasko
bors [Sun, 20 Oct 2019 10:11:10 +0000 (10:11 +0000)]
Auto merge of #65497 - choller:master, r=tmiasko

Avoid injecting sanitizer runtimes into staticlibs (#64629).

This fixes the remaining issue in `creader.rs` and also fixes the expected test failure. I have explicitly turned the `$(CC)` call into a negative check with the `!` to ensure that this command is really failing (if it is not, then either the runtime is attached to the lib or the lib has not been instrumented and both would be an error).

I've also borrowed `program.rs` and the additional `rustc` invocation from @tmiasko 's PR since he pointed out that using `-fsanitize=address` with `$(CC)` for linking could fail if the sanitizer runtimes on the system are incompatible.

With this toolchain I was able to compile Firefox locally without any linker errors. I am still seeing races with Rust in TSan but I assume that is because I did not build with `-Z build-std`.

4 years agoAuto merge of #65469 - mati865:libc, r=alexcrichton
bors [Sun, 20 Oct 2019 06:10:51 +0000 (06:10 +0000)]
Auto merge of #65469 - mati865:libc, r=alexcrichton

Update libc to 0.2.64

Passed local tests.

cc potentially interested people: @gnzlbg @tlively

4 years agoAuto merge of #65302 - msizanoen1:fix-armv7-segfault, r=alexcrichton
bors [Sun, 20 Oct 2019 02:06:42 +0000 (02:06 +0000)]
Auto merge of #65302 - msizanoen1:fix-armv7-segfault, r=alexcrichton

Upgrade GCC to 8.3.0, glibc to 1.17.0 and crosstool-ng to 1.24.0 for dist-armv7-linux

#62896 was caused by the usage of the GCC 5.2.0 toolchain, which was released back in 2015 and may have bugs affecting LLVM 9.
This PR upgrade GCC to 8.3.0 from 5.2.0, glibc from 1.16.0 to 1.17.0 and crosstool-ng to 1.24.0 only for dist-armv7-linux.
Fixes #62896

r? @alexcrichton

4 years agoAuto merge of #65094 - oxalica:linux-statx, r=alexcrichton
bors [Sat, 19 Oct 2019 22:01:30 +0000 (22:01 +0000)]
Auto merge of #65094 - oxalica:linux-statx, r=alexcrichton

Prefer statx on linux if available

This PR make `metadata`-related functions try to invoke `statx` first on Linux if available,
making `std::fs::Metadata::created` work on Linux with `statx` supported.

It follows the discussion in #61386 , and will fix #59743

The implementation of this PR is simply converting `struct statx` into `struct stat64` with
extra fields for `btime` if `statx` succeeds, since other fields are not currently used.

---

I also did a separated benchmark for `fs::metadata`, `stat64`, `statx`, and `statx` with conversion to `stat64`.
It shows that `statx` with conversion is even more faster than pure `statx`.
I think it's due to `sizeof stat64 == 114` but `sizeof statx == 256`.

Anyway, the bare implementation of `statx` with conversion is only about 0.2% slower than the original impl (`stat64`-family).
With heap-allocation counted (~8.5% of total cost), the difference between `stat` and `statx` (with or without conversion) is just nothing.

Therefore, I think it is not urgent to use bare `struct statx` as underlying representation now.
There is no need to break `std::os::linux::fs::MetadataExt::as_raw_stat` (https://github.com/rust-lang/rust/pull/61386#issuecomment-538074018)

[Separated bare benchmarks](https://gist.github.com/oxalica/c4073ecb202c599fe41b7f15f86dc79c):
```
metadata_ok             time:   [529.41 ns 529.77 ns 530.19 ns]
metadata_err            time:   [538.71 ns 539.39 ns 540.35 ns]
stat64_ok               time:   [484.32 ns 484.53 ns 484.75 ns]
stat64_err              time:   [481.77 ns 482.00 ns 482.24 ns]
statx_ok                time:   [488.07 ns 488.35 ns 488.62 ns]
statx_err               time:   [487.74 ns 488.00 ns 488.27 ns]
statx_cvt_ok            time:   [485.05 ns 485.28 ns 485.53 ns]
statx_cvt_err           time:   [485.23 ns 485.45 ns 485.67 ns]
```

r? @alexcrichton

4 years agoAuto merge of #65599 - Manishearth:clippyup, r=Manishearth
bors [Sat, 19 Oct 2019 17:46:07 +0000 (17:46 +0000)]
Auto merge of #65599 - Manishearth:clippyup, r=Manishearth

Update clippy

Fixes https://github.com/rust-lang/rust/issues/65585

4 years agoUpdate clippy
Manish Goregaokar [Sat, 19 Oct 2019 15:00:48 +0000 (08:00 -0700)]
Update clippy

4 years agoAuto merge of #65598 - Centril:rollup-vc6ht2c, r=Centril
bors [Sat, 19 Oct 2019 14:01:35 +0000 (14:01 +0000)]
Auto merge of #65598 - Centril:rollup-vc6ht2c, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #64007 (Add check for overlapping ranges to unreachable patterns lint)
 - #65192 (Use structured suggestion for restricting bounds)
 - #65226 (BTreeSet symmetric_difference & union optimized)
 - #65448 (rustc_codegen_ssa: remove some unnecessary Box special-casing.)
 - #65505 (Rc: value -> allocation)

Failed merges:

r? @ghost

4 years agoRollup merge of #65505 - RalfJung:rc, r=Centril
Mazdak Farrokhzad [Sat, 19 Oct 2019 14:00:56 +0000 (16:00 +0200)]
Rollup merge of #65505 - RalfJung:rc, r=Centril

Rc: value -> allocation

See https://github.com/rust-lang/rust/issues/64484. This does not yet edit `Arc` as I first wanted to be sure we agree on the terminology the way it actually ends up. "value" as a term appears a lot in this file, and sometimes it refers to the value stored inside the `RcBox` while sometimes it refers to the `RcBox` itself. I tried to properly tease these apart but may have made some mistakes. The former should now always be called "inner value" and the latter "allocation".

One area where I was very unsure of which terminology is dropping: the `value` field of the `RcBox` will get dropped *earlier* than the `RcBox` itself if there are weak references. I decided that "dropping the value stored in the allocation" refers to dropping the value field, while "destroying the allocation" refers to actually freeing its backing memory.

r? @Centril

4 years agoRollup merge of #65448 - eddyb:codegen-box-less-special, r=oli-obk
Mazdak Farrokhzad [Sat, 19 Oct 2019 14:00:54 +0000 (16:00 +0200)]
Rollup merge of #65448 - eddyb:codegen-box-less-special, r=oli-obk

rustc_codegen_ssa: remove some unnecessary Box special-casing.

Could help simplify #60900.

r? @nikomatsakis

4 years agoRollup merge of #65226 - ssomers:master, r=bluss
Mazdak Farrokhzad [Sat, 19 Oct 2019 14:00:53 +0000 (16:00 +0200)]
Rollup merge of #65226 - ssomers:master, r=bluss

BTreeSet symmetric_difference & union optimized

No scalability changes, but:
- Grew the cmp_opt function (shared by symmetric_difference & union) into a MergeIter, with less memory overhead than the pairs of Peekable iterators now, speeding up ~20% on my machine (not so clear on Travis though, I actually switched it off there because it wasn't consistent about identical code). Mainly meant to improve readability by sharing code, though it does end up using more lines of code. Extending and reusing the MergeIter in btree_map might be better, but I'm not sure that's possible or desirable. This MergeIter probably pretends to be more generic than it is, yet doesn't declare to be an iterator because there's no need to, it's only there to help construct genuine iterators SymmetricDifference & Union.
- Compact the code of #64820 by moving if/else into match guards.

r? @bluss

4 years agoRollup merge of #65192 - estebank:restrict-bound, r=matthewjasper
Mazdak Farrokhzad [Sat, 19 Oct 2019 14:00:51 +0000 (16:00 +0200)]
Rollup merge of #65192 - estebank:restrict-bound, r=matthewjasper

Use structured suggestion for restricting bounds

When a trait bound is not met and restricting a type parameter would
make the restriction hold, use a structured suggestion pointing at an
appropriate place (type param in param list or `where` clause).

Account for opaque parameters where instead of suggesting extending
the `where` clause, we suggest appending the new restriction:
`fn foo(impl Trait + UnmetTrait)`. Fix #64565, fix #41817, fix #24354,
cc #26026, cc #37808, cc #24159, fix #37138, fix #24354, cc #20671.

4 years agoRollup merge of #64007 - estebank:overlapping-patterns, r=matthewjasper
Mazdak Farrokhzad [Sat, 19 Oct 2019 14:00:50 +0000 (16:00 +0200)]
Rollup merge of #64007 - estebank:overlapping-patterns, r=matthewjasper

Add check for overlapping ranges to unreachable patterns lint

Fix #63987.

4 years agodo all the same edits with Arc
Ralf Jung [Sat, 19 Oct 2019 11:48:02 +0000 (13:48 +0200)]
do all the same edits with Arc

4 years agosome more Rc tweaks
Ralf Jung [Sat, 19 Oct 2019 11:47:32 +0000 (13:47 +0200)]
some more Rc tweaks

4 years agoAuto merge of #64890 - wesleywiser:const_prop_rvalue, r=oli-obk
bors [Sat, 19 Oct 2019 08:59:39 +0000 (08:59 +0000)]
Auto merge of #64890 - wesleywiser:const_prop_rvalue, r=oli-obk

[const-prop] Handle remaining MIR Rvalue cases

r? @oli-obk

4 years agothe exampleis about drop, not (de)allocation
Ralf Jung [Sat, 19 Oct 2019 08:14:10 +0000 (10:14 +0200)]
the exampleis about drop, not (de)allocation

4 years agoAuto merge of #65588 - Centril:rollup-9k55k3t, r=Centril
bors [Sat, 19 Oct 2019 05:11:13 +0000 (05:11 +0000)]
Auto merge of #65588 - Centril:rollup-9k55k3t, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #65174 (Fix zero-size uninitialized boxes)
 - #65252 (expand: Simplify expansion of derives)
 - #65485 (Suppress ICE when validators disagree on `LiveDrop`s in presence of `&mut`)
 - #65542 (Refer to "associated functions" instead of "static methods")
 - #65545 (More symbol cleanups)
 - #65576 (Don't add `argc` and `argv` arguments to `main` on WASI.)

Failed merges:

r? @ghost

4 years agoRollup merge of #65576 - sunfishcode:main-needs-argc-argv, r=alexcrichton
Mazdak Farrokhzad [Sat, 19 Oct 2019 05:10:10 +0000 (07:10 +0200)]
Rollup merge of #65576 - sunfishcode:main-needs-argc-argv, r=alexcrichton

Don't add `argc` and `argv` arguments to `main` on WASI.

Add a target setting to allow targets to specify whether the generated
`main` function should be passed `argc` and `argv` arguments. Set it
to false on wasm32-wasi, since WASI's `args::args()` calls into the
WASI APIs itself. This will allow the WASI toolchain to avoid linking
and running command-line argument initialization code when the arguments
aren't actually needed.

4 years agoRollup merge of #65545 - nnethercote:more-symbol-cleanups, r=petrochenkov
Mazdak Farrokhzad [Sat, 19 Oct 2019 05:10:09 +0000 (07:10 +0200)]
Rollup merge of #65545 - nnethercote:more-symbol-cleanups, r=petrochenkov

More symbol cleanups

Some minor improvements, mostly aimed at reducing unimportant differences between `Symbol` and `InternedString`. Helps a little with #60869.

r? @petrochenkov

4 years agoRollup merge of #65542 - estebank:kill-static-methods, r=Centril
Mazdak Farrokhzad [Sat, 19 Oct 2019 05:10:07 +0000 (07:10 +0200)]
Rollup merge of #65542 - estebank:kill-static-methods, r=Centril

Refer to "associated functions" instead of "static methods"

Fix #59782.

4 years agoRollup merge of #65485 - ecstatic-morse:const-validation-mismatch-ugliness, r=eddyb
Mazdak Farrokhzad [Sat, 19 Oct 2019 05:10:06 +0000 (07:10 +0200)]
Rollup merge of #65485 - ecstatic-morse:const-validation-mismatch-ugliness, r=eddyb

Suppress ICE when validators disagree on `LiveDrop`s in presence of `&mut`

Resolves #65394.

This hack disables the validator mismatch ICE in cases where a `MutBorrow` error has been emitted by both validators, but they don't agree on the number of `LiveDrop` errors.

The new validator is more conservative about whether a value is moved from in the presence of mutable borrows. For example, the new validator will emit a `LiveDrop` error on the following code.

```rust
const _: Vec<i32> = {
    let mut x = Vec::new();
    let px = &mut x as *mut _;
    let y = x;
    unsafe { ptr::write(px, Vec::new()); }
    y
};
```

This code is not UB AFAIK (it passes MIRI at least). The current validator does not emit a `LiveDrop` error for `x` upon exit from the initializer. `x` is not actually dropped, so I think this is correct? A proper fix for this would require a new `MaybeInitializedLocals` dataflow analysis or maybe a relaxation of the existing `IndirectlyMutableLocals` one.

r? @RalfJung

4 years agoRollup merge of #65252 - petrochenkov:deriveholders2, r=matthewjasper
Mazdak Farrokhzad [Sat, 19 Oct 2019 05:10:04 +0000 (07:10 +0200)]
Rollup merge of #65252 - petrochenkov:deriveholders2, r=matthewjasper

expand: Simplify expansion of derives

And make it more uniform with other macros.
This is done by merging placeholders for future derives' outputs into the derive container's output fragment early (addressing FIXMEs from https://github.com/rust-lang/rust/pull/63667).

Also, macros with names starting with `_` are no longer reported as unused, in accordance with the usual behavior of `unused` lints.

r? @matthewjasper or @mark-i-m

4 years agoRollup merge of #65174 - SimonSapin:zero-box, r=alexcrichton
Mazdak Farrokhzad [Sat, 19 Oct 2019 05:10:03 +0000 (07:10 +0200)]
Rollup merge of #65174 - SimonSapin:zero-box, r=alexcrichton

Fix zero-size uninitialized boxes

Requesting a zero-size allocation is not allowed, return a dangling pointer instead.

CC https://github.com/rust-lang/rust/issues/63291#issuecomment-538692745

4 years agoAuto merge of #65570 - tmandry:rollup-hck39pf, r=tmandry
bors [Sat, 19 Oct 2019 01:16:41 +0000 (01:16 +0000)]
Auto merge of #65570 - tmandry:rollup-hck39pf, r=tmandry

Rollup of 19 pull requests

Successful merges:

 - #65016 (Always inline `mem::{size_of,align_of}` in debug builds)
 - #65197 (Prepare `MutVisitor`s to handle interned projections)
 - #65201 (Disable Go and OCaml bindings when building LLVM)
 - #65334 (Add long error explanation for E0575)
 - #65364 (Collect occurrences of empty blocks for mismatched braces diagnostic)
 - #65455 (Avoid unnecessary `TokenTree` to `TokenStream` conversions)
 - #65472 (Use a sharded dep node to dep node index map)
 - #65480 (Speed up `LexicalResolve::expansion()`)
 - #65493 (Add long error explanation for E0584)
 - #65496 (properly document panics in div_euclid and rem_euclid)
 - #65498 (Plugins deprecation: don’t suggest simply removing the attribute)
 - #65508 (add option to ping llvm ice-breakers to triagebot)
 - #65511 (save-analysis: Nest tables when processing impl block definitions)
 - #65513 (reorder fmt docs for more clarity)
 - #65532 (doc: make BitSet intro more short)
 - #65535 (rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.)
 - #65540 (show up some extra info when t!() fails)
 - #65549 (Fix left/right shift typo in wrapping rotate docs)
 - #65552 (Clarify diagnostics when using `~` as a unary op)

Failed merges:

 - #65390 (Add long error explanation for E0576)
 - #65434 (Add long error explanation for E0577)
 - #65471 (Add long error explanation for E0578)

r? @ghost

4 years agoImprove comments and structure of `ConstProp::const_prop()`
Wesley Wiser [Sun, 13 Oct 2019 17:48:26 +0000 (13:48 -0400)]
Improve comments and structure of `ConstProp::const_prop()`

Per code review feedback

4 years agoDon't ICE when evaluating writes to uninhabited enum variants
Wesley Wiser [Wed, 9 Oct 2019 10:08:46 +0000 (06:08 -0400)]
Don't ICE when evaluating writes to uninhabited enum variants

4 years agoCleanup const_prop() some
Wesley Wiser [Sun, 15 Sep 2019 16:08:09 +0000 (12:08 -0400)]
Cleanup const_prop() some

4 years ago[const-prop] Handle MIR Rvalue::Box
Wesley Wiser [Sun, 15 Sep 2019 16:03:52 +0000 (12:03 -0400)]
[const-prop] Handle MIR Rvalue::Box

4 years agoUninitialized boxes: add test for zero-size allocations
Simon Sapin [Wed, 16 Oct 2019 18:33:55 +0000 (20:33 +0200)]
Uninitialized boxes: add test for zero-size allocations

4 years agoFix rebase
Vadim Petrochenkov [Fri, 18 Oct 2019 21:54:17 +0000 (00:54 +0300)]
Fix rebase

4 years agoprivacy: Avoid one more `unwrap` causing an ICE in rustdoc
Vadim Petrochenkov [Tue, 15 Oct 2019 21:01:47 +0000 (00:01 +0300)]
privacy: Avoid one more `unwrap` causing an ICE in rustdoc

The issue is rustdoc-specific because its root cause if the `everybody_loops` pass makes some def-ids to not have local hir-ids

4 years agoexpand: Simplify expansion of derives
Vadim Petrochenkov [Wed, 9 Oct 2019 22:41:47 +0000 (01:41 +0300)]
expand: Simplify expansion of derives

And make it more uniform with other macros.
By merging placeholders for future derives' outputs into the derive container's output fragment early.

4 years agoresolve: Mark macros starting with an underscore as used
Vadim Petrochenkov [Wed, 9 Oct 2019 22:08:17 +0000 (01:08 +0300)]
resolve: Mark macros starting with an underscore as used

4 years agoRollup merge of #65552 - JohnTitor:use-bitwise-not, r=Dylan-DPC
Tyler Mandry [Fri, 18 Oct 2019 20:48:38 +0000 (13:48 -0700)]
Rollup merge of #65552 - JohnTitor:use-bitwise-not, r=Dylan-DPC

Clarify diagnostics when using `~` as a unary op

It seems we prefer `bitwise not` to `bitwise negation`.
Fixes #57239

r? @estebank

4 years agoRollup merge of #65549 - t-rapp:tr-wrapping-rotate-docs, r=jonas-schievink
Tyler Mandry [Fri, 18 Oct 2019 20:48:37 +0000 (13:48 -0700)]
Rollup merge of #65549 - t-rapp:tr-wrapping-rotate-docs, r=jonas-schievink

Fix left/right shift typo in wrapping rotate docs

This makes the note similar to the one found on rotate functions for primitive types like i32/u32.

4 years agoRollup merge of #65540 - guanqun:extend-t-macro, r=nikomatsakis
Tyler Mandry [Fri, 18 Oct 2019 20:48:35 +0000 (13:48 -0700)]
Rollup merge of #65540 - guanqun:extend-t-macro, r=nikomatsakis

show up some extra info when t!() fails

4 years agoRollup merge of #65535 - eddyb:sliced-predicates, r=nikomatsakis
Tyler Mandry [Fri, 18 Oct 2019 20:48:34 +0000 (13:48 -0700)]
Rollup merge of #65535 - eddyb:sliced-predicates, r=nikomatsakis

rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.

While rebasing #59789 I noticed we can do this now. However, it doesn't help much without changing `inferred_outlives_of` to the same type, which I might try next.

4 years agoRollup merge of #65532 - tshepang:shorten-intro, r=Dylan-DPC
Tyler Mandry [Fri, 18 Oct 2019 20:48:32 +0000 (13:48 -0700)]
Rollup merge of #65532 - tshepang:shorten-intro, r=Dylan-DPC

doc: make BitSet intro more short

Also, add a link to the growable type

4 years agoRollup merge of #65513 - RalfJung:fmt, r=Mark-Simulacrum
Tyler Mandry [Fri, 18 Oct 2019 20:48:31 +0000 (13:48 -0700)]
Rollup merge of #65513 - RalfJung:fmt, r=Mark-Simulacrum

reorder fmt docs for more clarity

I adjusted these docs in https://github.com/rust-lang/rust/pull/65332 but wasn't happy with the result when seeing it in rustdoc. So this reorders the subsections in the "Formatting Parameters" section to be more logical (subsections that reference `width` come after the `width` subsection) and they also all have examples now.

4 years agoRollup merge of #65511 - Xanewok:sa-nest-in-impls, r=pnkfelix
Tyler Mandry [Fri, 18 Oct 2019 20:48:29 +0000 (13:48 -0700)]
Rollup merge of #65511 - Xanewok:sa-nest-in-impls, r=pnkfelix

save-analysis: Nest tables when processing impl block definitions

Similar to #65353 (which this PR should've been a part of), however in this case we didn't previously nest the tables when processing trait paths in impl block declarations.

Closes #65411

4 years agoRollup merge of #65508 - rust-lang:llvm-icebreakers-ping-1, r=simulacrum
Tyler Mandry [Fri, 18 Oct 2019 20:48:28 +0000 (13:48 -0700)]
Rollup merge of #65508 - rust-lang:llvm-icebreakers-ping-1, r=simulacrum

add option to ping llvm ice-breakers to triagebot

4 years agoRollup merge of #65498 - SimonSapin:plugin-help, r=Centril
Tyler Mandry [Fri, 18 Oct 2019 20:48:26 +0000 (13:48 -0700)]
Rollup merge of #65498 - SimonSapin:plugin-help, r=Centril

Plugins deprecation: don’t suggest simply removing the attribute

Building Servo with a recent Nightly produces:

```rust
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
  --> components/script/lib.rs:14:1
   |
14 | #![plugin(script_plugins)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
   |
   = note: `#[warn(deprecated)]` on by default
```

First, linking to https://github.com/rust-lang/rust/issues/29597 is not ideal since there is pretty much no discussion there of the deprecation and what can be used instead. This PR changes the link to the deprecation PR which does have more discussion.

Second, the “remove this attribute” suggestion is rather unhelpful. Just because a feature is deprecated doesn’t mean that simply removing its use without a replacement is acceptable.

In the case of custom lint, there is no replacement available. Prefixing a message with “help:” when telling users that they’re screwed honestly feels disrespectful.

This PR also changes the message to be more factual.

4 years agoRollup merge of #65496 - tspiteri:euc-div-panic, r=KodrAus
Tyler Mandry [Fri, 18 Oct 2019 20:48:25 +0000 (13:48 -0700)]
Rollup merge of #65496 - tspiteri:euc-div-panic, r=KodrAus

properly document panics in div_euclid and rem_euclid

For signed numbers, document that `div_euclid` and `rem_euclid` panic not just when `rhs` is 0, but also when the division overflows.

For unsigned numbers, document that `div_euclid` and `rem_euclid` panic when `rhs` is 0.

4 years agoRollup merge of #65493 - GuillaumeGomez:long-err-explanation-E0584, r=kinnison
Tyler Mandry [Fri, 18 Oct 2019 20:48:24 +0000 (13:48 -0700)]
Rollup merge of #65493 - GuillaumeGomez:long-err-explanation-E0584, r=kinnison

Add long error explanation for E0584

Part of #61137.

r? @kinnison

4 years agoRollup merge of #65480 - nnethercote:rm-iterate_until_fixed_size, r=nikomatsakis
Tyler Mandry [Fri, 18 Oct 2019 20:48:22 +0000 (13:48 -0700)]
Rollup merge of #65480 - nnethercote:rm-iterate_until_fixed_size, r=nikomatsakis

Speed up `LexicalResolve::expansion()`

A couple of improvements that speed up `unicode_normalization` by about 4%. The first commit was enabled by the improvements to `BitSet` iteration in #65425.

r? @nikomatsakis

4 years agoRollup merge of #65472 - Zoxc:sharded-dep-graph-2, r=nikomatsakis
Tyler Mandry [Fri, 18 Oct 2019 20:48:20 +0000 (13:48 -0700)]
Rollup merge of #65472 - Zoxc:sharded-dep-graph-2, r=nikomatsakis

Use a sharded dep node to dep node index map

Split out from https://github.com/rust-lang/rust/pull/61845 and based on https://github.com/rust-lang/rust/pull/63756.

r? @nikomatsakis

4 years agoRollup merge of #65455 - nnethercote:avoid-unnecessary-TokenTree-to-TokenStream-conve...
Tyler Mandry [Fri, 18 Oct 2019 20:48:18 +0000 (13:48 -0700)]
Rollup merge of #65455 - nnethercote:avoid-unnecessary-TokenTree-to-TokenStream-conversions, r=petrochenkov

Avoid unnecessary `TokenTree` to `TokenStream` conversions

A `TokenStream` contains any number of `TokenTrees`. Therefore, a single `TokenTree` can be promoted to a `TokenStream`. But doing so costs two allocations: one for the single-element `Vec`, and one for the `Lrc`. (An `IsJoint` value also must be added; the default is `NonJoint`.)

The current code converts `TokenTree`s to `TokenStream`s unnecessarily in a few places. This PR removes some of these unnecessary conversions, both simplifying the code and speeding it up.

r? @petrochenkov

4 years agoRollup merge of #65364 - XiangQingW:master, r=estebank
Tyler Mandry [Fri, 18 Oct 2019 20:48:16 +0000 (13:48 -0700)]
Rollup merge of #65364 - XiangQingW:master, r=estebank

Collect occurrences of empty blocks for mismatched braces diagnostic

Fix #63904

4 years agoRollup merge of #65334 - GuillaumeGomez:long-err-explanation-E0575, r=kinnison
Tyler Mandry [Fri, 18 Oct 2019 20:48:14 +0000 (13:48 -0700)]
Rollup merge of #65334 - GuillaumeGomez:long-err-explanation-E0575, r=kinnison

Add long error explanation for E0575

Part of #61137.

4 years agoRollup merge of #65201 - tmiasko:no-bindings, r=rkruppe
Tyler Mandry [Fri, 18 Oct 2019 20:48:13 +0000 (13:48 -0700)]
Rollup merge of #65201 - tmiasko:no-bindings, r=rkruppe

Disable Go and OCaml bindings when building LLVM

Instead of instaling OCaml bindings in a location where installation
will not fail, don't build them in the first place.

4 years agoRollup merge of #65197 - spastorino:place-mut-visitor-adjusts2, r=oli-obk
Tyler Mandry [Fri, 18 Oct 2019 20:48:11 +0000 (13:48 -0700)]
Rollup merge of #65197 - spastorino:place-mut-visitor-adjusts2, r=oli-obk

Prepare `MutVisitor`s to handle interned projections

The following are all the files where mir's `MutVisitor` is implemented. The `-` there stands for no changes, `visit_place` wasn't making any change on `Place`s. `x` stands for this file was changed to make `visit_place` do whatever it was doing with the base but avoid modifying the projection, instead just create a new one and assign to it.

```
[-] src/librustc_mir/transform/no_landing_pads.rs
[x] src/librustc_mir/transform/promote_consts.rs
[x] src/librustc_mir/transform/generator.rs
[x] src/librustc_mir/transform/erase_regions.rs
[-] src/librustc_mir/transform/instcombine.rs
[x] src/librustc_mir/transform/inline.rs
[x] src/librustc_mir/transform/simplify.rs
[x] src/librustc_mir/util/def_use.rs
[-] src/librustc_mir/transform/const_prop.rs
[-] src/librustc_mir/transform/cleanup_post_borrowck.rs
[x] src/librustc_mir/borrow_check/nll/renumber.rs
[-] src/librustc_mir/transform/copy_prop.rs
```

There is some code repetition, just created the PR so we can start discussing it.

/cc @oli-obk @nikomatsakis

4 years agoRollup merge of #65016 - lzutao:inline-mem-constfn, r=oli-obk
Tyler Mandry [Fri, 18 Oct 2019 20:48:10 +0000 (13:48 -0700)]
Rollup merge of #65016 - lzutao:inline-mem-constfn, r=oli-obk

Always inline `mem::{size_of,align_of}` in debug builds

Those two are const fn and do not have any arguments. Inlining
helps reducing generated code size in debug builds.

See also #64996.

4 years agoreview comments
Esteban Küber [Fri, 18 Oct 2019 20:00:14 +0000 (13:00 -0700)]
review comments

4 years agoreview comment: span bug label
Esteban Küber [Fri, 18 Oct 2019 15:38:08 +0000 (08:38 -0700)]
review comment: span bug label

4 years agoreview comments: help wording
Esteban Küber [Fri, 18 Oct 2019 15:36:46 +0000 (08:36 -0700)]
review comments: help wording

4 years agoUse Cow to handle modifications of projection in preparation for interning
Santiago Pastorino [Wed, 9 Oct 2019 02:46:14 +0000 (23:46 -0300)]
Use Cow to handle modifications of projection in preparation for interning

4 years ago[const-prop] Handle MIR Rvalue::Discriminant
Wesley Wiser [Sun, 15 Sep 2019 04:05:19 +0000 (00:05 -0400)]
[const-prop] Handle MIR Rvalue::Discriminant

4 years ago[const-prop] Handle MIR Rvalue::Aggregates
Wesley Wiser [Sat, 14 Sep 2019 18:11:31 +0000 (14:11 -0400)]
[const-prop] Handle MIR Rvalue::Aggregates

4 years ago[const-prop] Handle MIR Rvalue::Repeat
Wesley Wiser [Sat, 14 Sep 2019 13:22:07 +0000 (09:22 -0400)]
[const-prop] Handle MIR Rvalue::Repeat

4 years agoAuto merge of #64925 - ehuss:document-json, r=Mark-Simulacrum
bors [Fri, 18 Oct 2019 10:15:26 +0000 (10:15 +0000)]
Auto merge of #64925 - ehuss:document-json, r=Mark-Simulacrum

Document JSON message output.

This documents the JSON messages in the rustc book.

4 years agoClarify diagnostics when using `~` as a unary op
Yuki Okushi [Fri, 18 Oct 2019 09:15:16 +0000 (18:15 +0900)]
Clarify diagnostics when using `~` as a unary op

4 years agoFix left/right shift typo in wrapping rotate docs
Tobias Rapp [Fri, 18 Oct 2019 06:29:18 +0000 (08:29 +0200)]
Fix left/right shift typo in wrapping rotate docs

This makes the note similar to the one found on rotate functions for
primitive types like i32/u32.

4 years agoRemove `Hash` impls for `DefPath`, `DisambiguatedDefPathData`, and `DefKey`.
Nicholas Nethercote [Fri, 18 Oct 2019 05:36:17 +0000 (16:36 +1100)]
Remove `Hash` impls for `DefPath`, `DisambiguatedDefPathData`, and `DefKey`.

They aren't used.

4 years agoRemove `Copy` and `Clone` impls for `LocalInternedString`.
Nicholas Nethercote [Fri, 18 Oct 2019 05:05:14 +0000 (16:05 +1100)]
Remove `Copy` and `Clone` impls for `LocalInternedString`.

They aren't used.

4 years agoPoint at enclosing function without `self` receiver
Esteban Küber [Fri, 18 Oct 2019 03:26:21 +0000 (20:26 -0700)]
Point at enclosing function without `self` receiver

4 years agoFix cast of stx_btime.tv_nsec
oxalica [Fri, 18 Oct 2019 02:19:50 +0000 (10:19 +0800)]
Fix cast of stx_btime.tv_nsec

4 years agoFix cfgs for current libc
oxalica [Sun, 13 Oct 2019 23:17:15 +0000 (07:17 +0800)]
Fix cfgs for current libc

4 years agoPrefer statx on linux if available
oxalica [Fri, 4 Oct 2019 08:17:23 +0000 (16:17 +0800)]
Prefer statx on linux if available

4 years agoChange how `Symbol::Debug` works.
Nicholas Nethercote [Thu, 17 Oct 2019 23:06:23 +0000 (10:06 +1100)]
Change how `Symbol::Debug` works.

Currently, `Symbol::Debug` and `Symbol::Display` produce the same
output; neither wraps the symbol in double quotes.

This commit changes `Symbol::Debug` so it wraps the symbol in quotes.
This change brings `Symbol`'s behaviour in line with `String` and
`InternedString`. The change requires a couple of trivial test output
adjustments.

4 years agoUse `with` in `Symbol` trait methods.
Nicholas Nethercote [Thu, 17 Oct 2019 22:24:56 +0000 (09:24 +1100)]
Use `with` in `Symbol` trait methods.

Instead of `as_str()`, which unnecessarily involves `LocalInternedString`.

4 years agoChange `MetaItem::tokens()` to `MetaItem::token_trees_and_joints()`.
Nicholas Nethercote [Mon, 14 Oct 2019 03:06:00 +0000 (14:06 +1100)]
Change `MetaItem::tokens()` to `MetaItem::token_trees_and_joints()`.

Likewise for `NestedMetaItem::tokens()`. Also, add
`MetaItemKind::token_trees_and_joints()`, which `MetaItemKind::tokens()`
now calls.

This avoids some unnecessary `TokenTree` to `TokenStream` conversions,
and removes the need for the clumsy
`TokenStream::append_to_tree_and_joint_vec()`.

4 years agoChange `Lit::tokens()` to `Lit::token_tree()`.
Nicholas Nethercote [Mon, 14 Oct 2019 00:24:46 +0000 (11:24 +1100)]
Change `Lit::tokens()` to `Lit::token_tree()`.

Because most of the call sites have an easier time working with a
`TokenTree` instead of a `TokenStream`.

4 years agoMake `TokenStream::from_iter` less general and more efficient.
Nicholas Nethercote [Sun, 13 Oct 2019 23:37:21 +0000 (10:37 +1100)]
Make `TokenStream::from_iter` less general and more efficient.

The current code has this impl:
```
impl<T: Into<TokenStream>> iter::FromIterator<T> for TokenStream
```
If given an `IntoIterator<Item = TokenTree>`, it will convert each individual
`TokenTree` to a `TokenStream` (at the cost of two allocations: a `Vec`
and an `Lrc`). It will then merge those `TokenStream`s into a single
`TokenStream`. This is inefficient.

This commit changes the impl to this less general one:
```
impl iter::FromIterator<TokenTree> for TokenStream
```
It collects the `TokenTree`s into a single `Vec` first and then converts that
to a `TokenStream` by wrapping it in a single `Lrc`. The previous generality
was unnecessary; no other code needs changing.

This change speeds up several benchmarks by up to 4%.

4 years agoRemove two no-op `into()` calls.
Nicholas Nethercote [Tue, 15 Oct 2019 22:30:28 +0000 (09:30 +1100)]
Remove two no-op `into()` calls.

4 years agoAuto merge of #65533 - Manishearth:clippyup, r=Manishearth
bors [Fri, 18 Oct 2019 02:15:07 +0000 (02:15 +0000)]
Auto merge of #65533 - Manishearth:clippyup, r=Manishearth

Update clippy

None

4 years agoAdd process_* place hooks to improve code reutilization
Santiago Pastorino [Tue, 8 Oct 2019 18:33:19 +0000 (15:33 -0300)]
Add process_* place hooks to improve code reutilization

4 years agoSetup a different visit place set of methods for mutable and immutable visitors
Santiago Pastorino [Tue, 8 Oct 2019 15:16:26 +0000 (12:16 -0300)]
Setup a different visit place set of methods for mutable and immutable visitors

In particular, use a blank visit_place for mutable visitor to be sure,
non modified visitors are not trying to mutating place.

4 years agoRemove unneeded callback and just use the new_local value
Santiago Pastorino [Tue, 8 Oct 2019 03:33:47 +0000 (00:33 -0300)]
Remove unneeded callback and just use the new_local value

4 years agoPrepare def_use MutVisitor to have projections interned
Santiago Pastorino [Tue, 8 Oct 2019 03:24:18 +0000 (00:24 -0300)]
Prepare def_use MutVisitor to have projections interned

4 years agoPrepare erase_regions MutVisitor to have projections interned
Santiago Pastorino [Mon, 7 Oct 2019 22:35:41 +0000 (19:35 -0300)]
Prepare erase_regions MutVisitor to have projections interned

4 years agoPrepare generator MutVisitor to have projections interned
Santiago Pastorino [Mon, 7 Oct 2019 22:14:35 +0000 (19:14 -0300)]
Prepare generator MutVisitor to have projections interned

4 years agoPrepare inline MutVisitor to have projections interned
Santiago Pastorino [Mon, 7 Oct 2019 21:23:39 +0000 (18:23 -0300)]
Prepare inline MutVisitor to have projections interned

4 years agoPrepare renumber MutVisitor to have projections interned
Santiago Pastorino [Mon, 7 Oct 2019 21:15:19 +0000 (18:15 -0300)]
Prepare renumber MutVisitor to have projections interned

4 years agoPrepare simplify MutVisitor to have projections interned
Santiago Pastorino [Mon, 7 Oct 2019 20:58:28 +0000 (17:58 -0300)]
Prepare simplify MutVisitor to have projections interned

4 years agoPrepare promote_consts MutVisitor to have projections interned
Santiago Pastorino [Mon, 7 Oct 2019 19:39:20 +0000 (16:39 -0300)]
Prepare promote_consts MutVisitor to have projections interned

4 years agosuper_ty on MutVisitor is empty so avoid the call
Santiago Pastorino [Mon, 7 Oct 2019 22:36:48 +0000 (19:36 -0300)]
super_ty on MutVisitor is empty so avoid the call

4 years agoRefer to "associated functions" instead of "static methods"
Esteban Küber [Fri, 18 Oct 2019 02:00:19 +0000 (19:00 -0700)]
Refer to "associated functions" instead of "static methods"

4 years agorustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.
Eduard-Mihai Burtescu [Fri, 18 Oct 2019 00:14:57 +0000 (03:14 +0300)]
rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.

4 years agoUpdate clippy
Manish Goregaokar [Thu, 17 Oct 2019 23:59:10 +0000 (16:59 -0700)]
Update clippy

4 years agoDon't add `argc` and `argv` arguments to `main` on WASI.
Dan Gohman [Thu, 17 Oct 2019 23:09:32 +0000 (16:09 -0700)]
Don't add `argc` and `argv` arguments to `main` on WASI.

Add a target setting to allow targets to specify whether the generated
`main` function should be passed `argc` and `argv` arguments. Set it
to false on wasm32-wasi, since WASI's `args::args()` calls into the
WASI APIs itself. This will allow the WASI toolchain to avoid linking
and running command-line argument initialization code when the arguments
aren't actually needed.

4 years agodoc: make BitSet intro more short
Tshepang Lekhonkhobe [Thu, 17 Oct 2019 23:16:30 +0000 (01:16 +0200)]
doc: make BitSet intro more short

Also, add a link to the growable type

4 years agoBTreeSet symmetric_difference & union optimized, cleaned
Stein Somers [Tue, 8 Oct 2019 23:07:57 +0000 (01:07 +0200)]
BTreeSet symmetric_difference & union optimized, cleaned

4 years agoexample for padding any format
Ralf Jung [Thu, 17 Oct 2019 21:00:46 +0000 (23:00 +0200)]
example for padding any format

4 years agoUpdate triagebot.toml
Niko Matsakis [Thu, 17 Oct 2019 20:53:47 +0000 (16:53 -0400)]
Update triagebot.toml

Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
4 years agoreorder fmt docs for more clarity
Ralf Jung [Thu, 17 Oct 2019 19:22:46 +0000 (21:22 +0200)]
reorder fmt docs for more clarity

4 years agoAuto merge of #65495 - Centril:rollup-tguwjt5, r=Centril
bors [Thu, 17 Oct 2019 18:53:10 +0000 (18:53 +0000)]
Auto merge of #65495 - Centril:rollup-tguwjt5, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #65237 (Move debug_map assertions after check for err)
 - #65316 (make File::try_clone produce non-inheritable handles on Windows)
 - #65319 (InterpCx: make memory field public)
 - #65461 (Don't recommend ONCE_INIT in std::sync::Once)
 - #65465 (Move syntax::ext to a syntax_expand and refactor some attribute logic)
 - #65475 (add example for type_name)
 - #65478 (fmt::Write is about string slices, not byte slices)
 - #65486 (doc: fix typo in OsStrExt and OsStringExt)

Failed merges:

r? @ghost

4 years agosave-analysis: Add a relevant test case
Igor Matuszewski [Thu, 17 Oct 2019 18:49:06 +0000 (20:49 +0200)]
save-analysis: Add a relevant test case

4 years agosave-analysis: Nest tables when processing impl items
Igor Matuszewski [Thu, 17 Oct 2019 18:48:00 +0000 (20:48 +0200)]
save-analysis: Nest tables when processing impl items

4 years agoadd option to ping llvm ice-breakers to triagebot
Niko Matsakis [Thu, 17 Oct 2019 18:15:59 +0000 (14:15 -0400)]
add option to ping llvm ice-breakers to triagebot

4 years agomore consistency and clarification
Ralf Jung [Thu, 17 Oct 2019 17:51:42 +0000 (19:51 +0200)]
more consistency and clarification