Commit Graph

101186 Commits

Author SHA1 Message Date
Manish Goregaokar
90df0f4ec9 Update clippy 2019-10-19 08:00:48 -07:00
Georg Semmler
7e17ea37b7
Fix test paths 2019-10-19 16:02:21 +02:00
bors
c49187530d 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
2019-10-19 14:01:35 +00:00
Mazdak Farrokhzad
2de4f4335e
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
2019-10-19 16:00:56 +02:00
Mazdak Farrokhzad
5532699251
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
2019-10-19 16:00:54 +02:00
Mazdak Farrokhzad
a6b5c80dbc
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
2019-10-19 16:00:53 +02:00
Mazdak Farrokhzad
7e4ff91403
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.
2019-10-19 16:00:51 +02:00
Mazdak Farrokhzad
53a3bfc82b
Rollup merge of #64007 - estebank:overlapping-patterns, r=matthewjasper
Add check for overlapping ranges to unreachable patterns lint

Fix #63987.
2019-10-19 16:00:50 +02:00
Ralf Jung
38fd74f22a show the proper diagnostics 2019-10-19 15:52:08 +02:00
Ralf Jung
7f1ce45140 add test for calling non-const fn 2019-10-19 15:40:20 +02:00
Ralf Jung
282403e6bd clarify const_prop ICE protection comment 2019-10-19 15:14:59 +02:00
Ralf Jung
1b3846359a do all the same edits with Arc 2019-10-19 13:48:02 +02:00
Ralf Jung
52a31f7a00 some more Rc tweaks 2019-10-19 13:47:32 +02:00
Mazdak Farrokhzad
d945f9860f move parse_cfgspecs to rustc_interface 2019-10-19 13:25:46 +02:00
bors
e5b8c118a3 Auto merge of #64890 - wesleywiser:const_prop_rvalue, r=oli-obk
[const-prop] Handle remaining MIR Rvalue cases

r? @oli-obk
2019-10-19 08:59:39 +00:00
Ralf Jung
696cba6e25 the exampleis about drop, not (de)allocation 2019-10-19 10:14:10 +02:00
bors
9578272d68 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
2019-10-19 05:11:13 +00:00
Mazdak Farrokhzad
3e1da91349
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.
2019-10-19 07:10:10 +02:00
Mazdak Farrokhzad
ed4c2c2a5f
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
2019-10-19 07:10:09 +02:00
Mazdak Farrokhzad
fab74044dd
Rollup merge of #65542 - estebank:kill-static-methods, r=Centril
Refer to "associated functions" instead of "static methods"

Fix #59782.
2019-10-19 07:10:07 +02:00
Mazdak Farrokhzad
27f8c7990e
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
2019-10-19 07:10:06 +02:00
Mazdak Farrokhzad
99603e99cc
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
2019-10-19 07:10:04 +02:00
Mazdak Farrokhzad
beec0a5db4
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
2019-10-19 07:10:03 +02:00
Yves Dorfsman
11214a6312 reworded loop value sentence 2019-10-18 19:49:09 -06:00
bors
14f0ed64e3 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
2019-10-19 01:16:41 +00:00
Wesley Wiser
fd20dbed00 Improve comments and structure of ConstProp::const_prop()
Per code review feedback
2019-10-18 19:16:49 -04:00
Wesley Wiser
b71ea80172 Don't ICE when evaluating writes to uninhabited enum variants 2019-10-18 19:16:49 -04:00
Wesley Wiser
8cf6c23d66 Cleanup const_prop() some 2019-10-18 19:16:49 -04:00
Wesley Wiser
2d22063e4c [const-prop] Handle MIR Rvalue::Box 2019-10-18 19:16:49 -04:00
Simon Sapin
227db40a98 Uninitialized boxes: add test for zero-size allocations 2019-10-18 23:57:22 +02:00
Vadim Petrochenkov
7f89f04b41 Fix rebase 2019-10-19 00:54:17 +03:00
Vadim Petrochenkov
25cc99fca0 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
2019-10-19 00:23:57 +03:00
Vadim Petrochenkov
7ce85f2dca 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.
2019-10-19 00:23:57 +03:00
Vadim Petrochenkov
2d3c17a609 resolve: Mark macros starting with an underscore as used 2019-10-19 00:23:04 +03:00
Tyler Mandry
3850408b9b
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
2019-10-18 13:48:38 -07:00
Tyler Mandry
edc42a91fd
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.
2019-10-18 13:48:37 -07:00
Tyler Mandry
37cbdf3924
Rollup merge of #65540 - guanqun:extend-t-macro, r=nikomatsakis
show up some extra info when t!() fails
2019-10-18 13:48:35 -07:00
Tyler Mandry
bc85061203
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.
2019-10-18 13:48:34 -07:00
Tyler Mandry
138ff4a536
Rollup merge of #65532 - tshepang:shorten-intro, r=Dylan-DPC
doc: make BitSet intro more short

Also, add a link to the growable type
2019-10-18 13:48:32 -07:00
Tyler Mandry
5948961ff4
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.
2019-10-18 13:48:31 -07:00
Tyler Mandry
156a55e51d
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
2019-10-18 13:48:29 -07:00
Tyler Mandry
9fc8d8eb45
Rollup merge of #65508 - rust-lang:llvm-icebreakers-ping-1, r=simulacrum
add option to ping llvm ice-breakers to triagebot
2019-10-18 13:48:28 -07:00
Tyler Mandry
64bf0cab39
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.
2019-10-18 13:48:26 -07:00
Tyler Mandry
ea5a184383
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.
2019-10-18 13:48:25 -07:00
Tyler Mandry
e27e39b7b2
Rollup merge of #65493 - GuillaumeGomez:long-err-explanation-E0584, r=kinnison
Add long error explanation for E0584

Part of #61137.

r? @kinnison
2019-10-18 13:48:24 -07:00
Tyler Mandry
c6bb96005e
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
2019-10-18 13:48:22 -07:00
Tyler Mandry
05ab63efc9
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
2019-10-18 13:48:20 -07:00
Tyler Mandry
f5f5c9e993
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
2019-10-18 13:48:18 -07:00
Tyler Mandry
8f8a23f642
Rollup merge of #65364 - XiangQingW:master, r=estebank
Collect occurrences of empty blocks for mismatched braces diagnostic

Fix #63904
2019-10-18 13:48:16 -07:00
Tyler Mandry
bb53fed72f
Rollup merge of #65334 - GuillaumeGomez:long-err-explanation-E0575, r=kinnison
Add long error explanation for E0575

Part of #61137.
2019-10-18 13:48:14 -07:00