Commit graph

150154 commits

Author SHA1 Message Date
bors
4573a4a879 Auto merge of #86383 - shamatar:slice_len_lowering, r=bjorn3
Add MIR pass to lower call to `core::slice::len` into `Len` operand

During some larger experiment with range analysis I've found that code like `let l = slice.len()` produces different MIR then one found in bound checks. This optimization pass replaces terminators that are calls to `core::slice::len` with just a MIR operand and Goto terminator.

It uses some heuristics to remove the outer borrow that is made to call `core::slice::len`, but I assume it can be eliminated, just didn't find how.

Would like to express my gratitude to `@oli-obk` who helped me a lot on Zullip
2021-06-21 22:24:13 +00:00
bors
406d4a9cc3 Auto merge of #86515 - JohnTitor:rollup-axzb4xh, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #86192 (Make OR_PATTERNS_BACK_COMPAT be a 2021 future-incompatible lint)
 - #86248 (Add a regression test for issue-85113)
 - #86274 (Spaces)
 - #86349 (Add regression test for issue #78632)
 - #86424 (rustfmt: load nested out-of-line mods correctly)
 - #86472 (Fix CI to fetch master on beta channel)
 - #86473 (Rustdoc: Account for const-unstable functions)
 - #86495 (Improve `proc_macro::{Punct, Spacing}` documentation)
 - #86503 (Fix rust.css fonts.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-21 19:36:04 +00:00
Yuki Okushi
599e8a7439
Rollup merge of #86503 - ehuss:rustc.css-fonts, r=jyn514,GuillaumeGomez
Fix rust.css fonts.

The `rust.css` file (used for all non-rustdoc and non-mdbook pages) has gotten out of sync with rustdoc's css. The two share the same fonts, so this updates them to match what rustdoc uses.

It would be ideal not to need this at all, but that's for another time.
2021-06-22 00:00:45 +09:00
Yuki Okushi
2fdc2eab76
Rollup merge of #86495 - r00ster91:patch-11, r=petrochenkov
Improve `proc_macro::{Punct, Spacing}` documentation

I noticed some misspellings and then thought I could improve it a bit overall.
2021-06-22 00:00:44 +09:00
Yuki Okushi
f3fe5c3ba1
Rollup merge of #86473 - fee1-dead:rustdoc-const-unstable, r=jyn514
Rustdoc: Account for const-unstable functions

Fixes #86464
2021-06-22 00:00:43 +09:00
Yuki Okushi
9c664b2321
Rollup merge of #86472 - Mark-Simulacrum:fix-ci-beta, r=pietroalbini
Fix CI to fetch master on beta channel

This forward-ports a fix from the beta channel (landing in #86413, hopefully) to master so that we don't need to apply it on each round of backports.

This bug also demonstrates that our channel-checking is a bit insufficient -- stable is checked, but beta has some of its own peculiarities currently and isn't checked. But this does not attempt to adjust for that; we likely can't afford to run both beta and stable channels by CI and the current state here seems OK for now.

r? `@pietroalbini`
2021-06-22 00:00:42 +09:00
Yuki Okushi
a81f55fb16
Rollup merge of #86424 - calebcartwright:rustfmt-mod-resolution, r=Mark-Simulacrum
rustfmt: load nested out-of-line mods correctly

This should address https://github.com/rust-lang/rustfmt/issues/4874

r? `@Mark-Simulacrum`

Decided to make the change directly in tree here for expediency/to minimize any potential backporting issues, and because there's some subtree sync items I need to get resolved before pulling from r-l/rustfmt
2021-06-22 00:00:41 +09:00
Yuki Okushi
aba0bed466
Rollup merge of #86349 - yerke:add-test-for-issue-78632, r=Mark-Simulacrum
Add regression test for issue #78632

Add regression test for issue #78632

Closes #78632

Took this test from #78632 (what was committed to glacier in https://github.com/rust-lang/rust/issues/78632#issuecomment-731843345).

Tested that the we get ICE on 1.52.1 on the playground (https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b86d51fee4cded9d24b50d8ecbc48c6a).
2021-06-22 00:00:40 +09:00
Yuki Okushi
58e7411092
Rollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3
Spaces
2021-06-22 00:00:38 +09:00
Yuki Okushi
ac410564f0
Rollup merge of #86248 - JohnTitor:issue-85113, r=Mark-Simulacrum
Add a regression test for issue-85113

Fixed by #86118, closes #85113
2021-06-22 00:00:37 +09:00
Yuki Okushi
3ee78b38fe
Rollup merge of #86192 - hi-rustin:rustin-patch-lint, r=nikomatsakis
Make OR_PATTERNS_BACK_COMPAT be a 2021 future-incompatible lint

close https://github.com/rust-lang/rust/issues/84869

r? `@nikomatsakis`
2021-06-22 00:00:36 +09:00
Deadbeef
b57077bbf0
Readd unsafe keyword in tests 2021-06-21 20:42:57 +08:00
Deadbeef
f82fb308af
Update comment regarding staged_api 2021-06-21 20:21:37 +08:00
bors
6a5b97adb4 Auto merge of #86210 - ehuss:rustfix-update, r=Mark-Simulacrum
Rustfix update

This updates to rustfix 0.6.0. One of the key changes here is https://github.com/rust-lang/rustfix/pull/195 which changes rustfix to apply multi-part suggestions. One of the tests needs to updated because there are some overlapping suggestions which rustfix cannot handle. The solution is to only apply the machine-applicable suggestions to avoid the overlapping issue.

This also includes a minor change to compiletest to provide better error messages with rustfix.
2021-06-21 12:21:19 +00:00
Deadbeef
0d69a02c31
Removed/Updated some cases and simplified match 2021-06-21 20:15:27 +08:00
Deadbeef
c4396f476e
Added some tests for unsafe in const-dispay.rs 2021-06-21 19:17:07 +08:00
Deadbeef
5fb27bca6c
Check for const_unstable before printing const 2021-06-21 19:06:21 +08:00
bors
9d93819fa7 Auto merge of #86157 - jsha:tera, r=jyn514,GuillaumeGomez
Use Tera templates for rustdoc.

Replaces a format!() call in layout::render with a template
expansion. Introduces a `templates` field in SharedContext so parts
of rustdoc can share pre-rendered templates.

This currently builds in a copy of the single template available, like
with static files. However, future work can make this live-loadable with
a perma-unstable flag, to make rustdoc developers' work easier.

Part of #84419.

Demo at https://hoffman-andrews.com/rust/tera/std/string/struct.String.html.
2021-06-21 09:40:34 +00:00
Alexander Melentyev
e84c9aed6d Delete spaces 2021-06-21 12:11:37 +03:00
bors
d789de67dc Auto merge of #85775 - adamrk:warn-unused-target-fields, r=nagisa
Emit warnings for unused fields in custom targets.

Add a warning which lists any fields in a custom target `json` file that aren't used. Currently unrecognized fields are ignored so, for example, a typo in the `json` will silently produce a target which isn't the one intended.
2021-06-21 06:56:51 +00:00
Jacob Hoffman-Andrews
cd0f93193c Use Tera templates for rustdoc.
Replaces a format!() call in layout::render with a template
expansion. Introduces a `templates` field in SharedContext so parts
of rustdoc can share pre-rendered templates.

This currently builds in a copy of the single template available, like
with static files. However, future work can make this live-loadable with
a perma-unstable flag, to make rustdoc developers' work easier.
2021-06-20 23:07:28 -07:00
bors
3824017f8e Auto merge of #86166 - tmiasko:no-alloca-for-zsts, r=nagisa
Do not emit alloca for ZST locals with multiple assignments

This extends 35566bfd7d to additionally stop emitting unnecessary allocas for zero sized locals that are assigned multiple times.

When rebuilding the standard library with `-Zbuild-std` this reduces the number of locals that require an allocation from 62315 to 61767.
2021-06-21 04:03:51 +00:00
bors
6a540bd40c Auto merge of #86502 - JohnTitor:rollup-wge0f3x, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #83739 (Account for bad placeholder errors on consts/statics with trait objects)
 - #85637 (document PartialEq, PartialOrd, Ord requirements more explicitly)
 - #86152 (Lazify is_really_default condition in the RustdocGUI bootstrap step)
 - #86156 (Fix a bug in the linkchecker)
 - #86427 (Updated release note)
 - #86452 (fix panic-safety in specialized Zip::next_back)
 - #86484 (Do not set depth to 0 in fully_expand_fragment)
 - #86491 (expand: Move some more derive logic to rustc_builtin_macros)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-21 01:16:15 +00:00
Eric Huss
008d4d6c11 Fix rust.css fonts. 2021-06-20 18:15:54 -07:00
Yuki Okushi
8b9e138ecd
Rollup merge of #86491 - petrochenkov:derefact, r=Aaron1011
expand: Move some more derive logic to rustc_builtin_macros

And cleanup some `unwrap`s in `cfg_eval`.

Refactorings extracted from https://github.com/rust-lang/rust/pull/83354 and https://github.com/rust-lang/rust/pull/86057.
r? ``@Aaron1011``
2021-06-21 09:42:19 +09:00
Yuki Okushi
e5ecded392
Rollup merge of #86484 - fee1-dead:builtin-macro-recursion, r=petrochenkov
Do not set depth to 0 in fully_expand_fragment

Fixes #84632.
2021-06-21 09:42:18 +09:00
Yuki Okushi
504c378159
Rollup merge of #86452 - the8472:fix-zip-drop-safety, r=m-ou-se
fix panic-safety in specialized Zip::next_back

This was unsound since a panic in a.next_back() would result in the
length not being updated which would then lead to the same element
being revisited in the side-effect preserving code.

fixes #86443
2021-06-21 09:42:17 +09:00
Yuki Okushi
13b0f1a29b
Rollup merge of #86427 - hi-rustin:rustin-patch-release-note, r=Mark-Simulacrum
Updated release note

close https://github.com/rust-lang/rust/issues/77098

base on https://github.com/rust-lang/rust/pull/78690
2021-06-21 09:42:16 +09:00
Yuki Okushi
e435e3259d
Rollup merge of #86156 - ehuss:linkchecker-fixes, r=Mark-Simulacrum
Fix a bug in the linkchecker

There was a small typo in the linkchecker (in #85652) that caused it to report a `#` fragment link error pointing to the wrong file (it was displaying the path to the source file, not the target of the link).

This also includes a few other changes:
- Fixes the tests due to some changes in the redirect handling in #84703.
- Adds the tests to rustbuild to run whenever the linkchecker itself is run.
- Updates the tests to validate more of the output (so that a mistake like this would have been caught).

Closes #86144
2021-06-21 09:42:15 +09:00
Yuki Okushi
e7a4f1e3fc
Rollup merge of #86152 - the8472:lazify-npm-queries, r=Mark-Simulacrum
Lazify is_really_default condition in the RustdocGUI bootstrap step

The `RustdocGUI::should_run` condition spawns `npm list` several times which adds up to seconds of wall-time.
Evaluate the condition lazily to to keep `./x.py test tidy` and similar short-running tasks fast.

Fixes #86147
2021-06-21 09:42:15 +09:00
Yuki Okushi
e6732e05e4
Rollup merge of #85637 - RalfJung:partial-ord, r=m-ou-se
document PartialEq, PartialOrd, Ord requirements more explicitly

This is the result of discussion in https://github.com/rust-lang/rust/issues/50230, in particular [this summary comment](https://github.com/rust-lang/rust/issues/50230#issuecomment-392819364).

Fixes https://github.com/rust-lang/rust/issues/50230.
2021-06-21 09:42:13 +09:00
Yuki Okushi
1a1909a8a6
Rollup merge of #83739 - JohnTitor:issue-75889, r=estebank
Account for bad placeholder errors on consts/statics with trait objects

Fixes #75889
r? ``@estebank``
2021-06-21 09:42:12 +09:00
Eric Huss
35bf1becaa tidy: Check that cargo and compiletest share the same rustfix. 2021-06-20 16:36:26 -07:00
Eric Huss
f2ef8bf776 compiletest: display the error if rustfix fails 2021-06-20 16:35:14 -07:00
Eric Huss
2817be94cc Update rustfix for compiletest. 2021-06-20 16:35:14 -07:00
bors
03b845a41f Auto merge of #85980 - ssomers:btree_cleanup_LeafRange, r=Mark-Simulacrum
BTree: encapsulate LeafRange better & some debug asserts

Looking at iterators again, I think #81937 didn't house enough code in `LeafRange`. Moving the API boundary a little makes things more local in navigate.rs and less complicated in map.rs.

r? `@Mark-Simulacrum`
2021-06-20 22:52:49 +00:00
Mark Rousskov
61b453cd1a Fix CI to fetch master on beta channel 2021-06-20 16:20:08 -04:00
r00ster91
f804d8d71b Improve documentation 2021-06-20 22:19:47 +02:00
bors
e82b65026d Auto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum
Replace some `std::iter::repeat` with `str::repeat`

I noticed that there were some instances where `std::iter::repeat` would be used to repeat a string or a char to take a specific count of it and then collect it into a `String` when `str::repeat` is actually much faster and better for that.

See also: https://github.com/rust-lang/rust-clippy/issues/7260.
2021-06-20 20:07:13 +00:00
Deadbeef
37d0d2705d
Do not set depth to 0 in fully_expand_fragment 2021-06-21 02:05:37 +08:00
bors
dd941450fb Auto merge of #84967 - CDirkx:os_str_ext, r=m-ou-se
Move `OsStringExt` and `OsStrExt` to `std::os`

Moves the `OsStringExt` and `OsStrExt` traits and implementations from `sys_common` to `os`. `sys_common` is for abstractions over `sys` and shouldn't really contain publicly exported items.

This does introduce some duplication: the traits and implementations are now duplicated in `unix`, `wasi`, `hermit`, and `sgx`. However, I would argue that this duplication is no different to how something like `MetadataExt` is duplicated in `linux`, `vxworkx`, `redox`, `solaris` etc. The duplication also matches the fact that the traits on different platforms are technically distinct types: any platform is free to add it's own extra methods to the extension trait.
2021-06-20 16:42:13 +00:00
Vadim Petrochenkov
d9fd5eaae8 cfg_eval: Replace multiple unwraps with a single unwrap 2021-06-20 18:54:45 +03:00
Vadim Petrochenkov
3f0729f378 expand: Move some more derive logic to rustc_builtin_macros 2021-06-20 18:48:42 +03:00
Alex Vlasov
aa53928ed7 Squashed implementation of the pass 2021-06-20 16:09:42 +02:00
bors
2e940ac5e9 Auto merge of #86250 - RalfJung:intrinsic_operation_unsafety, r=oli-obk
fix intrinsic_operation_unsafety comment
2021-06-20 14:01:26 +00:00
bors
75d1500f02 Auto merge of #86486 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/86474
2021-06-20 11:20:39 +00:00
Ralf Jung
dbb8d1a804 update Miri 2021-06-20 12:58:04 +02:00
The8472
b4734b7c38 disable test on platforms that don't support unwinding 2021-06-20 12:20:05 +02:00
Christiaan Dirkx
ad7b8975e0 Add comment to std::os::unix::ffi::os_str explaining that the module is reused on other platforms. 2021-06-20 12:06:19 +02:00
Christiaan Dirkx
835561ac5b Make os_str_bytes::{Buf, Slice} pub and repr(transparent) 2021-06-20 11:55:26 +02:00