]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #89770 - jkugelman:must-use-from-and-into, r=joshtriplett
bors [Tue, 12 Oct 2021 09:43:37 +0000 (09:43 +0000)]
Auto merge of #89770 - jkugelman:must-use-from-and-into, r=joshtriplett

Add #[must_use] to From::from and Into::into

Risk of churn: **High**
Magic 8-Ball says: **Outlook not so good**

I figured I'd put this out there. If we don't do it now maybe we save it for a rainy day.

Parent issue: #89692

r? `@joshtriplett`

2 years agoAuto merge of #89769 - jkugelman:must-use-maybe-uninit-new, r=joshtriplett
bors [Tue, 12 Oct 2021 07:02:53 +0000 (07:02 +0000)]
Auto merge of #89769 - jkugelman:must-use-maybe-uninit-new, r=joshtriplett

Add #[must_use] to MaybeUninit::new

As discussed in https://github.com/rust-lang/rust/pull/89729#issuecomment-939775659.

Parent issue: #89692

r? `@joshtriplett`

2 years agoAuto merge of #88788 - falk-hueffner:speedup-int-log10-branchless, r=joshtriplett
bors [Tue, 12 Oct 2021 03:18:54 +0000 (03:18 +0000)]
Auto merge of #88788 - falk-hueffner:speedup-int-log10-branchless, r=joshtriplett

Speedup int log10 branchless

This is achieved with a branchless bit-twiddling implementation of the case x < 100_000, and using this as building block.

Benchmark on an Intel i7-8700K (Coffee Lake):

```
name                                   old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
num::int_log::u8_log10_predictable     165          169                     4    2.42%   x 0.98
num::int_log::u8_log10_random          438          423                   -15   -3.42%   x 1.04
num::int_log::u8_log10_random_small    438          423                   -15   -3.42%   x 1.04
num::int_log::u16_log10_predictable    633          417                  -216  -34.12%   x 1.52
num::int_log::u16_log10_random         908          471                  -437  -48.13%   x 1.93
num::int_log::u16_log10_random_small   945          471                  -474  -50.16%   x 2.01
num::int_log::u32_log10_predictable    1,496        1,340                -156  -10.43%   x 1.12
num::int_log::u32_log10_random         1,076        873                  -203  -18.87%   x 1.23
num::int_log::u32_log10_random_small   1,145        874                  -271  -23.67%   x 1.31
num::int_log::u64_log10_predictable    4,005        3,171                -834  -20.82%   x 1.26
num::int_log::u64_log10_random         1,247        1,021                -226  -18.12%   x 1.22
num::int_log::u64_log10_random_small   1,265        921                  -344  -27.19%   x 1.37
num::int_log::u128_log10_predictable   39,667       39,579                -88   -0.22%   x 1.00
num::int_log::u128_log10_random        6,456        6,696                 240    3.72%   x 0.96
num::int_log::u128_log10_random_small  4,108        3,903                -205   -4.99%   x 1.05
```

Benchmark on an M1 Mac Mini:

```
name                                   old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
num::int_log::u8_log10_predictable     143          130                   -13   -9.09%   x 1.10
num::int_log::u8_log10_random          375          325                   -50  -13.33%   x 1.15
num::int_log::u8_log10_random_small    376          325                   -51  -13.56%   x 1.16
num::int_log::u16_log10_predictable    500          322                  -178  -35.60%   x 1.55
num::int_log::u16_log10_random         794          405                  -389  -48.99%   x 1.96
num::int_log::u16_log10_random_small   1,035        405                  -630  -60.87%   x 2.56
num::int_log::u32_log10_predictable    1,144        894                  -250  -21.85%   x 1.28
num::int_log::u32_log10_random         832          786                   -46   -5.53%   x 1.06
num::int_log::u32_log10_random_small   832          787                   -45   -5.41%   x 1.06
num::int_log::u64_log10_predictable    2,681        2,057                -624  -23.27%   x 1.30
num::int_log::u64_log10_random         1,015        806                  -209  -20.59%   x 1.26
num::int_log::u64_log10_random_small   1,004        795                  -209  -20.82%   x 1.26
num::int_log::u128_log10_predictable   56,825       56,526               -299   -0.53%   x 1.01
num::int_log::u128_log10_random        9,056        8,861                -195   -2.15%   x 1.02
num::int_log::u128_log10_random_small  1,528        1,527                  -1   -0.07%   x 1.00
```

The 128 bit case remains ridiculously slow because llvm fails to optimize division by a constant 128-bit value to multiplications. This could be worked around but it seems preferable to fix this in llvm.

From u32 up, table lookup (like suggested [here](https://github.com/rust-lang/rust/issues/70887#issuecomment-881099813)) is still faster, but requires a hardware `leading_zeros` to be viable, and might clog up the cache.

2 years agoAuto merge of #89791 - matthiaskrgr:rollup-1lhxh5b, r=matthiaskrgr
bors [Tue, 12 Oct 2021 00:20:34 +0000 (00:20 +0000)]
Auto merge of #89791 - matthiaskrgr:rollup-1lhxh5b, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #89471 (Use Ancestory to check default fn in const impl instead of comparing idents)
 - #89643 (Fix inherent impl overlap check.)
 - #89651 (Add `Poll::ready` and revert stabilization of `task::ready!`)
 - #89675 (Re-use TypeChecker instead of passing around some of its fields )
 - #89710 (Add long explanation for error E0482)
 - #89756 (Greatly reduce amount of debuginfo compiled for bootstrap itself)
 - #89760 (Remove hack ignoring unused attributes for stage 0 std)
 - #89772 (Fix function-names test for GDB 10.1)
 - #89785 (Fix ICE when compiling nightly std/rustc on beta compiler)

Failed merges:

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

2 years agoAdd #[must_use] to From::from and Into::into
John Kugelman [Mon, 11 Oct 2021 14:13:50 +0000 (10:13 -0400)]
Add #[must_use] to From::from and Into::into

2 years agoRollup merge of #89785 - nbdd0121:master, r=Mark-Simulacrum
Matthias Krüger [Mon, 11 Oct 2021 21:45:53 +0000 (23:45 +0200)]
Rollup merge of #89785 - nbdd0121:master, r=Mark-Simulacrum

Fix ICE when compiling nightly std/rustc on beta compiler

Fix #89775

#89479 renames a lot of diagnostic items, but it happens that the beta compiler assumes that there must be DefId with `rustc_diagnostic_item = "send_trait"`, causing an ICE when compiling stage 0 std or stage 1 compiler. So gate it with `cfg(bootstrap)`.

The unwrap is also removed, so that existence of the diagnostic item is not required. I ripgreped the code base and this seems the only place where `unwrap` is called on the return value of `get_diagnostic_item`.

2 years agoRollup merge of #89772 - michaelwoerister:fix-function-names-test-gdb, r=Mark-Simulacrum
Matthias Krüger [Mon, 11 Oct 2021 21:45:52 +0000 (23:45 +0200)]
Rollup merge of #89772 - michaelwoerister:fix-function-names-test-gdb, r=Mark-Simulacrum

Fix function-names test for GDB 10.1

This PR updates the test output in `src/test/debuginfo/function-names.rs` for GDB 10.1.

This should fix issue https://github.com/rust-lang/rust/issues/89750 -- but not the underlying problem of CI ignoring tests if not viable debugger happens to be present.

2 years agoRollup merge of #89760 - jyn514:remove-incremental-hack, r=Mark-Simulacrum
Matthias Krüger [Mon, 11 Oct 2021 21:45:51 +0000 (23:45 +0200)]
Rollup merge of #89760 - jyn514:remove-incremental-hack, r=Mark-Simulacrum

Remove hack ignoring unused attributes for stage 0 std

This seems to no longer be giving spurious errors when incremental is
enabled.

Closes https://github.com/rust-lang/rust/issues/58633.

2 years agoRollup merge of #89756 - jyn514:bootstrap-times, r=Mark-Simulacrum
Matthias Krüger [Mon, 11 Oct 2021 21:45:51 +0000 (23:45 +0200)]
Rollup merge of #89756 - jyn514:bootstrap-times, r=Mark-Simulacrum

Greatly reduce amount of debuginfo compiled for bootstrap itself

Rather than compiling rustbuild and all its dependencies with
`debuginfo=2`, this compiles dependencies without debuginfo and
rustbuild with `debuginfo=1`. On my laptop, this brings compile times
down from ~1:20 to ~1:05.

See also https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/async.20in.20bootstrap.3F/near/254847594.

r? ``@Mark-Simulacrum``

2 years agoRollup merge of #89710 - sireliah:e0482, r=GuillaumeGomez
Matthias Krüger [Mon, 11 Oct 2021 21:45:50 +0000 (23:45 +0200)]
Rollup merge of #89710 - sireliah:e0482, r=GuillaumeGomez

Add long explanation for error E0482

This is longer explanation for error E0482 in the #61137.

Please take a look and leave some feedback!

2 years agoRollup merge of #89675 - oli-obk:type_checker, r=davidtwco
Matthias Krüger [Mon, 11 Oct 2021 21:45:49 +0000 (23:45 +0200)]
Rollup merge of #89675 - oli-obk:type_checker, r=davidtwco

Re-use TypeChecker instead of passing around some of its fields

In the future (for lazy TAIT) we will need more of its fields, but even ignoring that, this change seems reasonable on its own to me.

2 years agoRollup merge of #89651 - ibraheemdev:poll-ready, r=dtolnay
Matthias Krüger [Mon, 11 Oct 2021 21:45:48 +0000 (23:45 +0200)]
Rollup merge of #89651 - ibraheemdev:poll-ready, r=dtolnay

Add `Poll::ready` and revert stabilization of `task::ready!`

This PR adds an inherent `ready` method to `Poll` that can be used with the `?` operator as an alternative to the `task::ready!` macro:
```rust
let val = ready!(fut.poll(cx));
let val = fut.poll(cx).ready()?;
```

I think this form is a nice, non-breaking middle ground between changing the `impl Try for Poll`, and adding a separate macro. It looks better than `ready!` in my opinion, and it composes well:

```rust
let elem = ready!(fut.poll(cx)).pop().unwrap();
let elem = fut.poll(cx).ready()?.pop().unwrap();
```

The planned stabilization of `ready!` in 1.56 has been reverted because I think this alternate approach is worth considering.

r? rust-lang/libs

2 years agoRollup merge of #89643 - cjgillot:overlap, r=matthewjasper
Matthias Krüger [Mon, 11 Oct 2021 21:45:46 +0000 (23:45 +0200)]
Rollup merge of #89643 - cjgillot:overlap, r=matthewjasper

Fix inherent impl overlap check.

The current implementation of the overlap check was slightly buggy, and unified the wrong connected component in the `ids.len() <= 1` case. This became visible in another PR which changed the iteration order of items.

r? ``@matthewjasper`` since you reviewed the other PR.

2 years agoRollup merge of #89471 - nbdd0121:const3, r=fee1-dead
Matthias Krüger [Mon, 11 Oct 2021 21:45:46 +0000 (23:45 +0200)]
Rollup merge of #89471 - nbdd0121:const3, r=fee1-dead

Use Ancestory to check default fn in const impl instead of comparing idents

Fixes https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Const.20trait.20impl.20inside.20macro

2 years agoAuto merge of #89648 - nbdd0121:issue-89606, r=nikomatsakis
bors [Mon, 11 Oct 2021 21:39:11 +0000 (21:39 +0000)]
Auto merge of #89648 - nbdd0121:issue-89606, r=nikomatsakis

Ignore type of projections for upvar capturing

Fix #89606

Ignore type of projections for upvar capturing. Originally HashMap is used, and the hash/eq implementation of Place takes the type of projections into account. These types may differ by lifetime which causes #89606 to ICE.

I originally considered erasing regions but `place.ty()` is used when creating upvar tuple type, more than just serving as a key type, so I switched to a linear comparison with custom eq (`compare_place_ignore_ty`) instead.

r? `@wesleywiser`

`@rustbot` label +T-compiler

2 years agoFix ICE 89775
Gary Guo [Mon, 11 Oct 2021 19:52:36 +0000 (20:52 +0100)]
Fix ICE 89775

2 years agoClarify the error descriptions
sireliah [Sun, 10 Oct 2021 12:58:12 +0000 (14:58 +0200)]
Clarify the error descriptions

2 years agoAdd library tracking issue for poll_ready feature
David Tolnay [Mon, 11 Oct 2021 19:17:41 +0000 (12:17 -0700)]
Add library tracking issue for poll_ready feature

2 years agoRemove task::ready! from 1.56.0 release notes
David Tolnay [Mon, 11 Oct 2021 19:06:32 +0000 (12:06 -0700)]
Remove task::ready! from 1.56.0 release notes

2 years agoUpdate library/core/src/mem/maybe_uninit.rs
John Kugelman [Mon, 11 Oct 2021 18:46:08 +0000 (14:46 -0400)]
Update library/core/src/mem/maybe_uninit.rs

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2 years agoSplit impl-with-default-fn test into a pass test and a fail test
Gary Guo [Mon, 11 Oct 2021 17:20:20 +0000 (18:20 +0100)]
Split impl-with-default-fn test into a pass test and a fail test

2 years agoUse Ancestory to check default fn in const impl instead of comparing idents
Gary Guo [Sat, 2 Oct 2021 18:02:22 +0000 (19:02 +0100)]
Use Ancestory to check default fn in const impl instead of comparing idents

2 years agoAuto merge of #83908 - Flying-Toast:master, r=davidtwco
bors [Mon, 11 Oct 2021 17:12:14 +0000 (17:12 +0000)]
Auto merge of #83908 - Flying-Toast:master, r=davidtwco

Add enum_intrinsics_non_enums lint

There is a clippy lint to prevent calling [`mem::discriminant`](https://doc.rust-lang.org/std/mem/fn.discriminant.html) with a non-enum type. I think the lint is worthy of being included in rustc, given that `discriminant::<T>()` where `T` is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this.

I've also made the lint check [variant_count](https://doc.rust-lang.org/core/mem/fn.variant_count.html) (#73662).

closes #83899

2 years agoFix function-names test for GDB 10.1
Michael Woerister [Mon, 11 Oct 2021 15:20:45 +0000 (17:20 +0200)]
Fix function-names test for GDB 10.1

2 years agoAuto merge of #89767 - GuillaumeGomez:rollup-sczixhk, r=GuillaumeGomez
bors [Mon, 11 Oct 2021 14:16:15 +0000 (14:16 +0000)]
Auto merge of #89767 - GuillaumeGomez:rollup-sczixhk, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #89655 (bootstrap: don't use `--merges` to look for commit hashes for downloading artifacts)
 - #89726 (Add #[must_use] to alloc constructors)
 - #89729 (Add #[must_use] to core and std constructors)
 - #89743 (Fix RUSTC_LOG handling)
 - #89753 (Add #[must_use] to from_value conversions)
 - #89754 (Cleanup .item-table CSS)
 - #89761 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agoAdd #[must_use] to MaybeUninit::new
John Kugelman [Mon, 11 Oct 2021 14:03:55 +0000 (10:03 -0400)]
Add #[must_use] to MaybeUninit::new

2 years agoRollup merge of #89761 - lnicola:rust-analyzer-2021-10-11, r=lnicola
Guillaume Gomez [Mon, 11 Oct 2021 12:11:46 +0000 (14:11 +0200)]
Rollup merge of #89761 - lnicola:rust-analyzer-2021-10-11, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #89754 - dns2utf8:rustdoc_cleanup_css, r=GuillaumeGomez
Guillaume Gomez [Mon, 11 Oct 2021 12:11:46 +0000 (14:11 +0200)]
Rollup merge of #89754 - dns2utf8:rustdoc_cleanup_css, r=GuillaumeGomez

Cleanup .item-table CSS

The main table-like element must be `display: table;`

r? `@GuillaumeGomez`

2 years agoRollup merge of #89753 - jkugelman:must-use-from_value-conversions, r=joshtriplett
Guillaume Gomez [Mon, 11 Oct 2021 12:11:45 +0000 (14:11 +0200)]
Rollup merge of #89753 - jkugelman:must-use-from_value-conversions, r=joshtriplett

Add #[must_use] to from_value conversions

I added two methods to the list myself. Clippy did not flag them because they take `mut` args, but neither modifies their argument.

```rust
core::str           const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str;
std::ffi::CString   unsafe fn from_raw(ptr: *mut c_char) -> CString;
```

I put a custom note on `from_raw`:

```rust
#[must_use = "call `drop(from_raw(ptr))` if you intend to drop the `CString`"]
pub unsafe fn from_raw(ptr: *mut c_char) -> CString {
```

Parent issue: #89692

r? ``@joshtriplett``

2 years agoRollup merge of #89743 - matthewjasper:env-log-fix, r=jyn514
Guillaume Gomez [Mon, 11 Oct 2021 12:11:44 +0000 (14:11 +0200)]
Rollup merge of #89743 - matthewjasper:env-log-fix, r=jyn514

Fix RUSTC_LOG handling

Rustc was incorrectly reading the value of `RUSTC_LOG` as the environment vairable with the logging configuration, rather than the logging configuration itself.

2 years agoRollup merge of #89729 - jkugelman:must-use-core-std-constructors, r=joshtriplett
Guillaume Gomez [Mon, 11 Oct 2021 12:11:43 +0000 (14:11 +0200)]
Rollup merge of #89729 - jkugelman:must-use-core-std-constructors, r=joshtriplett

Add #[must_use] to core and std constructors

Parent issue: #89692

r? ``@joshtriplett``

2 years agoRollup merge of #89726 - jkugelman:must-use-alloc-constructors, r=joshtriplett
Guillaume Gomez [Mon, 11 Oct 2021 12:11:42 +0000 (14:11 +0200)]
Rollup merge of #89726 - jkugelman:must-use-alloc-constructors, r=joshtriplett

Add #[must_use] to alloc constructors

Added `#[must_use]`. to the various forms of `new`, `pin`, and `with_capacity` in the `alloc` crate. No extra explanations given as I couldn't think of anything useful to add.

I figure this deserves extra scrutiny compared to the other PRs I've done so far. In particular:

* The 4 `pin`/`pin_in` methods I touched. Are there legitimate use cases for pinning and not using the result? Pinning's a difficult concept I'm not very comfortable with.
* `Box`'s constructors. Do people ever create boxes just for the side effects... allocating or zeroing out memory?

Parent issue: #89692

r? ``@joshtriplett``

2 years agoRollup merge of #89655 - tlyu:find-non-merge-commits, r=jyn514
Guillaume Gomez [Mon, 11 Oct 2021 12:11:41 +0000 (14:11 +0200)]
Rollup merge of #89655 - tlyu:find-non-merge-commits, r=jyn514

bootstrap: don't use `--merges` to look for commit hashes for downloading artifacts

Shallow clones (and possibly worktrees, though I can't seem to reproduce the problem there) can cause `git rev-list --merges` to falsely return no results, even if a merge commit is present. Stop using the `--merges` option when looking for commit hashes that have build artifacts. `--first-parent` and `--author=bors@rust-lang.org` should be sufficient.

Also exit with an error if the configuration asks for artifacts to be downloaded and we can't determine an appropriate commit hash to use to download artifacts.

Fixes #87890.

r? ``@jyn514``
``@rustbot`` label +A-rustbuild +A-contributor-roadblock

2 years agoAuto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov
bors [Mon, 11 Oct 2021 11:14:47 +0000 (11:14 +0000)]
Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov

Apply clippy suggestions for rustc and core

2 years agoCleanup .item-table CSS
Stefan Schindler [Sun, 10 Oct 2021 22:38:56 +0000 (00:38 +0200)]
Cleanup .item-table CSS

2 years agoDeprecate mem_discriminant_non_enum
flip1995 [Mon, 11 Oct 2021 08:10:16 +0000 (10:10 +0200)]
Deprecate mem_discriminant_non_enum

This lint has been uplifted and is now included in
enum_intrinsics_non_enums.

2 years agoAdd enum_intrinsics_non_enums lint
Flying-Toast [Sat, 31 Jul 2021 16:14:30 +0000 (12:14 -0400)]
Add enum_intrinsics_non_enums lint

2 years agoAuto merge of #89755 - jkugelman:must-use-conversions-that-move-self, r=joshtriplett
bors [Mon, 11 Oct 2021 07:27:44 +0000 (07:27 +0000)]
Auto merge of #89755 - jkugelman:must-use-conversions-that-move-self, r=joshtriplett

Add #[must_use] to conversions that move self

Everything here got the same message. Is the wording okay?

```rust
#[must_use = "`self` will be dropped if the result is not used"]
```

I want to draw attention to these methods in particular:

```rust
alloc::sync::Arc<MaybeUninit<T>>     unsafe fn assume_init(self) -> Arc<T>;
alloc::sync::Arc<[MaybeUninit<T>]>   unsafe fn assume_init(self) -> Arc<[T]>;
core::pin::Pin<&'a mut T>            const fn into_ref(self) -> Pin<&'a T>;
core::pin::Pin<&'a mut T>            const fn get_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T>            const unsafe fn get_unchecked_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T>            unsafe fn map_unchecked_mut(self, func: F) -> Pin<&'a mut U>;
core::pin::Pin<&'a mut Pin<P>>       fn as_deref_mut(self) -> Pin<&'a mut P::Target>;
```

Parent issue: #89692

r? `@joshtriplett`

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 11 Oct 2021 07:01:39 +0000 (10:01 +0300)]
:arrow_up: rust-analyzer

2 years agoRemove unnecessary variable
Clemens Wasser [Mon, 11 Oct 2021 06:11:30 +0000 (08:11 +0200)]
Remove unnecessary variable

2 years agoRemove hack ignoring unused attributes for stage 0 std
Joshua Nelson [Mon, 11 Oct 2021 04:50:12 +0000 (04:50 +0000)]
Remove hack ignoring unused attributes for stage 0 std

This seems to no longer be giving spurious errors when incremental is
enabled.

2 years agoAuto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser
bors [Mon, 11 Oct 2021 04:31:47 +0000 (04:31 +0000)]
Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser

Create more accurate debuginfo for vtables.

Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented.

This is only one of several possible improvements:
- This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits).
- The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object.

r? `@wesleywiser`

2 years agoGreatly reduce amount of debuginfo compiled for bootstrap itself
Joshua Nelson [Mon, 11 Oct 2021 02:16:01 +0000 (21:16 -0500)]
Greatly reduce amount of debuginfo compiled for bootstrap itself

Rather than compiling rustbuild and all its dependencies with
`debuginfo=2`, this compiles dependencies without debuginfo and
rustbuild with `debuginfo=1`. On my laptop, this brings compile times
down from ~1:20 to ~1:05.

2 years agoAuto merge of #89752 - matthiaskrgr:rollup-v4fgmwg, r=matthiaskrgr
bors [Mon, 11 Oct 2021 01:06:26 +0000 (01:06 +0000)]
Auto merge of #89752 - matthiaskrgr:rollup-v4fgmwg, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #89579 (Add regression test for issue 80108)
 - #89632 (Fix docblock code display on mobile)
 - #89691 (Move `DebuggerCommands` and `check_debugger_output` to a separate module)
 - #89707 (Apply clippy suggestions for std)
 - #89722 (Fix spelling: Cannonical -> Canonical)
 - #89736 (Remove unused CSS rule)

Failed merges:

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

2 years agoAdd #[must_use] to conversions that move self
John Kugelman [Sun, 10 Oct 2021 23:50:52 +0000 (19:50 -0400)]
Add #[must_use] to conversions that move self

2 years agoAdd #[must_use] to from_value conversions
John Kugelman [Sun, 10 Oct 2021 22:22:40 +0000 (18:22 -0400)]
Add #[must_use] to from_value conversions

2 years agoRollup merge of #89736 - GuillaumeGomez:rm-unused-css-rule, r=dns2utf8
Matthias Krüger [Sun, 10 Oct 2021 22:34:41 +0000 (00:34 +0200)]
Rollup merge of #89736 - GuillaumeGomez:rm-unused-css-rule, r=dns2utf8

Remove unused CSS rule

As you can see in the firefox devtools:

![Screenshot from 2021-10-10 14-28-08](https://user-images.githubusercontent.com/3050060/136695689-16c77ceb-b1ab-40df-963a-048f2258e217.png)

It needs the display to be `grid` or `inline-grid`, which isn't the case.

r? `@dns2utf8`

2 years agoRollup merge of #89722 - jkugelman:cannonical-typo, r=joshtriplett
Matthias Krüger [Sun, 10 Oct 2021 22:34:40 +0000 (00:34 +0200)]
Rollup merge of #89722 - jkugelman:cannonical-typo, r=joshtriplett

Fix spelling: Cannonical -> Canonical

2 years agoRollup merge of #89707 - clemenswasser:apply_clippy_suggestions, r=Mark-Simulacrum
Matthias Krüger [Sun, 10 Oct 2021 22:34:39 +0000 (00:34 +0200)]
Rollup merge of #89707 - clemenswasser:apply_clippy_suggestions, r=Mark-Simulacrum

Apply clippy suggestions for std

2 years agoRollup merge of #89691 - Nicholas-Baron:debugger_commands, r=Mark-Simulacrum
Matthias Krüger [Sun, 10 Oct 2021 22:34:38 +0000 (00:34 +0200)]
Rollup merge of #89691 - Nicholas-Baron:debugger_commands, r=Mark-Simulacrum

Move `DebuggerCommands` and `check_debugger_output` to a separate module

Work towards #89475.

As part of this move, the public functions were changed to return `Result`. This is so that the error handling that initially took `&self: TestCx` can still use that `TestCx`.

2 years agoRollup merge of #89632 - GuillaumeGomez:fix-docblock-code, r=jsha
Matthias Krüger [Sun, 10 Oct 2021 22:34:37 +0000 (00:34 +0200)]
Rollup merge of #89632 - GuillaumeGomez:fix-docblock-code, r=jsha

Fix docblock code display on mobile

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

Before:

![Screenshot from 2021-10-07 12-01-37](https://user-images.githubusercontent.com/3050060/136363624-72bedddd-b45e-48a0-89b4-6563612f8677.png)

After:

![Screenshot from 2021-10-07 20-17-21](https://user-images.githubusercontent.com/3050060/136440704-fa9ffa68-8e94-46a7-b556-c41aa5153750.png)

r? `@jsha`

2 years agoRollup merge of #89579 - workingjubilee:regression-test-80108, r=Mark-Simulacrum
Matthias Krüger [Sun, 10 Oct 2021 22:34:37 +0000 (00:34 +0200)]
Rollup merge of #89579 - workingjubilee:regression-test-80108, r=Mark-Simulacrum

Add regression test for issue 80108

Closes #80108

2 years agoAuto merge of #89541 - workingjubilee:abbrev-shufvec-t, r=Mark-Simulacrum
bors [Sun, 10 Oct 2021 22:25:49 +0000 (22:25 +0000)]
Auto merge of #89541 - workingjubilee:abbrev-shufvec-t, r=Mark-Simulacrum

Cleanup src/test/ui/{simd,simd-intrinsic}

Initial motivation was to simplify a huge macro expansion using a tuple, since we can just use an array in `#[repr(simd)]` now for the same result. But also, several tests were going unnoticed during development of SIMD intrinsics because people kept looking in the wrong directory, and many are basically run-pass vs. build-fail versions of the same tests, so let's keep them close together and simplify their names, so they're easier to sift through.

2 years agoAdd regression test for issue 80108
Jubilee Young [Tue, 5 Oct 2021 22:46:19 +0000 (15:46 -0700)]
Add regression test for issue 80108

2 years agoAuto merge of #89739 - matthiaskrgr:rollup-kskwqy5, r=matthiaskrgr
bors [Sun, 10 Oct 2021 19:05:13 +0000 (19:05 +0000)]
Auto merge of #89739 - matthiaskrgr:rollup-kskwqy5, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #88374 (Fix documentation in Cell)
 - #88713 (Improve docs for int_log)
 - #89428 (Feature gate the non_exhaustive_omitted_patterns lint)
 - #89438 (docs: `std::hash::Hash` should ensure prefix-free data)
 - #89520 (Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui)
 - #89705 (Cfg hide no_global_oom_handling and no_fp_fmt_parse)
 - #89713 (Fix ABNF of inline asm options)
 - #89718 (Add #[must_use] to is_condition tests)
 - #89719 (Add #[must_use] to char escape methods)
 - #89720 (Add #[must_use] to math and bit manipulation methods)
 - #89735 (Stabilize proc_macro::is_available)

Failed merges:

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

2 years agoFix RUSTC_LOG handling
Matthew Jasper [Sun, 10 Oct 2021 18:59:36 +0000 (19:59 +0100)]
Fix RUSTC_LOG handling

Rustc was incorrectly reading the value of `RUSTC_LOG` as the
environment vairable with the logging configuration, rather than the
logging configuration itself.

2 years agoRollup merge of #89735 - bjorn3:stabilize_proc_macro_is_available, r=petrochenkov
Matthias Krüger [Sun, 10 Oct 2021 16:22:26 +0000 (18:22 +0200)]
Rollup merge of #89735 - bjorn3:stabilize_proc_macro_is_available, r=petrochenkov

Stabilize proc_macro::is_available

Tracking issue: https://github.com/rust-lang/rust/issues/71436

The FCP for the stabilization of `proc_macro::is_available` has completed.

2 years agoRollup merge of #89720 - jkugelman:must-use-math-operations, r=joshtriplett
Matthias Krüger [Sun, 10 Oct 2021 16:22:25 +0000 (18:22 +0200)]
Rollup merge of #89720 - jkugelman:must-use-math-operations, r=joshtriplett

Add #[must_use] to math and bit manipulation methods

Also tidied up a few other nearby `#[must_use]`s.

Parent issue: #89692

2 years agoRollup merge of #89719 - jkugelman:must-use-char-escape-methods, r=joshtriplett
Matthias Krüger [Sun, 10 Oct 2021 16:22:24 +0000 (18:22 +0200)]
Rollup merge of #89719 - jkugelman:must-use-char-escape-methods, r=joshtriplett

Add #[must_use] to char escape methods

Parent issue: #89692

2 years agoRollup merge of #89718 - jkugelman:must-use-is_condition-tests, r=joshtriplett
Matthias Krüger [Sun, 10 Oct 2021 16:22:23 +0000 (18:22 +0200)]
Rollup merge of #89718 - jkugelman:must-use-is_condition-tests, r=joshtriplett

Add #[must_use] to is_condition tests

There's nothing insightful to say about these so I didn't write any extra explanations.

Parent issue: #89692

2 years agoRollup merge of #89713 - nbdd0121:doc2, r=Amanieu
Matthias Krüger [Sun, 10 Oct 2021 16:22:22 +0000 (18:22 +0200)]
Rollup merge of #89713 - nbdd0121:doc2, r=Amanieu

Fix ABNF of inline asm options

This is the case since #73227.

r? `@camelid`

2 years agoRollup merge of #89705 - nbdd0121:doc, r=GuillaumeGomez
Matthias Krüger [Sun, 10 Oct 2021 16:22:21 +0000 (18:22 +0200)]
Rollup merge of #89705 - nbdd0121:doc, r=GuillaumeGomez

Cfg hide no_global_oom_handling and no_fp_fmt_parse

These are unstable sysroot customisation cfg options that only projects building their own sysroot will use (e.g. Rust-for-linux). Most users shouldn't care. `no_global_oom_handling` can be especially annoying since it's applied on many commonly used alloc crate methods (e.g. `Box::new`, `Vec::push`).

r? ```@GuillaumeGomez```

2 years agoRollup merge of #89520 - GuillaumeGomez:cache-rustdoc-gui-test, r=Mark-Simulacrum
Matthias Krüger [Sun, 10 Oct 2021 16:22:20 +0000 (18:22 +0200)]
Rollup merge of #89520 - GuillaumeGomez:cache-rustdoc-gui-test, r=Mark-Simulacrum

Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui

This method has multiple advantages:

 * It'll completely remove the rustdoc-GUI test doc folder if rustdoc was updated
 * It'll rebuild GUI test crates only they have been updated

All in all, it's quite convenient! (even more with https://github.com/rust-lang/rust/pull/88816)

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

2 years agoRollup merge of #89438 - pierwill:prefix-free-hash, r=Amanieu
Matthias Krüger [Sun, 10 Oct 2021 16:22:20 +0000 (18:22 +0200)]
Rollup merge of #89438 - pierwill:prefix-free-hash, r=Amanieu

docs: `std::hash::Hash` should ensure prefix-free data

Attempt to synthesize the discussion in #89429 into a suggestion regarding `Hash` implementations (not a hard requirement).

Closes #89429.

2 years agoRollup merge of #89428 - DevinR528:reachable-featuregate, r=Nadrieril,camelid
Matthias Krüger [Sun, 10 Oct 2021 16:22:19 +0000 (18:22 +0200)]
Rollup merge of #89428 - DevinR528:reachable-featuregate, r=Nadrieril,camelid

Feature gate the non_exhaustive_omitted_patterns lint

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

Add the machinery to gate the new `non_exhaustive_omitted_patterns` lint.

relates to https://github.com/rust-lang/rust/pull/89105 and https://github.com/rust-lang/rust/pull/89423

2 years agoRollup merge of #88713 - falk-hueffner:int-log10-documentation-fixes, r=scottmcm
Matthias Krüger [Sun, 10 Oct 2021 16:22:18 +0000 (18:22 +0200)]
Rollup merge of #88713 - falk-hueffner:int-log10-documentation-fixes, r=scottmcm

Improve docs for int_log

* Clarify rounding.
* Avoid "wrapping" wording.
* Omit wrong claim on 0 only being returned in error cases.
* Typo fix for one_less_than_next_power_of_two.

2 years agoRollup merge of #88374 - joshlf:patch-2, r=JohnTitor
Matthias Krüger [Sun, 10 Oct 2021 16:22:17 +0000 (18:22 +0200)]
Rollup merge of #88374 - joshlf:patch-2, r=JohnTitor

Fix documentation in Cell

2 years agoAuto merge of #89633 - rhysd:issue-65230, r=petrochenkov
bors [Sun, 10 Oct 2021 15:59:28 +0000 (15:59 +0000)]
Auto merge of #89633 - rhysd:issue-65230, r=petrochenkov

Show detailed expected/found types in error message when trait paths are the same

Fixes #65230.

### Issue solved by this PR

```rust
trait T {
    type U;
    fn f(&self) -> Self::U;
}

struct X<'a>(&'a mut i32);

impl<'a> T for X<'a> {
    type U = &'a i32;
    fn f(&self) -> Self::U {
        self.0
    }
}

fn main() {}
```

Compiler generates the following note:

```
note: ...so that the types are compatible
  --> test.rs:10:28
   |
10 |       fn f(&self) -> Self::U {
   |  ____________________________^
11 | |         self.0
12 | |     }
   | |_____^
   = note: expected `T`
              found `T`
```

This note is not useful since the expected type and the found type are the same.

### How this PR solve the issue

When the expected type and the found type are exactly the same in string representation, the note falls back to the detailed string representation of trait ref:

```
note: ...so that the types are compatible
  --> test.rs:10:28
   |
10 |       fn f(&self) -> Self::U {
   |  ____________________________^
11 | |         self.0
12 | |     }
   | |_____^
   = note: expected `<X<'a> as T>`
              found `<X<'_> as T>`
```

So that a user can notice what was different between the expected one and the found one.

2 years agoRemove for loop range
Clemens Wasser [Sun, 10 Oct 2021 14:32:16 +0000 (16:32 +0200)]
Remove for loop range

2 years agoMerge branch 'rust-lang:master' into must-use-alloc-constructors
John Kugelman [Sun, 10 Oct 2021 14:15:16 +0000 (10:15 -0400)]
Merge branch 'rust-lang:master' into must-use-alloc-constructors

2 years agoApply clippy suggestions
Clemens Wasser [Sat, 9 Oct 2021 18:44:22 +0000 (20:44 +0200)]
Apply clippy suggestions

2 years agoAuto merge of #89219 - nickkuk:str_split_once_get_unchecked, r=Mark-Simulacrum
bors [Sun, 10 Oct 2021 12:29:48 +0000 (12:29 +0000)]
Auto merge of #89219 - nickkuk:str_split_once_get_unchecked, r=Mark-Simulacrum

Use get_unchecked in str::[r]split_once

This PR removes indices checking in `str::split_once` and `str::rsplit_once` methods.

2 years agoRemove unused CSS rule
Guillaume Gomez [Sun, 10 Oct 2021 12:27:36 +0000 (14:27 +0200)]
Remove unused CSS rule

2 years agoAdd test for <code> in doc blocks on mobile
Guillaume Gomez [Thu, 7 Oct 2021 15:26:24 +0000 (17:26 +0200)]
Add test for <code> in doc blocks on mobile

2 years agoStabilize proc_macro::is_available
bjorn3 [Sun, 10 Oct 2021 12:06:49 +0000 (14:06 +0200)]
Stabilize proc_macro::is_available

2 years agoFix <code> blocks in doc blocks display on mobile
Guillaume Gomez [Thu, 7 Oct 2021 15:25:58 +0000 (17:25 +0200)]
Fix <code> blocks in doc blocks display on mobile

2 years agoAuto merge of #88952 - skrap:add-armv7-uclibc, r=nagisa
bors [Sun, 10 Oct 2021 08:16:22 +0000 (08:16 +0000)]
Auto merge of #88952 - skrap:add-armv7-uclibc, r=nagisa

Add new tier-3 target: armv7-unknown-linux-uclibceabihf

This change adds a new tier-3 target: armv7-unknown-linux-uclibceabihf

This target is primarily used in embedded linux devices where system resources are slim and glibc is deemed too heavyweight.  Cross compilation C toolchains are available [here](https://toolchains.bootlin.com/) or via [buildroot](https://buildroot.org).

The change is based largely on a previous PR #79380 with a few minor modifications.  The author of that PR was unable to push the PR forward, and graciously allowed me to take it over.

Per the [target tier 3 policy](https://github.com/rust-lang/rfcs/blob/master/text/2803-target-tier-policy.md), I volunteer to be the "target maintainer".

This is my first PR to Rust itself, so I apologize if I've missed things!

2 years agoAdd #[must_use] to core and std constructors
John Kugelman [Sun, 10 Oct 2021 06:44:26 +0000 (02:44 -0400)]
Add #[must_use] to core and std constructors

2 years agoAdd #[must_use] to alloc constructors
John Kugelman [Sun, 10 Oct 2021 05:50:06 +0000 (01:50 -0400)]
Add #[must_use] to alloc constructors

2 years agoFix spelling: Cannonical -> Canonical
John Kugelman [Sun, 10 Oct 2021 04:44:34 +0000 (00:44 -0400)]
Fix spelling: Cannonical -> Canonical

2 years agoAuto merge of #89695 - jsha:more-templates, r=GuillaumeGomez
bors [Sun, 10 Oct 2021 04:41:03 +0000 (04:41 +0000)]
Auto merge of #89695 - jsha:more-templates, r=GuillaumeGomez

Move top part of print_item to Tera templates

Part of #84419.

This moves the first line of each item page (E.g. `Struct foo::Bar .... 1.0.0 [-][src]` into a Tera template.

I also moved template initialization into its own module and added a small macro to reduce duplication and opportunity for errors.

2 years agoAdd #[must_use] to math and bit manipulation methods
John Kugelman [Sun, 10 Oct 2021 02:35:00 +0000 (22:35 -0400)]
Add #[must_use] to math and bit manipulation methods

Also tidied up a few other nearby `#[must_use]`s.

2 years agoAuto merge of #89661 - rusticstuff:libisl_mirror_take_two, r=Mark-Simulacrum
bors [Sun, 10 Oct 2021 01:46:11 +0000 (01:46 +0000)]
Auto merge of #89661 - rusticstuff:libisl_mirror_take_two, r=Mark-Simulacrum

CI: Use mirror for libisl downloads for more docker dist builds

http://isl.gforge.inria.fr fell from the net a couple of days ago. It hosts libisl source tarballs required by crosstool-ng, which we use for our docker dist cross-compilation builds. Some of the affected builds were already fixed in #89599.

This PR sets a mirror URL for the other builds requiring libisl-0.14. They use an older version of crosstool-ng (1.22.0), which has only one mirror setting for all downloads.

r? `@Mark-Simulacrum`

2 years agoAdd #[must_use] to char escape methods
John Kugelman [Sun, 10 Oct 2021 01:35:09 +0000 (21:35 -0400)]
Add #[must_use] to char escape methods

2 years agoAdd #[must_use] to is_condition tests
John Kugelman [Sun, 10 Oct 2021 01:27:13 +0000 (21:27 -0400)]
Add #[must_use] to is_condition tests

There's nothing insightful to say about these so I didn't write any
extra explanations.

2 years agoAuto merge of #89631 - camsteffen:clippy-boot-env, r=Mark-Simulacrum
bors [Sat, 9 Oct 2021 22:37:34 +0000 (22:37 +0000)]
Auto merge of #89631 - camsteffen:clippy-boot-env, r=Mark-Simulacrum

Remove unused clippy bootstrap env vars

Continues rust-lang/rust-clippy#7646

2 years agoFix ABNF of inline asm options
Gary Guo [Sat, 9 Oct 2021 20:08:53 +0000 (21:08 +0100)]
Fix ABNF of inline asm options

2 years agoAllow the E0482 to be tested
sireliah [Sat, 9 Oct 2021 19:54:02 +0000 (21:54 +0200)]
Allow the E0482 to be tested

2 years agoAdd long explanation for error E0482
sireliah [Sat, 9 Oct 2021 19:27:06 +0000 (21:27 +0200)]
Add long explanation for error E0482

2 years agoSimplified 3 ifs found by clippy.
Nicholas-Baron [Sat, 9 Oct 2021 19:15:14 +0000 (12:15 -0700)]
Simplified 3 ifs found by clippy.

2 years agoSimplified two printlns picked out by clippy
Nicholas-Baron [Sat, 9 Oct 2021 19:12:13 +0000 (12:12 -0700)]
Simplified two printlns picked out by clippy

2 years agoMove check_debugger_output to the debugger module
Nicholas-Baron [Sat, 9 Oct 2021 01:41:40 +0000 (18:41 -0700)]
Move check_debugger_output to the debugger module

2 years agoMove DebuggerCommands to its own file
Nicholas-Baron [Sat, 9 Oct 2021 01:27:44 +0000 (18:27 -0700)]
Move DebuggerCommands to its own file

2 years agoAuto merge of #88379 - camelid:cleanup-clean, r=jyn514
bors [Sat, 9 Oct 2021 19:05:08 +0000 (19:05 +0000)]
Auto merge of #88379 - camelid:cleanup-clean, r=jyn514

rustdoc: Cleanup various `clean` types

Cleanup various `clean` types.

2 years agoUpdate library/core/src/hash/mod.rs
pierwill [Sat, 9 Oct 2021 18:53:29 +0000 (13:53 -0500)]
Update library/core/src/hash/mod.rs

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2 years agoApply clippy suggestions
Clemens Wasser [Sat, 9 Oct 2021 16:51:30 +0000 (18:51 +0200)]
Apply clippy suggestions

2 years agoCfg hide no_global_oom_handling and no_fp_fmt_parse
Gary Guo [Sat, 9 Oct 2021 16:07:33 +0000 (17:07 +0100)]
Cfg hide no_global_oom_handling and no_fp_fmt_parse

2 years agoAuto merge of #89703 - GuillaumeGomez:rollup-g3ulo9x, r=GuillaumeGomez
bors [Sat, 9 Oct 2021 16:01:30 +0000 (16:01 +0000)]
Auto merge of #89703 - GuillaumeGomez:rollup-g3ulo9x, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #75644 (Add 'core::array::from_fn' and 'core::array::try_from_fn')
 - #87528 (stack overflow handler specific openbsd change.)
 - #88436 (std: Stabilize command_access)
 - #89614 (Update to Unicode 14.0)
 - #89664 (Add documentation to boxed conversions)
 - #89700 (Fix invalid HTML generation for higher bounds)

Failed merges:

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

2 years agoRemove some stray whitespace.
Jacob Hoffman-Andrews [Sat, 9 Oct 2021 15:33:19 +0000 (08:33 -0700)]
Remove some stray whitespace.

2 years agoUse E0308 instead of E0495 for checking the error message improvement
rhysd [Sat, 9 Oct 2021 15:23:35 +0000 (00:23 +0900)]
Use E0308 instead of E0495 for checking the error message improvement

because previous test does not cause the expected error message when
`-Z borrowck=mir`.