Commit Graph

100784 Commits

Author SHA1 Message Date
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
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
Simon Sapin
227db40a98 Uninitialized boxes: add test for zero-size allocations 2019-10-18 23:57:22 +02: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
Tyler Mandry
fdef437372
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.
2019-10-18 13:48:13 -07:00
Tyler Mandry
d2bea3c95d
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
2019-10-18 13:48:11 -07:00
Tyler Mandry
7167a59241
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.
2019-10-18 13:48:10 -07:00
Santiago Pastorino
48349960e6
Use Cow to handle modifications of projection in preparation for interning 2019-10-18 10:06:13 -04:00
bors
518deda77f Auto merge of #64925 - ehuss:document-json, r=Mark-Simulacrum
Document JSON message output.

This documents the JSON messages in the rustc book.
2019-10-18 10:15:26 +00:00
Yuki Okushi
9617014aa6 Clarify diagnostics when using ~ as a unary op 2019-10-18 18:15:16 +09:00
Tobias Rapp
769e75b40c 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 08:46:30 +02:00
Nicholas Nethercote
e4ec4a6da3 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()`.
2019-10-18 13:25:17 +11:00
Nicholas Nethercote
212ae58f36 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`.
2019-10-18 13:25:17 +11:00
Nicholas Nethercote
a6eef299d3 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%.
2019-10-18 13:25:17 +11:00
Nicholas Nethercote
d0eaf60d5e Remove two no-op into() calls. 2019-10-18 13:25:17 +11:00
bors
da59656b3b Auto merge of #65533 - Manishearth:clippyup, r=Manishearth
Update clippy

None
2019-10-18 02:15:07 +00:00
Santiago Pastorino
d53fc9cae5
Add process_* place hooks to improve code reutilization 2019-10-17 22:06:56 -04:00
Santiago Pastorino
7fa3425ef6
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.
2019-10-17 22:06:56 -04:00
Santiago Pastorino
4f2a11036d
Remove unneeded callback and just use the new_local value 2019-10-17 22:06:56 -04:00
Santiago Pastorino
2b2e35bfc3
Prepare def_use MutVisitor to have projections interned 2019-10-17 22:06:56 -04:00
Santiago Pastorino
39c9ed3ac1
Prepare erase_regions MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
0fc063f159
Prepare generator MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
e3e9951673
Prepare inline MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
bb7d6d1c70
Prepare renumber MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
591cc9aede
Prepare simplify MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
e069e9ccac
Prepare promote_consts MutVisitor to have projections interned 2019-10-17 22:06:55 -04:00
Santiago Pastorino
5de9cb0703
super_ty on MutVisitor is empty so avoid the call 2019-10-17 22:06:55 -04:00
Eduard-Mihai Burtescu
cd9e4441eb rustc: arena-allocate the slice in ty::GenericsPredicate, not the whole struct. 2019-10-18 03:14:57 +03:00
Manish Goregaokar
ebf731c638 Update clippy 2019-10-17 16:59:10 -07:00
Tshepang Lekhonkhobe
c9b27d1236 doc: make BitSet intro more short
Also, add a link to the growable type
2019-10-18 01:16:30 +02:00
Ralf Jung
c0b7e769a0 example for padding any format 2019-10-17 23:02:09 +02:00
Niko Matsakis
54879949f1
Update triagebot.toml
Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
2019-10-17 16:53:47 -04:00
Ralf Jung
4e6efe4811 reorder fmt docs for more clarity 2019-10-17 21:22:46 +02:00
bors
fa0f7d0080 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
2019-10-17 18:53:10 +00:00
Igor Matuszewski
ad6ce46986 save-analysis: Add a relevant test case 2019-10-17 20:49:06 +02:00