]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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 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 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 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`.

2 years agoRollup merge of #89700 - GuillaumeGomez:fix-rustdoc-higher-bound-html-gen, r=notriddle
Guillaume Gomez [Sat, 9 Oct 2021 15:08:41 +0000 (17:08 +0200)]
Rollup merge of #89700 - GuillaumeGomez:fix-rustdoc-higher-bound-html-gen, r=notriddle

Fix invalid HTML generation for higher bounds

Considering this is a bug, I cherry-picked the commit from #89676 so it's merged more quickly.

r? ``@notriddle``

2 years agoRollup merge of #89664 - timClicks:51430-document-boxed-conversions, r=m-ou-se
Guillaume Gomez [Sat, 9 Oct 2021 15:08:41 +0000 (17:08 +0200)]
Rollup merge of #89664 - timClicks:51430-document-boxed-conversions, r=m-ou-se

Add documentation to boxed conversions

Among other changes, documents whether allocations are necessary
to complete the type conversion.

Part of #51430, supersedes #89199

2 years agoRollup merge of #89614 - cuviper:unicode-14, r=joshtriplett
Guillaume Gomez [Sat, 9 Oct 2021 15:08:40 +0000 (17:08 +0200)]
Rollup merge of #89614 - cuviper:unicode-14, r=joshtriplett

Update to Unicode 14.0

The Unicode Standard [announced Version 14.0](https://home.unicode.org/announcing-the-unicode-standard-version-14-0/) on September 14, 2021, and this pull request updates the generated tables in `core` accordingly.

This did require a little prep-work in `unicode-table-generator`. First, #81358 had modified the generated file instead of the tool, so that change is now reflected in the tool as well. Next, I found that the "Alphabetic" property in version 14 was panicking when generating a bitset, "cannot pack 264 into 8 bits". We've been using the skiplist for that anyway, so I changed this to fail gracefully. Finally, I confirmed that the tool still created the exact same tables for 13 before moving to 14.

2 years agoRollup merge of #88436 - lf-:stabilize-command-access, r=yaahc
Guillaume Gomez [Sat, 9 Oct 2021 15:08:39 +0000 (17:08 +0200)]
Rollup merge of #88436 - lf-:stabilize-command-access, r=yaahc

std: Stabilize command_access

Tracking issue: #44434 (not yet closed but the FCP is done so that should be soon).

2 years agoRollup merge of #87528 - :stack_overflow_obsd, r=joshtriplett
Guillaume Gomez [Sat, 9 Oct 2021 15:08:38 +0000 (17:08 +0200)]
Rollup merge of #87528 - :stack_overflow_obsd, r=joshtriplett

stack overflow handler specific openbsd change.

2 years agoRollup merge of #75644 - c410-f3r:array, r=yaahc
Guillaume Gomez [Sat, 9 Oct 2021 15:08:38 +0000 (17:08 +0200)]
Rollup merge of #75644 - c410-f3r:array, r=yaahc

Add 'core::array::from_fn' and 'core::array::try_from_fn'

These auxiliary methods fill uninitialized arrays in a safe way and are particularly useful for elements that don't implement `Default`.

```rust
// Foo doesn't implement Default
struct Foo(usize);

let _array = core::array::from_fn::<_, _, 2>(|idx| Foo(idx));
```

Different from `FromIterator`, it is guaranteed that the array will be fully filled and no error regarding uninitialized state will be throw. In certain scenarios, however, the creation of an **element** can fail and that is why the `try_from_fn` function is also provided.

```rust
#[derive(Debug, PartialEq)]
enum SomeError {
    Foo,
}

let array = core::array::try_from_fn(|i| Ok::<_, SomeError>(i));
assert_eq!(array, Ok([0, 1, 2, 3, 4]));

let another_array = core::array::try_from_fn(|_| Err(SomeError::Foo));
assert_eq!(another_array, Err(SomeError::Foo));
 ```

2 years agoAuto merge of #89343 - Mark-Simulacrum:no-args-queries, r=cjgillot
bors [Sat, 9 Oct 2021 13:13:07 +0000 (13:13 +0000)]
Auto merge of #89343 - Mark-Simulacrum:no-args-queries, r=cjgillot

Refactor fingerprint reconstruction

This PR replaces can_reconstruct_query_key with fingerprint_style, which returns the style of the fingerprint for that query. This allows us to avoid trying to extract a DefId (or equivalent) from keys which *are* reconstructible because they're () but not as DefIds.

This is done with the goal of fixing -Zdump-dep-graph, which seems to have broken a while ago (I didn't try to bisect). Currently even on a `fn main() {}` file it'll ICE (you need to also pass -Zquery-dep-graph for it to work at all), and this patch indirectly fixes the cause of that ICE. This also adds a test for it continuing to work.

2 years agoFix invalid HTML generation for higher bounds
Guillaume Gomez [Fri, 8 Oct 2021 18:11:02 +0000 (20:11 +0200)]
Fix invalid HTML generation for higher bounds

2 years agoAdd a test that -Zquery-dep-graph -Zdump-dep-graph works
Mark Rousskov [Sat, 2 Oct 2021 16:23:18 +0000 (12:23 -0400)]
Add a test that -Zquery-dep-graph -Zdump-dep-graph works

2 years agoAuto merge of #89698 - matthiaskrgr:rollup-gna54x6, r=matthiaskrgr
bors [Sat, 9 Oct 2021 10:00:54 +0000 (10:00 +0000)]
Auto merge of #89698 - matthiaskrgr:rollup-gna54x6, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #88707 (String.split_terminator: Add an example when using a slice of chars)
 - #89605 (Fix stabilization version for `bindings_after_at`)
 - #89634 (rustc_driver: Enable the `WARN` log level by default)
 - #89641 (make #[target_feature] work with `asm` register classes)
 - #89678 (Fix minor std::thread documentation typo)
 - #89684 (Fix asm docs typo)
 - #89687 (Move `read2_abbreviated` function into read2.rs)
 - #89693 (Add #[must_use] to stdin/stdout/stderr locks)
 - #89694 (Add #[must_use] to string/char transformation methods)
 - #89697 (Fix min LLVM version for bpf-types test)

Failed merges:

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

2 years agoRollup merge of #89697 - alessandrod:issue-89689, r=nikic
Matthias Krüger [Sat, 9 Oct 2021 09:56:08 +0000 (11:56 +0200)]
Rollup merge of #89697 - alessandrod:issue-89689, r=nikic

Fix min LLVM version for bpf-types test

The test requires https://reviews.llvm.org/D102118 which was released in LLVM 13.

Closes #89689

2 years agoRollup merge of #89694 - jkugelman:must-use-string-transforms, r=joshtriplett
Matthias Krüger [Sat, 9 Oct 2021 09:56:07 +0000 (11:56 +0200)]
Rollup merge of #89694 - jkugelman:must-use-string-transforms, r=joshtriplett

Add #[must_use] to string/char transformation methods

These methods could be misconstrued as modifying their arguments instead of returning new values.

Where possible I made the note recommend a method that does mutate in place.

Parent issue: #89692

2 years agoRollup merge of #89693 - jkugelman:must-use-stdin-stdout-stderr-locks, r=joshtriplett
Matthias Krüger [Sat, 9 Oct 2021 09:56:07 +0000 (11:56 +0200)]
Rollup merge of #89693 - jkugelman:must-use-stdin-stdout-stderr-locks, r=joshtriplett

Add #[must_use] to stdin/stdout/stderr locks

Affected methods:

```rust
std::io           fn stdin_locked() -> StdinLock<'static>;
std::io::Stdin    fn lock(&self) -> StdinLock<'_>;
std::io           fn stdout_locked() -> StdoutLock<'static>;
std::io::Stdout   fn lock(&self) -> StdoutLock<'_>;
std::io           fn stderr_locked() -> StderrLock<'static>;
std::io::Stderr   fn lock(&self) -> StderrLock<'_>;
```

Parent issue: https://github.com/rust-lang/rust/issues/89692

2 years agoRollup merge of #89687 - Nicholas-Baron:move_read2_abbreviated, r=Mark-Simulacrum
Matthias Krüger [Sat, 9 Oct 2021 09:56:06 +0000 (11:56 +0200)]
Rollup merge of #89687 - Nicholas-Baron:move_read2_abbreviated, r=Mark-Simulacrum

Move `read2_abbreviated` function into read2.rs

Work towards #89475.

2 years agoRollup merge of #89684 - asquared31415:asm-doc-fix, r=joshtriplett
Matthias Krüger [Sat, 9 Oct 2021 09:56:02 +0000 (11:56 +0200)]
Rollup merge of #89684 - asquared31415:asm-doc-fix, r=joshtriplett

Fix asm docs typo

Fixes a typo in target feature names in the `asm` documentation

2 years agoRollup merge of #89678 - marcelo-gonzalez:master, r=joshtriplett
Matthias Krüger [Sat, 9 Oct 2021 09:56:01 +0000 (11:56 +0200)]
Rollup merge of #89678 - marcelo-gonzalez:master, r=joshtriplett

Fix minor std::thread documentation typo

callers of spawn_unchecked() need to make sure that the thread
not outlive references in the passed closure, not the other way around.

2 years agoRollup merge of #89641 - asquared31415:asm-feature-attr-regs, r=oli-obk
Matthias Krüger [Sat, 9 Oct 2021 09:56:00 +0000 (11:56 +0200)]
Rollup merge of #89641 - asquared31415:asm-feature-attr-regs, r=oli-obk

make #[target_feature] work with `asm` register classes

Fixes #89289

2 years agoRollup merge of #89634 - hawkw:eliza/enable-err-warn, r=oli-obk
Matthias Krüger [Sat, 9 Oct 2021 09:55:59 +0000 (11:55 +0200)]
Rollup merge of #89634 - hawkw:eliza/enable-err-warn, r=oli-obk

rustc_driver: Enable the `WARN` log level by default

This commit changes the `tracing_subscriber` initialization in
`rustc_driver` so that the `WARN` verbosity level is enabled by default
when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env
variable is set, the filter string in the environment variable is
honored, instead.

Fixes #76824
Closes #89623

cc ``@eddyb,`` ``@oli-obk``

2 years agoRollup merge of #89605 - camelid:fix-version, r=nagisa
Matthias Krüger [Sat, 9 Oct 2021 09:55:58 +0000 (11:55 +0200)]
Rollup merge of #89605 - camelid:fix-version, r=nagisa

Fix stabilization version for `bindings_after_at`

According to the release notes and its PR milestone, it was stabilized
in 1.56.0.

2 years agoRollup merge of #88707 - sylvestre:split_example, r=yaahc
Matthias Krüger [Sat, 9 Oct 2021 09:55:58 +0000 (11:55 +0200)]
Rollup merge of #88707 - sylvestre:split_example, r=yaahc

String.split_terminator: Add an example when using a slice of chars

2 years agoRemove unnecessary hyphen
Tim McNamara [Sat, 9 Oct 2021 08:44:07 +0000 (21:44 +1300)]
Remove unnecessary hyphen

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2 years agoFix min LLVM version for bpf-types test
Alessandro Decina [Sat, 9 Oct 2021 08:18:37 +0000 (19:18 +1100)]
Fix min LLVM version for bpf-types test

Closes #89689

2 years agoSimplify wording
Tim McNamara [Sat, 9 Oct 2021 07:51:36 +0000 (20:51 +1300)]
Simplify wording

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2 years agoMove template initialization into its own file.
Jacob Hoffman-Andrews [Sat, 9 Oct 2021 06:25:54 +0000 (23:25 -0700)]
Move template initialization into its own file.

2 years agoUpdate library/core/src/num/mod.rs
John Kugelman [Sat, 9 Oct 2021 06:05:03 +0000 (02:05 -0400)]
Update library/core/src/num/mod.rs

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2 years agoAdd template for print_item
Jacob Hoffman-Andrews [Sat, 9 Oct 2021 04:57:44 +0000 (21:57 -0700)]
Add template for print_item

Add print_item.html and the code in print_item.rs to use it.

2 years agoAuto merge of #89582 - jkugelman:optimize-file-read-to-end, r=joshtriplett
bors [Sat, 9 Oct 2021 05:24:47 +0000 (05:24 +0000)]
Auto merge of #89582 - jkugelman:optimize-file-read-to-end, r=joshtriplett

Optimize File::read_to_end and read_to_string

Reading a file into an empty vector or string buffer can incur unnecessary `read` syscalls and memory re-allocations as the buffer "warms up" and grows to its final size. This is perhaps a necessary evil with generic readers, but files can be read in smarter by checking the file size and reserving that much capacity.

`std::fs::read` and `std::fs::read_to_string` already perform this optimization: they open the file, reads its metadata, and call `with_capacity` with the file size. This ensures that the buffer does not need to be resized and an initial string of small `read` syscalls.

However, if a user opens the `File` themselves and calls `file.read_to_end` or `file.read_to_string` they do not get this optimization.

```rust
let mut buf = Vec::new();
file.read_to_end(&mut buf)?;
```

I searched through this project's codebase and even here are a *lot* of examples of this. They're found all over in unit tests, which isn't a big deal, but there are also several real instances in the compiler and in Cargo. I've documented the ones I found in a comment here:

https://github.com/rust-lang/rust/issues/89516#issuecomment-934423999

Most telling, the documentation for both the `Read` trait and the `Read::read_to_end` method both show this exact pattern as examples of how to use readers. What this says to me is that this shouldn't be solved by simply fixing the instances of it in this codebase. If it's here it's certain to be prevalent in the wider Rust ecosystem.

To that end, this commit adds specializations of `read_to_end` and `read_to_string` directly on `File`. This way it's no longer a minor footgun to start with an empty buffer when reading a file in.

A nice side effect of this change is that code that accesses a `File` as `impl Read` or `dyn Read` will benefit. For example, this code from `compiler/rustc_serialize/src/json.rs`:

```rust
pub fn from_reader(rdr: &mut dyn Read) -> Result<Json, BuilderError> {
    let mut contents = Vec::new();
    match rdr.read_to_end(&mut contents) {
```

Related changes:

- I also added specializations to `BufReader` to delegate to `self.inner`'s methods. That way it can call `File`'s optimized  implementations if the inner reader is a file.

- The private `std::io::append_to_string` function is now marked `unsafe`.

- `File::read_to_string` being more efficient means that the performance note for `io::read_to_string` can be softened. I've added `@camelid's` suggested wording from https://github.com/rust-lang/rust/issues/80218#issuecomment-936806502.

r? `@joshtriplett`

2 years agoAdd #[must_use] to string/char transformation methods
John Kugelman [Sat, 9 Oct 2021 05:01:40 +0000 (01:01 -0400)]
Add #[must_use] to string/char transformation methods

These methods could be misconstrued as modifying their arguments instead
of returning new values.

Where possible I made the note recommend a method that does mutate in
place.

2 years agoAdd #[must_use] to stdin/stdout/stderr locks
John Kugelman [Sat, 9 Oct 2021 03:31:57 +0000 (23:31 -0400)]
Add #[must_use] to stdin/stdout/stderr locks

2 years agoMove read2_abbreviated function into read2.rs
Nicholas-Baron [Fri, 8 Oct 2021 22:12:21 +0000 (15:12 -0700)]
Move read2_abbreviated function into read2.rs

2 years agoAdd feature gate to non_exhaustive_omitted_patterns lint
Devin Ragotzy [Fri, 1 Oct 2021 14:21:56 +0000 (10:21 -0400)]
Add feature gate to non_exhaustive_omitted_patterns lint

Actually add the feature to the lints ui test
Add tracking issue to the feature declaration
Rename feature gate to non_exhaustive_omitted_patterns_lint
Add more omitted_patterns lint feature gate

2 years agoAuto merge of #89683 - GuillaumeGomez:rollup-q2mjd9m, r=GuillaumeGomez
bors [Fri, 8 Oct 2021 21:13:27 +0000 (21:13 +0000)]
Auto merge of #89683 - GuillaumeGomez:rollup-q2mjd9m, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #86506 (Don't normalize xform_ret_ty during method candidate assembly )
 - #89538 (Make rustdoc not highlight `->` and `=>` as operators)
 - #89649 (clippy::complexity fixes)
 - #89668 (Cfg hide more conditions for core and alloc)
 - #89669 (Remove special-casing of never primitive in rustdoc-json-types)
 - #89672 (Remove unwrap_or! macro)

Failed merges:

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

2 years agoFix asm docs typo
asquared31415 [Fri, 8 Oct 2021 20:50:35 +0000 (16:50 -0400)]
Fix asm docs typo

2 years agoRollup merge of #89672 - klensy:unwrap-or-macro, r=jackh726
Guillaume Gomez [Fri, 8 Oct 2021 20:30:43 +0000 (22:30 +0200)]
Rollup merge of #89672 - klensy:unwrap-or-macro, r=jackh726

Remove unwrap_or! macro

Removes `unwrap_or!` macro and replaces it with `match`.

It's kinda cleanup, as rustc_ast not the best place for this macro and this is used only in 2 places anyway.

2 years agoRollup merge of #89669 - Urgau:json-remove-type-never, r=GuillaumeGomez
Guillaume Gomez [Fri, 8 Oct 2021 20:30:42 +0000 (22:30 +0200)]
Rollup merge of #89669 - Urgau:json-remove-type-never, r=GuillaumeGomez

Remove special-casing of never primitive in rustdoc-json-types

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

r? `@GuillaumeGomez`

2 years agoRollup merge of #89668 - Urgau:core-cfg-hide, r=GuillaumeGomez
Guillaume Gomez [Fri, 8 Oct 2021 20:30:41 +0000 (22:30 +0200)]
Rollup merge of #89668 - Urgau:core-cfg-hide, r=GuillaumeGomez

Cfg hide more conditions for core and alloc

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

Before:
![image](https://user-images.githubusercontent.com/3616612/136572816-a7844ac7-dc2f-4d79-87b4-7f9766421a83.png)

After:
![image](https://user-images.githubusercontent.com/3616612/136572745-7d890726-8efd-4d74-83ac-ed06f4687741.png)

*Same for alloc*

r? ``@GuillaumeGomez``

2 years agoRollup merge of #89649 - matthiaskrgr:clippycompl, r=jyn514
Guillaume Gomez [Fri, 8 Oct 2021 20:30:40 +0000 (22:30 +0200)]
Rollup merge of #89649 - matthiaskrgr:clippycompl, r=jyn514

clippy::complexity fixes

2 years agoRollup merge of #89538 - notriddle:notriddle/arrow-highlight, r=GuillaumeGomez
Guillaume Gomez [Fri, 8 Oct 2021 20:30:39 +0000 (22:30 +0200)]
Rollup merge of #89538 - notriddle:notriddle/arrow-highlight, r=GuillaumeGomez

Make rustdoc not highlight `->` and `=>` as operators

It was marking them up as `<span class="op">=</span><span class="op">&gt;</span>`,
which is bloaty and wrong (at least, I think `<=` and `=>` should probably be different colors, since they're so different and yet made from the same symbols).

Before:

![image](https://user-images.githubusercontent.com/1593513/135939748-f49b0f9e-6a7d-4d65-935a-e31cdf688a81.png)

After:

![image](https://user-images.githubusercontent.com/1593513/135940063-5ef1f6b1-7e03-4227-b46b-572b063aba05.png)

2 years agoRollup merge of #86506 - b-naber:gen_trait_impl_inconsistent, r=jackh726
Guillaume Gomez [Fri, 8 Oct 2021 20:30:38 +0000 (22:30 +0200)]
Rollup merge of #86506 - b-naber:gen_trait_impl_inconsistent, r=jackh726

Don't normalize xform_ret_ty during method candidate assembly

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

Normalizing the return type of a method candidate together with the expected receiver type of the method can lead to valid method candidates being rejected during probing. Specifically in the example of the fixed issue we have a `self_ty` of the form `&A<&[Coef]>` whereas the `impl_ty` of the method would be `&A<_>`, if we normalize the projection in the return type we unify the inference variable with `Cont`, which will lead us to reject the candidate in the sup type check in `consider_probe`. Since we don't actually need the normalized return type during candidate assembly, we postpone the normalization until we consider candidates in `consider_probe`.

2 years agoFix minor std::thread documentation typo
Marcelo Diop-Gonzalez [Fri, 8 Oct 2021 19:29:04 +0000 (15:29 -0400)]
Fix minor std::thread documentation typo

callers of spawn_unchecked() need to make sure that the thread
not outlive references in the passed closure, not the other way around.