Commit graph

152177 commits

Author SHA1 Message Date
Ibraheem Ahmed
a397fdcc38
Remove ASCII fast path from rustc_lexer::{is_id_continue, is_id_start} 2021-07-26 20:17:28 -04:00
The8472
2276c5e3d7 from review: add a comment why try_fold was chosen instead of fold 2021-07-27 00:14:19 +02:00
Chris Midgley
b21024f7b9 Add long explanation for E0544. 2021-07-26 22:59:16 +01:00
bors
8bebfe5cc2 Auto merge of #87480 - GuillaumeGomez:rollup-3ly8t5d, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #87436 (Suggest `;` on parse error where applicable)
 - #87444 (Flatten nested `format!` calls)
 - #87447 (Miri: santiy check that null pointer can never have an AllocId)
 - #87457 (freebsd remove compiler workaround.)
 - #87458 (Fix help message for modification to &T created by &{t})
 - #87464 (Remove unnecessary `structhead` parameter from `render_union`)
 - #87473 (Notify the Rust 2021 edition working group in zulip of edition bugs)
 - #87474 (Add missing whitespace after attribute in HTML template)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-26 21:50:24 +00:00
kadmin
8759f00c73 Actually infer args in visitors 2021-07-26 21:15:18 +00:00
Chris Midgley
cccd4e2a27 fix typo: whenver -> whenever 2021-07-26 22:12:35 +01:00
James Munns
beb9bb369a Integrate context into the memorial to Anna 2021-07-26 21:09:04 +02:00
bors
08095fc1f8 Auto merge of #87469 - sexxi-goose:union, r=nikomatsakis
2229: Don't capture preicese paths on top of a union

- Accessing fields of a union require unsafe block
- As part of 2229 we don't allow precision where we need an unsafe block
to capture.

Fixes: #87378

r? `@nikomatsakis`
2021-07-26 19:04:01 +00:00
Guillaume Gomez
12c2092adb
Rollup merge of #87474 - GuillaumeGomez:missing-whitespace-after-attr, r=notriddle
Add missing whitespace after attribute in HTML template

Firefox (even though it worked) highlights it as red when you look at the source code because there is a missing whitespace.

r? `@notriddle`
2021-07-26 16:04:39 +02:00
Guillaume Gomez
d94f554953
Rollup merge of #87473 - rylev:zulip-notify-edition-bugs, r=jyn514
Notify the Rust 2021 edition working group in zulip of edition bugs

Notifying the group of these issues will make it easier for us to track them.

r? `@jyn514`
2021-07-26 16:04:38 +02:00
Guillaume Gomez
434223c632
Rollup merge of #87464 - camelid:rm-union-structhead, r=jyn514
Remove unnecessary `structhead` parameter from `render_union`

`structhead` is used for `render_struct` so that the logic for rendering
structs can be shared between struct variants and struct items. However,
`render_union` is not used anywhere except for rendering union items, so
its `structhead` parameter is unnecessary.
2021-07-26 16:04:37 +02:00
Guillaume Gomez
f9d00b4a78
Rollup merge of #87458 - ibraheemdev:help-msg-block-borrow, r=oli-obk
Fix help message for modification to &T created by &{t}

Previous:
```rust
error[E0594]: cannot assign to `*x` which is behind a `&` reference
 --> src/main.rs:3:5
  |
2 |     let x: &usize = &mut{0};
  |                     ------- help: consider changing this to be a mutable reference: `&mut mut{0}`
3 |     *x = 1;
  |     ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written
```
2021-07-26 16:04:36 +02:00
Guillaume Gomez
e3c6cd23cf
Rollup merge of #87457 - devnexen:fbsd_remove_workaround, r=petrochenkov
freebsd remove compiler workaround.

related issue #43575
2021-07-26 16:04:35 +02:00
Guillaume Gomez
fc0b4848cb
Rollup merge of #87447 - RalfJung:not-null, r=oli-obk
Miri: santiy check that null pointer can never have an AllocId
2021-07-26 16:04:34 +02:00
Guillaume Gomez
b745a2881d
Rollup merge of #87444 - camelid:flatten-nested-format, r=jyn514
Flatten nested `format!` calls
2021-07-26 16:04:32 +02:00
Guillaume Gomez
4205077537
Rollup merge of #87436 - ebobrow:suggest-semicolon, r=oli-obk
Suggest `;` on parse error where applicable

fixes #87197
2021-07-26 16:04:26 +02:00
bors
fc24bcead1 Auto merge of #86696 - rust-lang:relnotes-1.54.0, r=pietroalbini
Update RELEASES.md for 1.54.0

### [Rendered](https://github.com/rust-lang/rust/blob/relnotes-1.54.0/RELEASES.md)

r? `@Mark-Simulacrum`
cc `@rust-lang/release`
2021-07-26 11:41:37 +00:00
Ryan Levick
79da09b14a Use correct syntax 2021-07-26 11:38:46 +02:00
Guillaume Gomez
b0e67d5e3a Add missing whitespace after attribute in HTML template 2021-07-26 11:37:34 +02:00
Guillaume Gomez
fbf78e1f9c Add test for enum item tuple fields documentation 2021-07-26 11:15:20 +02:00
Guillaume Gomez
2b790944a0 Add support for tuple struct fields documentation in enums as well 2021-07-26 11:15:20 +02:00
XAMPPRocky
9fc2bfafb1
Update RELEASES.md 2021-07-26 10:58:37 +02:00
bors
cfc856acf3 Auto merge of #87442 - mystor:patch-2, r=m-ou-se
Fix my email in .mailmap
2021-07-26 08:42:15 +00:00
Ryan Levick
d1b032f525 Notify the Rust 2021 edition working group in zulip of edition bugs 2021-07-26 10:31:28 +02:00
Aman Arora
75edcd9e07 2229: Don't capture preicese paths on top of a union
- Accessing fields of a union require unsafe block
- As part of 2229 we don't allow precision where we need an unsafe block
to capture.

Fixes: #87378

r? @nikomatsakis
2021-07-26 02:01:52 -04:00
bors
9cf1944217 Auto merge of #87439 - ThibsG:FixDocTypo, r=jonas-schievink
Fix doc typo

Just a typo in doc that has a bad rendering here: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/expr_use_visitor/struct.ExprUseVisitor.html#method.walk_captures
2021-07-26 05:51:40 +00:00
bors
3bcce82d14 Auto merge of #87424 - RalfJung:const-check, r=oli-obk
rename const checking visitor module to check_consts::check

This avoids naming ambiguities with "const validation" which is in `interpret/validity.rs` and checks *values*.

r? `@oli-obk`
2021-07-26 03:10:42 +00:00
Aaron Hill
87740bac64
Restrict field visibility 2021-07-25 20:43:27 -05:00
Aaron Hill
e6a5231238
Create QuerySideEffects and use it for diagnostics 2021-07-25 20:27:58 -05:00
bors
0ded6adf66 Auto merge of #87430 - devnexen:netbsd_ucred_enabled, r=joshtriplett
netbsd enabled ucred
2021-07-26 00:22:45 +00:00
Noah Lev
dbb978a3c6 Remove unnecessary structhead parameter from render_union
`structhead` is used for `render_struct` so that the logic for rendering
structs can be shared between struct variants and struct items. However,
`render_union` is not used anywhere except for rendering union items, so
its `structhead` parameter is unnecessary.
2021-07-25 16:28:52 -07:00
bors
5782f01a51 Auto merge of #87390 - notriddle:notriddle/rustdoc-headers-patch, r=GuillaumeGomez
Rustdoc accessibility: use real headers for doc items

Part of #87059

Partially reverts #84703

Preview at: https://notriddle.com/notriddle-rustdoc-test/real-headers/std/index.html
2021-07-25 21:41:57 +00:00
bors
76a3b609d0 Rustdoc accessibility: use real headers for doc items
Part of #87059

Partially reverts #84703

Preview at: https://notriddle.com/notriddle-rustdoc-test/real-headers/std/index.html
2021-07-25 21:41:57 +00:00
Guillaume Gomez
19f30b72b3 Add test for tuple struct documentation fields 2021-07-25 21:19:21 +02:00
Guillaume Gomez
ec76b6eedd Add support for tuple structs' fields documentation 2021-07-25 21:19:21 +02:00
bors
9c25eb7aa3 Auto merge of #86595 - a1phyr:allocator_api_for_vecdeque, r=Amanieu
Add support for custom allocator in `VecDeque`

This follows the [roadmap](https://github.com/rust-lang/wg-allocators/issues/7) of the allocator WG to add custom allocators to collections.

`@rustbot` modify labels: +A-allocators +T-libs
2021-07-25 19:01:10 +00:00
Benoît du Garreau
8987b74164 Fix failing test 2021-07-25 20:34:08 +02:00
ibraheemdev
b4a873f548 fmt 2021-07-25 13:35:06 -04:00
ibraheemdev
70f282d469 fix help message for modification to &T created by &{t} 2021-07-25 13:17:47 -04:00
David Carlier
76d1453b5b freebsd remove compiler workaround.
related issue #43575
2021-07-25 17:38:44 +01:00
bors
478126c0f3 Auto merge of #86438 - FabianWolff:issue-83693, r=jackh726
Fix the ICE described in #83693

This pull request fixes #83693 and fixes #84768.
2021-07-25 16:17:58 +00:00
ibraheemdev
880e691542 fix test/ui/borrowck/issue-33819 2021-07-25 10:56:13 -04:00
ibraheemdev
30df151be7 tidy 2021-07-25 10:38:12 -04:00
ibraheemdev
e8238a78df suggest removing unnecessary \&mut as help message 2021-07-25 10:24:37 -04:00
bors
70f74719a9 Auto merge of #85646 - Moxinilian:separate-const-switch, r=cjgillot
MIR opt: separate constant predecessors of a switch

For each block S ending with a switch, this pass copies S for each of S's predecessors that seem to assign the value being switched over as a const. This is done using a somewhat simple heuristic to determine what seems to be a const transitively.

More precisely, this is what the pass does:
- find a block that ends in a switch
- track if there is an unique place set before the current basic block that determines the result of the switch (this is the part that resolves switching over discriminants)
- if there is, iterate over the parents that have a reasonable terminator and find if the found determining place is likely to be (transitively) set from a const within that parent block
- if so, add the corresponding edge to a vector of edges to duplicate
- once this is done, iterate over the found edges: copy the target block and replace the reference to the target block in the origin block with the new block

This pass is not optimal and could probably duplicate in more cases, but the intention was mostly to address cases like in #85133 or #85365, to avoid creating new enums that get destroyed immediately afterwards (notably making the new try v2 `?` desugar zero-cost).

A benefit of this pass working the way it does is that it is easy to ensure its correctness: the worst that can happen is for it to needlessly copy a basic block, which is likely to be destroyed by cleanup passes afterwards. The complex parts where aliasing matters are only heuristics and the hard work is left to further passes like ConstProp.

# LLVM blocker

Unfortunately, I believe it would be unwise to enable this optimization by default for now. Indeed, currently switch lowering passes like SimplifyCFG in LLVM lose the information on the set of possible variant values, which means it tends to actually generate worse code with this optimization enabled. A fix would have to be done in LLVM itself. This is something I also want to look into. I have opened [a bug report at the LLVM bug tracker](https://bugs.llvm.org/show_bug.cgi?id=50455).

When this is done, I hope we can enable this pass by default. It should be fairly fast and I think it is beneficial in many cases. Notably, it should be a sound alternative to simplify-arm-identity. By the way, ConstProp only seems to pick up the optimization in functions that are not generic. This is however most likely an issue in ConstProp that I will look into afterwards.

This is my first contribution to rustc, and I would like to thank everyone on the Zulip mir-opt chat for the help and support, and especially `@scottmcm` for the guidance.
2021-07-25 13:51:48 +00:00
bors
6489ee1041 Auto merge of #83723 - cjgillot:ownernode, r=petrochenkov
Store all HIR owners in the same container

This replaces the previous storage in a BTreeMap for each of Item/ImplItem/TraitItem/ForeignItem.
This should allow for a more compact storage.

Based on https://github.com/rust-lang/rust/pull/83114
2021-07-25 11:11:02 +00:00
Camille GILLOT
f798510d02 Only check macro attributes when checking the crate root. 2021-07-25 12:23:37 +02:00
Camille GILLOT
da43aa61c1 Bless tests. 2021-07-25 12:23:37 +02:00
Camille GILLOT
6709648d17 Use more of OwnerNode. 2021-07-25 12:23:37 +02:00
Camille GILLOT
b88083a58c Use OwnerNode in indexing. 2021-07-25 12:23:36 +02:00