]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #93673 - jsha:linkify-sidebar-headings, r=GuillaumeGomez
Mara Bos [Mon, 7 Feb 2022 14:08:35 +0000 (14:08 +0000)]
Rollup merge of #93673 - jsha:linkify-sidebar-headings, r=GuillaumeGomez

Linkify sidebar headings for sibling items

Also adjust CSS so this doesn't produce excess padding/margin.

Note: I tried and failed to write a test with browser-UI-test. First I tried to `assert-property: (".block.mod h3 a", {"href": "index.html#macros"})`. But the `href` that gets read out is the fully-quallified URL, starting with `file:///`. That URL will differ depending on what path the test is run from, so that doesn't work.

Next I tried clicking on the appropriate sidebar link, and verifying that the appropriate heading on the next page is highlighted with the right background color. However, that also didn't work: according to browser-UI-test, the targeted heading was plain white. However, running with no-headless, I could see that it actually was yellow. I suspect this is a bug in the older version of Chromium used with browser-UI-test's bundled puppeteer, since it doesn't reproduce on latest Chrome.

Fixes #92957

Demo: https://rustdoc.crud.net/jsha/linkify-sidebar-headings/std/string/trait.ToString.html

r? ``@GuillaumeGomez``

2 years agoRollup merge of #93487 - yerke:yerke/fix-link-toolchain-in-setup, r=Mark-Simulacrum
Mara Bos [Mon, 7 Feb 2022 14:08:34 +0000 (14:08 +0000)]
Rollup merge of #93487 - yerke:yerke/fix-link-toolchain-in-setup, r=Mark-Simulacrum

Fix linking stage1 toolchain in `./x.py setup`

Closes [92319](https://github.com/rust-lang/rust/issues/92319)

Fix linking stage1 toolchain in `./x.py setup`. I guess this can be considered a follow up to https://github.com/rust-lang/rust/pull/89212 by `````@Sl1mb0.`````

We create 2 directories and 1 file that are required by rustup to [link a custom toolchain from path](https://github.com/rust-lang/rustup/blob/5225e87a5d974ab5f1626bcb2a7b43f76ab883f0/src/toolchain.rs#L479-L497).

cc `````@jyn514````` and `````@Mark-Simulacrum````` as they were active in https://github.com/rust-lang/rust/issues/89206

2 years agoRollup merge of #93416 - name1e5s:chore/remove_allow_fail, r=m-ou-se
Mara Bos [Mon, 7 Feb 2022 14:08:34 +0000 (14:08 +0000)]
Rollup merge of #93416 - name1e5s:chore/remove_allow_fail, r=m-ou-se

remove `allow_fail` test flag

close #93345

2 years agoRollup merge of #93394 - m-ou-se:fix-93378, r=estebank
Mara Bos [Mon, 7 Feb 2022 14:08:33 +0000 (14:08 +0000)]
Rollup merge of #93394 - m-ou-se:fix-93378, r=estebank

Don't allow {} to refer to implicit captures in format_args.

Fixes #93378

2 years agoRollup merge of #93208 - kellerkindt:wrapping_int_assign_impl, r=m-ou-se
Mara Bos [Mon, 7 Feb 2022 14:08:32 +0000 (14:08 +0000)]
Rollup merge of #93208 - kellerkindt:wrapping_int_assign_impl, r=m-ou-se

Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0

Tracking issue #93204

This is about adding basic integer operations to the `Wrapping` type:

```rust
let mut value = Wrapping(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;
```

Because this adds stable impls on a stable type, it runs into the following issue if an `#[unstable(...)]` attribute is used:

```
an `#[unstable]` annotation here has no effect
note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information
```

This means - if I understood this correctly - the new impls have to be stabilized instantly.
Which in turn means, this PR has to kick of an FCP on the tracking issue as well?

This impl is analog to 1c0dc1810d778bb6fea16aac02cafc5aa2e84b11 #92356 for the `Saturating` type ``@dtolnay``  ``@Mark-Simulacrum``

2 years agoRollup merge of #92724 - inteon:cleanup, r=Mark-Simulacrum
Mara Bos [Mon, 7 Feb 2022 14:08:32 +0000 (14:08 +0000)]
Rollup merge of #92724 - inteon:cleanup, r=Mark-Simulacrum

Cleanup c_str.rs

Some code cleanups in `c_str.rs`.
No functional changes.

ref: https://github.com/bytecodealliance/rustix/pull/163

2 years agoRollup merge of #91530 - bobrippling:suggest-1-tuple-parens, r=camelid
Mara Bos [Mon, 7 Feb 2022 14:08:31 +0000 (14:08 +0000)]
Rollup merge of #91530 - bobrippling:suggest-1-tuple-parens, r=camelid

Suggest 1-tuple parentheses on exprs without existing parens

A follow-on from #86116, split out from #90677.

This alters the suggestion to add a trailing comma to create a 1-tuple - previously we would only apply this if the relevant expression was parenthesised. We now make the suggestion regardless of parentheses, which reduces the fragility of the check (w.r.t formatting).

e.g.
```rust
let a: Option<(i32,)> = Some(3);
```

gets the below suggestion:

```rust
let a: Option<(i32,)> = Some((3,));
//                           ^ ^^
```

This change also improves the suggestion in other ways, such as by only making the suggestion if the types would match after the suggestion is applied and making the suggestion a multipart suggestion.

2 years agoRollup merge of #88313 - jyn514:pre-push, r=Mark-Simulacrum
Mara Bos [Mon, 7 Feb 2022 14:08:29 +0000 (14:08 +0000)]
Rollup merge of #88313 - jyn514:pre-push, r=Mark-Simulacrum

Make the pre-commit script pre-push instead

This should make it substantially less annoying, and hopefully more
people will find it useful. In particular, it will no longer run tidy
each time you run `git commit --amend` or rebase a branch.

This also warns if you have the old script in pre-commit; see the HACK
comment for details.

r? ````@Mark-Simulacrum```` cc ````@caass````

2 years agoStabilize wrapping_int_assign_impl in 1.60.0.
Mara Bos [Mon, 7 Feb 2022 10:45:12 +0000 (11:45 +0100)]
Stabilize wrapping_int_assign_impl in 1.60.0.

2 years agoAuto merge of #93643 - lcnr:fold-substs-perf, r=michaelwoerister
bors [Mon, 7 Feb 2022 03:47:47 +0000 (03:47 +0000)]
Auto merge of #93643 - lcnr:fold-substs-perf, r=michaelwoerister

use `fold_list` in `try_super_fold_with` for `SubstsRef`

split out from #93505 as this by itself is responsible for most of the perf improvements there

r? `@michaelwoerister`

2 years agoAuto merge of #93179 - Urgau:unreachable-2021, r=m-ou-se,oli-obk
bors [Mon, 7 Feb 2022 00:26:52 +0000 (00:26 +0000)]
Auto merge of #93179 - Urgau:unreachable-2021, r=m-ou-se,oli-obk

Fix invalid special casing of the unreachable! macro

This pull-request fix an invalid special casing of the `unreachable!` macro in the same way the `panic!` macro was solved, by adding two new internal only macros `unreachable_2015` and `unreachable_2021` edition dependent and turn `unreachable!` into a built-in macro that do dispatching. This logic is stolen from the `panic!` macro.

~~This pull-request also adds an internal feature `format_args_capture_non_literal` that allows capturing arguments from formatted string that expanded from macros. The original RFC #2795 mentioned this as a future possibility. This feature is [required](https://github.com/rust-lang/rust/issues/92137#issuecomment-1018630522) because of concatenation that needs to be done inside the macro:~~
```rust
$crate::concat!("internal error: entered unreachable code: ", $fmt)
```

**In summary** the new behavior for the `unreachable!` macro with this pr is:

Edition 2021:
```rust
let x = 5;
unreachable!("x is {x}");
```
```
internal error: entered unreachable code: x is 5
```

Edition <= 2018:
```rust
let x = 5;
unreachable!("x is {x}");
```
```
internal error: entered unreachable code: x is {x}
```

Also note that the change in this PR are **insta-stable** and **breaking changes** but this a considered as being a [bug](https://github.com/rust-lang/rust/issues/92137#issuecomment-998441613).
If someone could start a perf run and then a crater run this would be appreciated.

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

2 years agoAuto merge of #93695 - matthiaskrgr:rollup-zslgooo, r=matthiaskrgr
bors [Sun, 6 Feb 2022 21:41:00 +0000 (21:41 +0000)]
Auto merge of #93695 - matthiaskrgr:rollup-zslgooo, r=matthiaskrgr

Rollup of 2 pull requests

Successful merges:

 - #90998 (Require const stability attribute on all stable functions that are `const`)
 - #93489 (Mark the panic_no_unwind lang item as nounwind)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoMerge duplicate suggestion string
Rob Pilling [Wed, 2 Feb 2022 22:22:13 +0000 (22:22 +0000)]
Merge duplicate suggestion string

2 years agoFactor out emit_tuple_wrap_err, improve Applicability
Rob Pilling [Wed, 2 Feb 2022 22:18:36 +0000 (22:18 +0000)]
Factor out emit_tuple_wrap_err, improve Applicability

2 years agorewrite from_bytes_with_nul to match code style in from_vec_with_nul
Inteon [Sun, 6 Feb 2022 19:07:03 +0000 (20:07 +0100)]
rewrite from_bytes_with_nul to match code style in from_vec_with_nul

Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2 years agoRollup merge of #93489 - Amanieu:panic_no_unwind, r=nagisa
Matthias Krüger [Sun, 6 Feb 2022 09:43:51 +0000 (10:43 +0100)]
Rollup merge of #93489 - Amanieu:panic_no_unwind, r=nagisa

Mark the panic_no_unwind lang item as nounwind

This has 2 effects:
- It helps LLVM when inlining since it doesn't need to generate landing pads for `panic_no_unwind`.
- It makes it sound for a panic handler to unwind even if `PanicInfo::can_unwind` returns true. This will simply cause another panic once the unwind tries to go past the `panic_no_unwind` lang item. Eventually this will cause a stack overflow, which is safe.

2 years agoRollup merge of #90998 - jhpratt:require-const-stability, r=oli-obk
Matthias Krüger [Sun, 6 Feb 2022 09:43:50 +0000 (10:43 +0100)]
Rollup merge of #90998 - jhpratt:require-const-stability, r=oli-obk

Require const stability attribute on all stable functions that are `const`

This PR requires all stable functions (of all kinds) that are `const fn` to have a `#[rustc_const_stable]` or `#[rustc_const_unstable]` attribute. Stability was previously implied if omitted; a follow-up PR is planned to change the fallback to be unstable.

2 years agoAuto merge of #90414 - thomcc:count-chars-faster, r=nagisa
bors [Sun, 6 Feb 2022 08:34:48 +0000 (08:34 +0000)]
Auto merge of #90414 - thomcc:count-chars-faster, r=nagisa

Optimize `core::str::Chars::count`

I wrote this a while ago after seeing this function as a bottleneck in a profile, but never got around to contributing it. I saw it again, and so here it is. The implementation is fairly complex, but I tried to explain what's happening at both a high level (in the header comment for the file), and in line comments in the impl. Hopefully it's clear enough.

This implementation (`case00_cur_libcore` in the benchmarks below) is somewhat consistently around 4x to 5x faster than the old implementation (`case01_old_libcore` in the benchmarks below), for a wide variety of workloads, without regressing performance on any of the workload sizes I've tried.

I also improved the benchmarks for this code, so that they explicitly check text in different languages and of different sizes (err, the cross product of language x size). The results of the benchmarks are here:

<details>
<summary>Benchmark results</summary>
<pre>
test str::char_count::emoji_huge::case00_cur_libcore       ... bench:      20,216 ns/iter (+/- 3,673) = 17931 MB/s
test str::char_count::emoji_huge::case01_old_libcore       ... bench:     108,851 ns/iter (+/- 12,777) = 3330 MB/s
test str::char_count::emoji_huge::case02_iter_increment    ... bench:     329,502 ns/iter (+/- 4,163) = 1100 MB/s
test str::char_count::emoji_huge::case03_manual_char_len   ... bench:     223,333 ns/iter (+/- 14,167) = 1623 MB/s
test str::char_count::emoji_large::case00_cur_libcore      ... bench:         293 ns/iter (+/- 6) = 19331 MB/s
test str::char_count::emoji_large::case01_old_libcore      ... bench:       1,681 ns/iter (+/- 28) = 3369 MB/s
test str::char_count::emoji_large::case02_iter_increment   ... bench:       5,166 ns/iter (+/- 85) = 1096 MB/s
test str::char_count::emoji_large::case03_manual_char_len  ... bench:       3,476 ns/iter (+/- 62) = 1629 MB/s
test str::char_count::emoji_medium::case00_cur_libcore     ... bench:          48 ns/iter (+/- 0) = 14750 MB/s
test str::char_count::emoji_medium::case01_old_libcore     ... bench:         217 ns/iter (+/- 4) = 3262 MB/s
test str::char_count::emoji_medium::case02_iter_increment  ... bench:         642 ns/iter (+/- 7) = 1102 MB/s
test str::char_count::emoji_medium::case03_manual_char_len ... bench:         445 ns/iter (+/- 3) = 1591 MB/s
test str::char_count::emoji_small::case00_cur_libcore      ... bench:          18 ns/iter (+/- 0) = 3777 MB/s
test str::char_count::emoji_small::case01_old_libcore      ... bench:          23 ns/iter (+/- 0) = 2956 MB/s
test str::char_count::emoji_small::case02_iter_increment   ... bench:          66 ns/iter (+/- 2) = 1030 MB/s
test str::char_count::emoji_small::case03_manual_char_len  ... bench:          29 ns/iter (+/- 1) = 2344 MB/s
test str::char_count::en_huge::case00_cur_libcore          ... bench:      25,909 ns/iter (+/- 39,260) = 13299 MB/s
test str::char_count::en_huge::case01_old_libcore          ... bench:     102,887 ns/iter (+/- 3,257) = 3349 MB/s
test str::char_count::en_huge::case02_iter_increment       ... bench:     166,370 ns/iter (+/- 12,439) = 2071 MB/s
test str::char_count::en_huge::case03_manual_char_len      ... bench:     166,332 ns/iter (+/- 4,262) = 2071 MB/s
test str::char_count::en_large::case00_cur_libcore         ... bench:         281 ns/iter (+/- 6) = 19160 MB/s
test str::char_count::en_large::case01_old_libcore         ... bench:       1,598 ns/iter (+/- 19) = 3369 MB/s
test str::char_count::en_large::case02_iter_increment      ... bench:       2,598 ns/iter (+/- 167) = 2072 MB/s
test str::char_count::en_large::case03_manual_char_len     ... bench:       2,578 ns/iter (+/- 55) = 2088 MB/s
test str::char_count::en_medium::case00_cur_libcore        ... bench:          44 ns/iter (+/- 1) = 15295 MB/s
test str::char_count::en_medium::case01_old_libcore        ... bench:         201 ns/iter (+/- 51) = 3348 MB/s
test str::char_count::en_medium::case02_iter_increment     ... bench:         322 ns/iter (+/- 40) = 2090 MB/s
test str::char_count::en_medium::case03_manual_char_len    ... bench:         319 ns/iter (+/- 5) = 2109 MB/s
test str::char_count::en_small::case00_cur_libcore         ... bench:          15 ns/iter (+/- 0) = 2333 MB/s
test str::char_count::en_small::case01_old_libcore         ... bench:          14 ns/iter (+/- 0) = 2500 MB/s
test str::char_count::en_small::case02_iter_increment      ... bench:          30 ns/iter (+/- 1) = 1166 MB/s
test str::char_count::en_small::case03_manual_char_len     ... bench:          30 ns/iter (+/- 1) = 1166 MB/s
test str::char_count::ru_huge::case00_cur_libcore          ... bench:      16,439 ns/iter (+/- 3,105) = 19777 MB/s
test str::char_count::ru_huge::case01_old_libcore          ... bench:      89,480 ns/iter (+/- 2,555) = 3633 MB/s
test str::char_count::ru_huge::case02_iter_increment       ... bench:     217,703 ns/iter (+/- 22,185) = 1493 MB/s
test str::char_count::ru_huge::case03_manual_char_len      ... bench:     157,330 ns/iter (+/- 19,188) = 2066 MB/s
test str::char_count::ru_large::case00_cur_libcore         ... bench:         243 ns/iter (+/- 6) = 20905 MB/s
test str::char_count::ru_large::case01_old_libcore         ... bench:       1,384 ns/iter (+/- 51) = 3670 MB/s
test str::char_count::ru_large::case02_iter_increment      ... bench:       3,381 ns/iter (+/- 543) = 1502 MB/s
test str::char_count::ru_large::case03_manual_char_len     ... bench:       2,423 ns/iter (+/- 429) = 2096 MB/s
test str::char_count::ru_medium::case00_cur_libcore        ... bench:          42 ns/iter (+/- 1) = 15119 MB/s
test str::char_count::ru_medium::case01_old_libcore        ... bench:         180 ns/iter (+/- 4) = 3527 MB/s
test str::char_count::ru_medium::case02_iter_increment     ... bench:         402 ns/iter (+/- 45) = 1579 MB/s
test str::char_count::ru_medium::case03_manual_char_len    ... bench:         280 ns/iter (+/- 29) = 2267 MB/s
test str::char_count::ru_small::case00_cur_libcore         ... bench:          12 ns/iter (+/- 0) = 2666 MB/s
test str::char_count::ru_small::case01_old_libcore         ... bench:          12 ns/iter (+/- 0) = 2666 MB/s
test str::char_count::ru_small::case02_iter_increment      ... bench:          19 ns/iter (+/- 0) = 1684 MB/s
test str::char_count::ru_small::case03_manual_char_len     ... bench:          14 ns/iter (+/- 1) = 2285 MB/s
test str::char_count::zh_huge::case00_cur_libcore          ... bench:      15,053 ns/iter (+/- 2,640) = 20067 MB/s
test str::char_count::zh_huge::case01_old_libcore          ... bench:      82,622 ns/iter (+/- 3,602) = 3656 MB/s
test str::char_count::zh_huge::case02_iter_increment       ... bench:     230,456 ns/iter (+/- 7,246) = 1310 MB/s
test str::char_count::zh_huge::case03_manual_char_len      ... bench:     220,595 ns/iter (+/- 11,624) = 1369 MB/s
test str::char_count::zh_large::case00_cur_libcore         ... bench:         227 ns/iter (+/- 65) = 20792 MB/s
test str::char_count::zh_large::case01_old_libcore         ... bench:       1,136 ns/iter (+/- 144) = 4154 MB/s
test str::char_count::zh_large::case02_iter_increment      ... bench:       3,147 ns/iter (+/- 253) = 1499 MB/s
test str::char_count::zh_large::case03_manual_char_len     ... bench:       2,993 ns/iter (+/- 400) = 1577 MB/s
test str::char_count::zh_medium::case00_cur_libcore        ... bench:          36 ns/iter (+/- 5) = 16388 MB/s
test str::char_count::zh_medium::case01_old_libcore        ... bench:         142 ns/iter (+/- 18) = 4154 MB/s
test str::char_count::zh_medium::case02_iter_increment     ... bench:         379 ns/iter (+/- 37) = 1556 MB/s
test str::char_count::zh_medium::case03_manual_char_len    ... bench:         364 ns/iter (+/- 51) = 1620 MB/s
test str::char_count::zh_small::case00_cur_libcore         ... bench:          11 ns/iter (+/- 1) = 3000 MB/s
test str::char_count::zh_small::case01_old_libcore         ... bench:          11 ns/iter (+/- 1) = 3000 MB/s
test str::char_count::zh_small::case02_iter_increment      ... bench:          20 ns/iter (+/- 3) = 1650 MB/s
</pre>
</details>

I also added fairly thorough tests for different sizes and alignments. This completes on my machine in 0.02s, which is surprising given how thorough they are, but it seems to detect bugs in the implementation. (I haven't run the tests on a 32 bit machine yet since before I reworked the code a little though, so... hopefully I'm not about to embarrass myself).

This uses similar SWAR-style techniques to the `is_ascii` impl I contributed in https://github.com/rust-lang/rust/pull/74066, so I'm going to request review from the same person who reviewed that one. That said am not particularly picky, and might not have the correct syntax for requesting a review from someone (so it goes).

r? `@nagisa`

2 years agoLinkify sidebar headings for sibling items
Jacob Hoffman-Andrews [Fri, 4 Feb 2022 06:50:32 +0000 (22:50 -0800)]
Linkify sidebar headings for sibling items

Also adjust CSS so this doesn't produce excess padding/margin.

2 years agoAuto merge of #93689 - matthiaskrgr:rollup-3pd1ept, r=matthiaskrgr
bors [Sun, 6 Feb 2022 05:54:07 +0000 (05:54 +0000)]
Auto merge of #93689 - matthiaskrgr:rollup-3pd1ept, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #91939 (Clarify error on casting larger integers to char)
 - #92300 (mips64-openwrt-linux-musl: Add Tier 3 target)
 - #92383 (Add new target armv7-unknown-linux-uclibceabi (softfloat))
 - #92651 (Remove "up here" arrow on item-infos)
 - #93556 (Change struct expr pretty printing to match rustfmt style)
 - #93649 (Add regression tests for issue 80309)
 - #93657 (Update CPU idle tracking for apple hosts)
 - #93659 (Refactor conditional)
 - #93669 (Resolve lifetimes for const generic defaults)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agofix linking stage1 toolchain in setup
Yerkebulan Tulibergenov [Sun, 6 Feb 2022 03:57:02 +0000 (19:57 -0800)]
fix linking stage1 toolchain in setup

2 years agoRollup merge of #93669 - compiler-errors:const-generic-args, r=lcnr
Matthias Krüger [Sun, 6 Feb 2022 03:13:36 +0000 (04:13 +0100)]
Rollup merge of #93669 - compiler-errors:const-generic-args, r=lcnr

Resolve lifetimes for const generic defaults

We weren't visiting the const generic default argument in `rustc_resolve::late::lifetimes`. This seems to fix the issue, and we deny any non-`'static` lifetimes anyways.

Fixes #93647

2 years agoRollup merge of #93659 - UltiRequiem:refactor_conditional_static_rustdoc, r=Guillaume...
Matthias Krüger [Sun, 6 Feb 2022 03:13:35 +0000 (04:13 +0100)]
Rollup merge of #93659 - UltiRequiem:refactor_conditional_static_rustdoc, r=GuillaumeGomez

Refactor conditional

Merge two `if` in just one.

2 years agoRollup merge of #93657 - Mark-Simulacrum:apple-measurement, r=pietroalbini
Matthias Krüger [Sun, 6 Feb 2022 03:13:34 +0000 (04:13 +0100)]
Rollup merge of #93657 - Mark-Simulacrum:apple-measurement, r=pietroalbini

Update CPU idle tracking for apple hosts

The previous setup did not properly consider hyperthreads (at least in local
testing), which likely skews CI results as well. The new code is both simpler
and hopefully will produce more accurate results; locally it matches behavior
of the Linux version of this script.

2 years agoRollup merge of #93649 - WaffleLapkin:regression_test_80309, r=oli-obk
Matthias Krüger [Sun, 6 Feb 2022 03:13:33 +0000 (04:13 +0100)]
Rollup merge of #93649 - WaffleLapkin:regression_test_80309, r=oli-obk

Add regression tests for issue 80309

Closes #80309 😝

I'm not sure where to put the tests, is `ui/issues` the right place for this kind of tests?

2 years agoRollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
Matthias Krüger [Sun, 6 Feb 2022 03:13:32 +0000 (04:13 +0100)]
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot

Change struct expr pretty printing to match rustfmt style

This PR backports trailing comma support from https://github.com/dtolnay/prettyplease into rustc_ast_pretty and uses it to improve the formatting of struct expressions.

Example:

```rust
macro_rules! stringify_expr {
    ($expr:expr) => {
        stringify!($expr)
    };
}

fn main() {
    println!("{}", stringify_expr!(Struct {
        a: Struct { b, c },
    }));
    println!("{}", stringify_expr!(Struct {
        aaaaaaaaaaAAAAAAAAAA,
        bbbbbbbbbb: Struct {
            ccccccccccCCCCCCCCCC,
            ddddddddddDDDDDDDDDD,
            eeeeeeeeeeEEEEEEEEEE,
        },
    }));
}
```

🤮 Before:

```console
Struct{a: Struct{b, c,},}
Struct{aaaaaaaaaaAAAAAAAAAA,
    bbbbbbbbbb:
        Struct{ccccccccccCCCCCCCCCC,
            ddddddddddDDDDDDDDDD,
            eeeeeeeeeeEEEEEEEEEE,},}
```

After:

```console
Struct { a: Struct { b, c } }
Struct {
    aaaaaaaaaaAAAAAAAAAA,
    bbbbbbbbbb: Struct {
        ccccccccccCCCCCCCCCC,
        ddddddddddDDDDDDDDDD,
        eeeeeeeeeeEEEEEEEEEE,
    },
}
```

2 years agoRollup merge of #92651 - jsha:impl-spacing, r=GuillaumeGomez
Matthias Krüger [Sun, 6 Feb 2022 03:13:31 +0000 (04:13 +0100)]
Rollup merge of #92651 - jsha:impl-spacing, r=GuillaumeGomez

Remove "up here" arrow on item-infos

Use spacing to distinguish what is related to a given heading.

This was originally introduced in #53043, in response to #51387. The arrow is a little distracting, and leads the item-info to not be aligned properly with the text below it.

Demo: https://rustdoc.crud.net/jsha/impl-spacing/std/string/struct.String.html

r? ``@GuillaumeGomez``

2 years agoRollup merge of #92383 - lancethepants:armv7-unknown-linux-uclibceabi, r=nagisa
Matthias Krüger [Sun, 6 Feb 2022 03:13:30 +0000 (04:13 +0100)]
Rollup merge of #92383 - lancethepants:armv7-unknown-linux-uclibceabi, r=nagisa

Add new target armv7-unknown-linux-uclibceabi (softfloat)

This adds the new target `armv7-unknown-linux-uclibceabi (softfloat)`. It is of course similar to `armv7-unknown-linux-uclibceabihf (hardfloat)` which was just recently added to rust except that it is `softfloat`.

My interest lies in the Broadcom BCM4707/4708/BCM4709 family, notably found in some Netgear and Asus consumer routers. The armv7 Cortex-A9 cpus found in these devices do not have an fpu or NEON support.

With this patch I've been able to bootstrap rustc, std and host tools `(extended = true)` to run on the target device for native compilation, allowing the target to be used as a development platform.

With the recent addition of `armv7-unknown-linux-uclibceabihf (hardfloat)` it looks like many of the edge cases of using the uclibc c-library are getting worked out nicely. I've been able to compile some complex projects. Some patching still needed in some crates, but getting there for sure.  I think `armv7-unknown-linux-uclibceabi` is ready to be a tier 3 target.

I use a cross-toolchain from my project to bootstrap rust.
https://github.com/lancethepants/tomatoware
The goal of this project is to create a native development environment with support for various languages.

2 years agoRollup merge of #92300 - Itus-Shield:mips64-openwrt, r=nagisa
Matthias Krüger [Sun, 6 Feb 2022 03:13:29 +0000 (04:13 +0100)]
Rollup merge of #92300 - Itus-Shield:mips64-openwrt, r=nagisa

mips64-openwrt-linux-musl: Add Tier 3 target

Tier 3 tuple for Mips64 OpenWrt toolchain.

This add first-time support for OpenWrt.  Future Tier3 targets will be added as I test them.

Signed-off-by: Donald Hoskins <grommish@gmail.com>
2 years agoRollup merge of #91939 - GKFX:feature-91866, r=cjgillot
Matthias Krüger [Sun, 6 Feb 2022 03:13:29 +0000 (04:13 +0100)]
Rollup merge of #91939 - GKFX:feature-91866, r=cjgillot

Clarify error on casting larger integers to char

Closes #91836 with changes to E0604.md and a `span_help`.

2 years agoAuto merge of #92535 - Amanieu:oom_hook_unwind, r=m-ou-se
bors [Sun, 6 Feb 2022 03:12:45 +0000 (03:12 +0000)]
Auto merge of #92535 - Amanieu:oom_hook_unwind, r=m-ou-se

Allow unwinding from OOM hooks

This is split off from #88098 and contains just the bare minimum to allow specifying a custom OOM hook with `set_alloc_error_hook` which unwinds instead of aborting.

See #88098 for an actual command-line flag which switches the default OOM behavior to unwind instead of aborting.

Previous perf results show a negligible impact on performance.

2 years agoUpdate llvm-project submodule
Amanieu d'Antras [Sat, 5 Feb 2022 21:00:23 +0000 (21:00 +0000)]
Update llvm-project submodule

2 years agoMark __rgl_oom and __rd_oom as "C-unwind"
Amanieu d'Antras [Mon, 4 Oct 2021 01:02:33 +0000 (02:02 +0100)]
Mark __rgl_oom and __rd_oom as "C-unwind"

2 years agoAllow handle_alloc_error to unwind
Amanieu d'Antras [Tue, 17 Aug 2021 21:34:15 +0000 (22:34 +0100)]
Allow handle_alloc_error to unwind

2 years agoFix comment grammar for `do_count_chars`
Thom Chiovoloni [Sat, 5 Feb 2022 19:17:10 +0000 (11:17 -0800)]
Fix comment grammar for `do_count_chars`

2 years agoRespond to review feedback, and improve implementation somewhat
Thom Chiovoloni [Tue, 1 Feb 2022 03:07:08 +0000 (19:07 -0800)]
Respond to review feedback, and improve implementation somewhat

2 years agoEnsure non-power-of-two sizes are tested in the Chars::count test
Thom Chiovoloni [Sat, 30 Oct 2021 21:04:49 +0000 (14:04 -0700)]
Ensure non-power-of-two sizes are tested in the Chars::count test

2 years agoFix zh::SMALL string in core::str benchmarks
Thom Chiovoloni [Sat, 30 Oct 2021 14:52:19 +0000 (07:52 -0700)]
Fix zh::SMALL string in core::str benchmarks

2 years agoOptimize `core::str::Chars::count`
Thom Chiovoloni [Sat, 30 Oct 2021 10:47:47 +0000 (03:47 -0700)]
Optimize `core::str::Chars::count`

2 years agoAuto merge of #93539 - petrochenkov:doclink, r=camelid,michaelwoerister
bors [Sat, 5 Feb 2022 18:27:06 +0000 (18:27 +0000)]
Auto merge of #93539 - petrochenkov:doclink, r=camelid,michaelwoerister

rustdoc: Collect traits in scope for foreign inherent impls

Inherent impls can be inlined for variety of reasons (impls of reexported types, impls available through `Deref`, impls inlined for unclear reasons like in https://github.com/rust-lang/rust/pull/88679#issuecomment-1023929480).
If an impl is inlined, then doc links in its comments are resolved and we may need the set of traits that are in scope at that impl's definition point.
So in this PR we simply collect traits in scope for *all* inherent impls from other crates if their `Self` type is public, which is very similar for the strategy for trait impls previously used in https://github.com/rust-lang/rust/pull/88679.

Fixes https://github.com/rust-lang/rust/issues/93476
Fixes https://github.com/rust-lang/rust/pull/88679#issuecomment-1026520300
Fixes https://github.com/rust-lang/rust/pull/88679#issuecomment-1023929480

2 years agoAuto merge of #93597 - GuillaumeGomez:update-browser-ui-test, r=jsha
bors [Sat, 5 Feb 2022 15:46:24 +0000 (15:46 +0000)]
Auto merge of #93597 - GuillaumeGomez:update-browser-ui-test, r=jsha

Update browser-ui-test version

The puppeteer version update is limited because new versions has some "interesting" flaws.

r? `@jsha`

2 years agoresolve lifetimes for const generic defaults
Michael Goulet [Sat, 5 Feb 2022 04:56:32 +0000 (20:56 -0800)]
resolve lifetimes for const generic defaults

2 years agoAuto merge of #93655 - matthiaskrgr:rollup-dm88b02, r=matthiaskrgr
bors [Sat, 5 Feb 2022 01:47:59 +0000 (01:47 +0000)]
Auto merge of #93655 - matthiaskrgr:rollup-dm88b02, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90132 (Stabilize `-Z instrument-coverage` as `-C instrument-coverage`)
 - #91589 (impl `Arc::unwrap_or_clone`)
 - #93495 (kmc-solid: Fix off-by-one error in `SystemTime::now`)
 - #93576 (Emit more valid HTML from rustdoc)
 - #93608 (Clean up `find_library_crate`)
 - #93612 (doc: use U+2212 for minus sign in integer MIN/MAX text)
 - #93615 (Fix `isize` optimization in `StableHasher` for big-endian architectures)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRefactor conditional
Eliaz Bobadilla [Fri, 4 Feb 2022 19:59:22 +0000 (14:59 -0500)]
Refactor conditional

2 years agoAdd new target armv7-unknown-linux-uclibceabi (softfloat)
lancethepants [Tue, 1 Feb 2022 21:52:59 +0000 (14:52 -0700)]
Add new target armv7-unknown-linux-uclibceabi (softfloat)

2 years agoUpdate CPU idle tracking for apple hosts
Mark Rousskov [Fri, 4 Feb 2022 18:44:24 +0000 (13:44 -0500)]
Update CPU idle tracking for apple hosts

The previous setup did not properly consider hyperthreads (at least in local
testing), which likely skews CI results as well. The new code is both simpler
and hopefully will produce more accurate results.

2 years agoSpecify min llvm version for issue 80309 regression tests
Maybe Waffle [Fri, 4 Feb 2022 18:18:56 +0000 (21:18 +0300)]
Specify min llvm version for issue 80309 regression tests

2 years agoRollup merge of #93615 - Kobzol:stable-hash-opt-endianness, r=the8472
Matthias Krüger [Fri, 4 Feb 2022 17:42:18 +0000 (18:42 +0100)]
Rollup merge of #93615 - Kobzol:stable-hash-opt-endianness, r=the8472

Fix `isize` optimization in `StableHasher` for big-endian architectures

This PR fixes a problem with the stable hash optimization introduced in https://github.com/rust-lang/rust/pull/93432. As `@michaelwoerister` has [found out](https://github.com/rust-lang/rust/pull/93432#issuecomment-1028756212), the original implementation wouldn't produce the same hash on little/big architectures.

r? `@the8472`

2 years agoRollup merge of #93612 - tspiteri:master, r=m-ou-se
Matthias Krüger [Fri, 4 Feb 2022 17:42:17 +0000 (18:42 +0100)]
Rollup merge of #93612 - tspiteri:master, r=m-ou-se

doc: use U+2212 for minus sign in integer MIN/MAX text

Closes #90793.

2 years agoRollup merge of #93608 - nnethercote:speed-up-find_library_crate, r=petrochenkov
Matthias Krüger [Fri, 4 Feb 2022 17:42:16 +0000 (18:42 +0100)]
Rollup merge of #93608 - nnethercote:speed-up-find_library_crate, r=petrochenkov

Clean up `find_library_crate`

Some clean-ups.

r? `@petrochenkov`

2 years agoRollup merge of #93576 - jsha:fix-rustdoc-html, r=GuillaumeGomez
Matthias Krüger [Fri, 4 Feb 2022 17:42:15 +0000 (18:42 +0100)]
Rollup merge of #93576 - jsha:fix-rustdoc-html, r=GuillaumeGomez

Emit more valid HTML from rustdoc

Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `<summary>` tags can't contain `<div>`s. That's easily fixed by changing out the `<div>`s for `<span>`s with `display: block`.

However, there's also a rule that `<span>`s can't contain heading elements. `<span>` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `<h3>` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements

We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`, etc. We turn that into a `<section>` rather than a `<span>` because `<section>` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section

After this change we get only three warnings from tidy, run on struct.String.html:

line 6 column 10790 - Warning: trimming empty <span>
line 1 column 1118 - Warning: <link> proprietary attribute "disabled"
line 1 column 1193 - Warning: <link> proprietary attribute "disabled"

The empty `<span>` is a known issue - there's a span in front of the search box to work around a strange Safari issue.

The `<link>` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute.

We can suppress those warnings with flags to tidy, and get a run that returns 0 (success):

```
tidy -o /dev/null -quiet --drop-empty-elements no --warn-proprietary-attributes no build/x86_64-unknown-linux-gnu/doc/std/string/trait.ToString.html
```

Note: this requires the latest version of tidy-html5, built from https://github.com/htacg/tidy-html5. Older versions (including the default version on Ubuntu 21.10) think `<section>` can't occur inside `<summary>`.

Demo: https://rustdoc.crud.net/jsha/fix-rustdoc-html/std/string/struct.String.html

r? `@GuillaumeGomez`

2 years agoRollup merge of #93495 - solid-rs:fix-kmc-solid-rtc-month, r=yaahc
Matthias Krüger [Fri, 4 Feb 2022 17:42:14 +0000 (18:42 +0100)]
Rollup merge of #93495 - solid-rs:fix-kmc-solid-rtc-month, r=yaahc

kmc-solid: Fix off-by-one error in `SystemTime::now`

Fixes a miscalculation of `SystemTime`  on the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

Unlike the identically-named libc counterpart `tm::tm_mon`, `SOLID_RTC_TIME::tm_mon` contains a 1-based month number.

2 years agoRollup merge of #91589 - derekdreery:arc_unwrap_or_clone, r=m-ou-se
Matthias Krüger [Fri, 4 Feb 2022 17:42:13 +0000 (18:42 +0100)]
Rollup merge of #91589 - derekdreery:arc_unwrap_or_clone, r=m-ou-se

impl `Arc::unwrap_or_clone`

The function gets the inner value, cloning only if necessary. The conversation started on [`irlo`](https://internals.rust-lang.org/t/arc-into-inner/15707). If the reviewer think the PR has potential to be merged, and does not need an RFC, then I will create the corresponding tracking issues and update the PR.

## Alternative names

 - `into_inner`
 - `make_owned`
 - `make_unique`
 - `take_*` (`take_inner`?)

2 years agoRollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser
Matthias Krüger [Fri, 4 Feb 2022 17:42:13 +0000 (18:42 +0100)]
Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser

Stabilize `-Z instrument-coverage` as `-C instrument-coverage`

(Tracking issue for `instrument-coverage`: https://github.com/rust-lang/rust/issues/79121)

This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.)

Many, many people have tested this support, and there are numerous reports of it working as expected.

Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option.

Addressing questions raised in the tracking issue:

> If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.)

This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration.

> The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline?

This stabilization PR depends on https://github.com/rust-lang/rust/pull/90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version).

> The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM.

Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement.

The [tracking issue](https://github.com/rust-lang/rust/issues/79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization.

The original `-Z instrument-coverage` support went through a compiler-team MCP at https://github.com/rust-lang/compiler-team/issues/278 . Based on that, `@pnkfelix` suggested that this needed a stabilization PR and a compiler-team FCP.

2 years agoAuto merge of #93654 - RalfJung:miri, r=RalfJung
bors [Fri, 4 Feb 2022 17:40:02 +0000 (17:40 +0000)]
Auto merge of #93654 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/93355
r? `@ghost`

2 years agoupdate miri
Ralf Jung [Fri, 4 Feb 2022 17:26:16 +0000 (18:26 +0100)]
update miri

2 years agodoc: use U+2212 for minus sign in integer MIN/MAX text
Trevor Spiteri [Fri, 4 Feb 2022 16:59:53 +0000 (17:59 +0100)]
doc: use U+2212 for minus sign in integer MIN/MAX text

2 years agoAdd regression tests for issue 80309
Maybe Waffle [Fri, 4 Feb 2022 14:11:51 +0000 (17:11 +0300)]
Add regression tests for issue 80309

2 years agoAuto merge of #93645 - matthiaskrgr:rollup-eua2621, r=matthiaskrgr
bors [Fri, 4 Feb 2022 14:33:00 +0000 (14:33 +0000)]
Auto merge of #93645 - matthiaskrgr:rollup-eua2621, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #92735 (Add crate filter parameter in URL)
 - #93402 (Windows: Disable LLVM crash dialog boxes.)
 - #93508 (Add rustdoc info to jsondocck output)
 - #93551 (Add package.json in gitignore)
 - #93555 (Link `try_exists` docs to `Path::exists`)
 - #93585 (Missing tests for #92630)
 - #93593 (Fix ret > 1 bound if shadowed by const)
 - #93630 (clippy::perf fixes)
 - #93631 (rustc_mir_dataflow: use iter::once instead of Some().into_iter)
 - #93632 (rustdoc: clippy::complexity fixes)
 - #93638 (rustdoc: remove unused Hash impl)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agorustdoc: Collect traits in scope for foreign inherent impls
Vadim Petrochenkov [Tue, 1 Feb 2022 07:37:30 +0000 (15:37 +0800)]
rustdoc: Collect traits in scope for foreign inherent impls

2 years agoRollup merge of #93638 - notriddle:notriddle/unused-hash, r=GuillaumeGomez
Matthias Krüger [Fri, 4 Feb 2022 13:59:08 +0000 (14:59 +0100)]
Rollup merge of #93638 - notriddle:notriddle/unused-hash, r=GuillaumeGomez

rustdoc: remove unused Hash impl

2 years agoRollup merge of #93632 - matthiaskrgr:rustdoclippy2, r=GuillaumeGomez
Matthias Krüger [Fri, 4 Feb 2022 13:59:07 +0000 (14:59 +0100)]
Rollup merge of #93632 - matthiaskrgr:rustdoclippy2, r=GuillaumeGomez

rustdoc: clippy::complexity fixes

clippy::map_flatten
clippy::clone_on_copy
clippy::useless_conversion
clippy::needless_arbitrary_self_type

2 years agoRollup merge of #93631 - notriddle:notriddle/cleanup-some-into-iter, r=oli-obk
Matthias Krüger [Fri, 4 Feb 2022 13:59:06 +0000 (14:59 +0100)]
Rollup merge of #93631 - notriddle:notriddle/cleanup-some-into-iter, r=oli-obk

rustc_mir_dataflow: use iter::once instead of Some().into_iter

2 years agoRollup merge of #93630 - matthiaskrgr:clipperf, r=oli-obk
Matthias Krüger [Fri, 4 Feb 2022 13:59:05 +0000 (14:59 +0100)]
Rollup merge of #93630 - matthiaskrgr:clipperf, r=oli-obk

clippy::perf fixes

single_char_pattern and to_string_in_format_args

2 years agoRollup merge of #93593 - JulianKnodt:master, r=oli-obk
Matthias Krüger [Fri, 4 Feb 2022 13:59:04 +0000 (14:59 +0100)]
Rollup merge of #93593 - JulianKnodt:master, r=oli-obk

Fix ret > 1 bound if shadowed by const

Prior to a change, it would only look at types in bounds. When it started looking for consts,
shadowing type variables with a const would cause an ICE, so now defer looking at consts only if
there are no types present.

cc ``````@compiler-errors``````
Should Fix #93553

2 years agoRollup merge of #93585 - tamaroning:add_tests_for_92630, r=m-ou-se
Matthias Krüger [Fri, 4 Feb 2022 13:59:03 +0000 (14:59 +0100)]
Rollup merge of #93585 - tamaroning:add_tests_for_92630, r=m-ou-se

Missing tests for #92630

fixes #93143

2 years agoRollup merge of #93555 - ChrisDenton:fs-try-exists-doc, r=Mark-Simulacrum
Matthias Krüger [Fri, 4 Feb 2022 13:59:02 +0000 (14:59 +0100)]
Rollup merge of #93555 - ChrisDenton:fs-try-exists-doc, r=Mark-Simulacrum

Link `try_exists` docs to `Path::exists`

Links to the existing `Path::exists` method from both `std::Path::try_exists` and `std::fs:try_exists`.

Tracking issue for `path_try_exists`: #83186

2 years agoRollup merge of #93551 - GuillaumeGomez:ignore-package-json, r=Mark-Simulacrum
Matthias Krüger [Fri, 4 Feb 2022 13:59:00 +0000 (14:59 +0100)]
Rollup merge of #93551 - GuillaumeGomez:ignore-package-json, r=Mark-Simulacrum

Add package.json in gitignore

It happened a few times (last one is https://github.com/rust-lang/rust/pull/93537/files#r796757998) so I think it's fine to ignore this file to prevent it to happen again in the future. :)

r? ```@Mark-Simulacrum```

2 years agoRollup merge of #93508 - CraftSpider:jsondocck-runtest-output, r=Mark-Simulacrum
Matthias Krüger [Fri, 4 Feb 2022 13:58:59 +0000 (14:58 +0100)]
Rollup merge of #93508 - CraftSpider:jsondocck-runtest-output, r=Mark-Simulacrum

Add rustdoc info to jsondocck output

Makes debugging issues in the generated output simpler by handling emitted logs and etc.

2 years agoRollup merge of #93402 - ehuss:llvm-dialog, r=michaelwoerister
Matthias Krüger [Fri, 4 Feb 2022 13:58:57 +0000 (14:58 +0100)]
Rollup merge of #93402 - ehuss:llvm-dialog, r=michaelwoerister

Windows: Disable LLVM crash dialog boxes.

This disables the crash dialog box on Windows. When LLVM hits an assertion, it will open a dialog box with Abort/Retry/Ignore. This is annoying on CI because CI will just hang until it times out (which can take hours).

Instead of opening a dialog box, it will print a message like this:

```
Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file D:\Proj\rust\rust\src\llvm-project\llvm\include\llvm/Support/Casting.h, line 255
```

Closes #92829

2 years agoRollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jsha
Matthias Krüger [Fri, 4 Feb 2022 13:58:56 +0000 (14:58 +0100)]
Rollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jsha

Add crate filter parameter in URL

Fixes #92621.

r? `@jsha`

2 years agoAdd comment in GUI test
Guillaume Gomez [Fri, 4 Feb 2022 10:11:03 +0000 (11:11 +0100)]
Add comment in GUI test

2 years agoUpdate browser-ui-test version
Guillaume Gomez [Wed, 2 Feb 2022 19:36:20 +0000 (20:36 +0100)]
Update browser-ui-test version

2 years agofold substs
lcnr [Fri, 4 Feb 2022 10:10:02 +0000 (11:10 +0100)]
fold substs

2 years agoAdd a comment about possible mismatches.
Nicholas Nethercote [Fri, 4 Feb 2022 02:08:21 +0000 (13:08 +1100)]
Add a comment about possible mismatches.

2 years agoRemove `staticlibs` local variable.
Nicholas Nethercote [Thu, 3 Feb 2022 22:56:18 +0000 (09:56 +1100)]
Remove `staticlibs` local variable.

2 years agoFix some tests to use -Cinstrument-coverage
Wesley Wiser [Fri, 4 Feb 2022 00:59:47 +0000 (19:59 -0500)]
Fix some tests to use -Cinstrument-coverage

2 years agoAdd missing const stability attributes
Jacob Pratt [Thu, 18 Nov 2021 02:08:16 +0000 (21:08 -0500)]
Add missing const stability attributes

2 years agoRequire const stability on all stable const items
Jacob Pratt [Thu, 18 Nov 2021 02:06:17 +0000 (21:06 -0500)]
Require const stability on all stable const items

This was supposed to be the case previously, but a missed method call
meant that trait impls were not checked.

2 years agorustdoc: remove unused Hash impl
Michael Howell [Fri, 4 Feb 2022 00:01:32 +0000 (17:01 -0700)]
rustdoc: remove unused Hash impl

2 years agoClean up `find_library_crate`.
Nicholas Nethercote [Thu, 3 Feb 2022 22:36:17 +0000 (09:36 +1100)]
Clean up `find_library_crate`.

By introducing prefix and suffix variables for all file types, and
renaming some variables.

2 years agorustdoc: clippy::complexity fixes
Matthias Krüger [Thu, 3 Feb 2022 21:28:19 +0000 (22:28 +0100)]
rustdoc: clippy::complexity fixes

clippy::map_flatten
clippy::clone_on_copy
clippy::useless_conversion
clippy::needless_arbitrary_self_type

2 years agoAdd GUI test for crate filter URL parameter
Guillaume Gomez [Mon, 10 Jan 2022 16:48:07 +0000 (17:48 +0100)]
Add GUI test for crate filter URL parameter

2 years agoUpdate tester to have FILTER_CRATE set to null if undefined.
Guillaume Gomez [Thu, 3 Feb 2022 21:43:02 +0000 (22:43 +0100)]
Update tester to have FILTER_CRATE set to null if undefined.

2 years agoAdd filter-crate URL parameter
Guillaume Gomez [Mon, 10 Jan 2022 13:57:43 +0000 (14:57 +0100)]
Add filter-crate URL parameter

2 years agorustc_mir_dataflow: use iter::once instead of Some().into_iter
Michael Howell [Thu, 3 Feb 2022 20:51:37 +0000 (13:51 -0700)]
rustc_mir_dataflow: use iter::once instead of Some().into_iter

2 years agoclippy::perf fixes
Matthias Krüger [Thu, 3 Feb 2022 20:44:47 +0000 (21:44 +0100)]
clippy::perf fixes

single_char_pattern and to_string_in_format_args

2 years agoBless all pretty printer tests and ui tests
David Tolnay [Sat, 22 Jan 2022 02:10:12 +0000 (18:10 -0800)]
Bless all pretty printer tests and ui tests

2 years agoChange struct expr pretty printing to match rustfmt style
David Tolnay [Fri, 21 Jan 2022 21:36:08 +0000 (13:36 -0800)]
Change struct expr pretty printing to match rustfmt style

2 years agoSupport offsetting the most recent break
David Tolnay [Fri, 21 Jan 2022 22:20:17 +0000 (14:20 -0800)]
Support offsetting the most recent break

2 years agoChange pp indent to signed to allow negative indents
David Tolnay [Fri, 21 Jan 2022 22:15:14 +0000 (14:15 -0800)]
Change pp indent to signed to allow negative indents

2 years agoAdd trailing comma support
David Tolnay [Fri, 21 Jan 2022 21:13:13 +0000 (13:13 -0800)]
Add trailing comma support

2 years agoAuto merge of #93621 - JohnTitor:rollup-1bcud0x, r=JohnTitor
bors [Thu, 3 Feb 2022 15:49:30 +0000 (15:49 +0000)]
Auto merge of #93621 - JohnTitor:rollup-1bcud0x, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #92310 (rustdoc: Fix ICE report)
 - #92802 (Deduplicate lines in long const-eval stack trace)
 - #93515 (Factor convenience functions out of main printer implementation)
 - #93566 (Make rustc use `RUST_BACKTRACE=full` by default)
 - #93589 (Use Option::then in two places)
 - #93600 (fix: Remove extra newlines from junit output)
 - #93606 (Correct incorrect description of preorder traversals)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix ret > 1 bound if shadowed by const
kadmin [Wed, 2 Feb 2022 16:42:37 +0000 (16:42 +0000)]
Fix ret > 1 bound if shadowed by const

Prior to a change, it would only look at types in bounds. When it started looking for consts,
shadowing type variables with a const would cause an ICE, so now defer looking at consts only if
there are no types present.

2 years agoOnly disable dialogs on CI.
Eric Huss [Thu, 3 Feb 2022 15:03:44 +0000 (07:03 -0800)]
Only disable dialogs on CI.

The "CI" environment var isn't universal (for example, I think Azure
uses TF_BUILD). However, we are mostly concerned with rust-lang/rust's
own CI which currently is GitHub Actions which does set "CI". And I
think most other providers use "CI" as well.

2 years agoRollup merge of #93606 - JakobDegen:mischaracterized-preorder, r=oli-obk
Yuki Okushi [Thu, 3 Feb 2022 13:20:29 +0000 (22:20 +0900)]
Rollup merge of #93606 - JakobDegen:mischaracterized-preorder, r=oli-obk

Correct incorrect description of preorder traversals

The internal documentation for the `Preorder` type gave an incorrect description (the description is not even correct for the example provided, since C is visited after one of its successors). This corrects the description, and adds in a sentence explaining more precisely how the traversals are performed.

2 years agoRollup merge of #93600 - last-partizan:fix-junit-formatter, r=yaahc
Yuki Okushi [Thu, 3 Feb 2022 13:20:28 +0000 (22:20 +0900)]
Rollup merge of #93600 - last-partizan:fix-junit-formatter, r=yaahc

fix: Remove extra newlines from junit output

This PR fixes extra newline in junit output https://github.com/rust-lang/rust/issues/93454

2 years agoRollup merge of #93589 - est31:option_then, r=cjgillot
Yuki Okushi [Thu, 3 Feb 2022 13:20:27 +0000 (22:20 +0900)]
Rollup merge of #93589 - est31:option_then, r=cjgillot

Use Option::then in two places

2 years agoRollup merge of #93566 - Aaron1011:rustc-backtrace, r=davidtwco
Yuki Okushi [Thu, 3 Feb 2022 13:20:26 +0000 (22:20 +0900)]
Rollup merge of #93566 - Aaron1011:rustc-backtrace, r=davidtwco

Make rustc use `RUST_BACKTRACE=full` by default

Compiler panics should be rare - when they do occur, we want the report
filed by the user to contain as much information as possible. This is
especially important when the panic is due to an incremental compilation
bug, since we may not have enough information to reproduce it.

This PR sets `RUST_BACKTRACE=full` inside `rustc` if the user has not
explicitly set `RUST_BACKTRACE`. This is more verbose than
`RUST_BACKTRACE=1`, but this may make it easier to debug incremental
compilation issues. Users who find this too verbose can still manually
set `RUST_BACKTRACE` before invoking the compiler.

This only affects `rustc` (and any tool using `rustc_driver::install_ice_hook`).
It does *not* affect any user crates or the standard library -
backtraces will continue to be off by default in any application
*compiled* by rustc.

2 years agoRollup merge of #93515 - dtolnay:convenience, r=davidtwco
Yuki Okushi [Thu, 3 Feb 2022 13:20:25 +0000 (22:20 +0900)]
Rollup merge of #93515 - dtolnay:convenience, r=davidtwco

Factor convenience functions out of main printer implementation

The pretty printer in rustc_ast_pretty has a section of methods commented "Convenience functions to talk to the printer". This PR pulls those out to a separate module. This leaves pp.rs with only the minimal API that is core to the pretty printing algorithm.

I found this separation to be helpful in https://github.com/dtolnay/prettyplease because it makes clear when changes are adding some fundamental new capability to the pretty printer algorithm vs just making it more convenient to call some already existing functionality.