]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #84956 - RalfJung:rollup-m70mx2n, r=RalfJung
bors [Wed, 5 May 2021 17:45:41 +0000 (17:45 +0000)]
Auto merge of #84956 - RalfJung:rollup-m70mx2n, r=RalfJung

Rollup of 11 pull requests

Successful merges:

 - #83553 (Update `ptr` docs with regards to `ptr::addr_of!`)
 - #84183 (Update RELEASES.md for 1.52.0)
 - #84709 (Add doc alias for `chdir` to `std::env::set_current_dir`)
 - #84803 (Reduce duplication in `impl_dep_tracking_hash` macros)
 - #84808 (Account for unsatisfied bounds in E0599)
 - #84843 (use else if in std library )
 - #84865 (rustbuild: Pass a `threads` flag that works to windows-gnu lld)
 - #84878 (Clarify documentation for `[T]::contains`)
 - #84882 (platform-support: Center the contents of the `std` and `host` columns)
 - #84903 (Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`)
 - #84913 (Do not ICE on invalid const param)

Failed merges:

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

3 years agoRollup merge of #84913 - estebank:issue-84831, r=varkor
Ralf Jung [Wed, 5 May 2021 15:52:29 +0000 (17:52 +0200)]
Rollup merge of #84913 - estebank:issue-84831, r=varkor

Do not ICE on invalid const param

When encountering a path that can't have generics, do not call
`generics_of`. This would happen when writing something like
`path::this_is_a_mod<const_val>`.

Fix #84831.

3 years agoRollup merge of #84903 - hyd-dev:dead-check-in-alloc-msg, r=RalfJung
Ralf Jung [Wed, 5 May 2021 15:52:28 +0000 (17:52 +0200)]
Rollup merge of #84903 - hyd-dev:dead-check-in-alloc-msg, r=RalfJung

Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`

Removing it per https://github.com/rust-lang/rust/pull/84842#discussion_r625589674: it's a dead enum variant.

Note that `PointerArithmeticTest` also seems dead:
```
$ rg -F PointerArithmeticTest -C5
compiler/rustc_middle/src/mir/interpret/error.rs
169-
170-/// Details of why a pointer had to be in-bounds.
171-#[derive(Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)]
172-pub enum CheckInAllocMsg {
173-    MemoryAccessTest,
174:    PointerArithmeticTest,
175-    InboundsTest,
176-}
177-
178-impl fmt::Display for CheckInAllocMsg {
179-    /// When this is printed as an error the context looks like this
--
182-        write!(
183-            f,
184-            "{}",
185-            match *self {
186-                CheckInAllocMsg::MemoryAccessTest => "memory access",
187:                CheckInAllocMsg::PointerArithmeticTest => "pointer arithmetic",
188-                CheckInAllocMsg::InboundsTest => "inbounds test",
189-            }
190-        )
191-    }
192-}
```
Not sure if that is also desirable to be removed, however.

3 years agoRollup merge of #84882 - joshtriplett:platform-support-formatting, r=Dylan-DPC
Ralf Jung [Wed, 5 May 2021 15:52:27 +0000 (17:52 +0200)]
Rollup merge of #84882 - joshtriplett:platform-support-formatting, r=Dylan-DPC

platform-support: Center the contents of the `std` and `host` columns

Minor formatting improvement.

3 years agoRollup merge of #84878 - jimblandy:contains-doc-fix, r=joshtriplett
Ralf Jung [Wed, 5 May 2021 15:52:26 +0000 (17:52 +0200)]
Rollup merge of #84878 - jimblandy:contains-doc-fix, r=joshtriplett

Clarify documentation for `[T]::contains`

Change the documentation to correctly characterize when the suggested alternative to `contains` applies, and correctly explain why it works.

Fixes #84877

3 years agoRollup merge of #84865 - petrochenkov:llthread, r=Mark-Simulacrum
Ralf Jung [Wed, 5 May 2021 15:52:25 +0000 (17:52 +0200)]
Rollup merge of #84865 - petrochenkov:llthread, r=Mark-Simulacrum

rustbuild: Pass a `threads` flag that works to windows-gnu lld

MinGW driver for COFF LLD doesn't currently translate GNU-style `--threads=N` to native `/threads:N`, so we have to pass the option in its native form to avoid an error.

Also pass the `threads` flag to lld-link (windows-msvc lld) as well.

3 years agoRollup merge of #84843 - wcampbell0x2a:use-else-if-let, r=dtolnay
Ralf Jung [Wed, 5 May 2021 15:52:24 +0000 (17:52 +0200)]
Rollup merge of #84843 - wcampbell0x2a:use-else-if-let, r=dtolnay

use else if in std library

Decreases indentation and improves readability

3 years agoRollup merge of #84808 - estebank:issue-84769, r=petrochenkov
Ralf Jung [Wed, 5 May 2021 15:52:23 +0000 (17:52 +0200)]
Rollup merge of #84808 - estebank:issue-84769, r=petrochenkov

Account for unsatisfied bounds in E0599

Fix #84769, follow up to #84499, #83667.

3 years agoRollup merge of #84803 - jyn514:duplicate-macros, r=petrochenkov
Ralf Jung [Wed, 5 May 2021 15:52:22 +0000 (17:52 +0200)]
Rollup merge of #84803 - jyn514:duplicate-macros, r=petrochenkov

Reduce duplication in `impl_dep_tracking_hash` macros

Cherry-picked from https://github.com/rust-lang/rust/pull/84234 since it will be a while until it lands.

3 years agoRollup merge of #84709 - joshtriplett:doc-alias-chdir, r=dtolnay
Ralf Jung [Wed, 5 May 2021 15:52:20 +0000 (17:52 +0200)]
Rollup merge of #84709 - joshtriplett:doc-alias-chdir, r=dtolnay

Add doc alias for `chdir` to `std::env::set_current_dir`

Searching for `chdir` in the Rust documentation produces no useful
results.

I wrote some code recently that called `libc::chdir` and manually
handled errors, because I didn't realize that the safe
`std::env::set_current_dir` existed. I searched for `chdir` and
`change_dir` and `change_directory` (the latter two based on the
precedent of unabbreviating set by `create_dir`), and I also read
through `std::fs` expecting to potentially find it there. Given that
none of those led to `std::env::set_current_dir`, I think that provides
sufficient justification to add this specific alias.

3 years agoRollup merge of #84183 - rust-lang:relnotes-1.52.0, r=pietroalbini
Ralf Jung [Wed, 5 May 2021 15:52:19 +0000 (17:52 +0200)]
Rollup merge of #84183 - rust-lang:relnotes-1.52.0, r=pietroalbini

Update RELEASES.md for 1.52.0

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

r? ````````@Mark-Simulacrum````````
cc ````````@rust-lang/release````````

3 years agoRollup merge of #83553 - jfrimmel:addr-of, r=m-ou-se
Ralf Jung [Wed, 5 May 2021 15:52:18 +0000 (17:52 +0200)]
Rollup merge of #83553 - jfrimmel:addr-of, r=m-ou-se

Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore.

Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉

Fixes #83509.

``````````@rustbot`````````` modify labels: T-doc

3 years agoAuto merge of #84200 - CDirkx:os, r=m-ou-se
bors [Wed, 5 May 2021 14:15:19 +0000 (14:15 +0000)]
Auto merge of #84200 - CDirkx:os, r=m-ou-se

Move all `sys::ext` modules to `os`

This PR moves all `sys::ext` modules to `os`, centralizing the location of all `os` code and simplifying the dependencies between `os` and `sys`.

Because this also removes all uses `cfg_if!` on publicly exported items, where after #81969 there were still a few left, this should properly work around https://github.com/rust-analyzer/rust-analyzer/issues/6038.

`@rustbot` label: +T-libs-impl

3 years agoAuto merge of #84886 - Xanewok:update-rls-and-rustfmt, r=Xanewok
bors [Wed, 5 May 2021 11:05:27 +0000 (11:05 +0000)]
Auto merge of #84886 - Xanewok:update-rls-and-rustfmt, r=Xanewok

Update RLS and Rustfmt

Closes #84537. Closes #84538.

I know there's https://github.com/rust-lang/rust/pull/82208 in progress but I'm not sure which we want to land first.

Also, I'm getting Rustfmt test failures due to inner attributes not permitted:
<details>

```
error: an inner attribute is not permitted in this context
 --> tests/target/issue-3592.rs:4:13
  |
4 |             #![cfg(unix)]
  |             ^^^^^^^^^^^^^
  |
  = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

error: an inner attribute is not permitted in this context
 --> tests/target/issue-3592.rs:8:13
  |
8 |             #![cfg(not(unix))]
  |             ^^^^^^^^^^^^^^^^^^
  |
  = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

error: an inner attribute is not permitted in this context
   --> tests/source/match.rs:413:9
    |
413 |         #![allow(simple_match)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

error: an inner attribute is not permitted in this context
   --> tests/target/match.rs:444:9
    |
444 |         #![allow(simple_match)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

test test::system_tests ... FAILED
test test::idempotence_tests ... FAILED
```

</details>

but let's see what CI says, first.

cc `@calebcartwright`

3 years agoAdd `yansi-term` as a permitted dependency
Joshua Nelson [Sun, 2 May 2021 19:06:24 +0000 (15:06 -0400)]
Add `yansi-term` as a permitted dependency

3 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Mon, 3 May 2021 20:59:35 +0000 (22:59 +0200)]
Update RLS and Rustfmt

3 years agoAuto merge of #84794 - ChrisDenton:dedup-native-libs, r=petrochenkov
bors [Wed, 5 May 2021 03:56:26 +0000 (03:56 +0000)]
Auto merge of #84794 - ChrisDenton:dedup-native-libs, r=petrochenkov

Deduplicate native libs before they are passed to the linker

Stop spamming the linker with the same native library over and over again, if they directly follow from each other. This would help prevent [this situation](https://github.com/MSxDOS/ntapi/issues/2).

Issue #38460 has been open since 2016 so I think it's worth making an incomplete fix that at least addresses the most common symptom and without otherwise changing how Rust handles native libs. This PR is intended to be easy to revert (if necessary) when a more permanent fix is implemented.

3 years agoAuto merge of #84915 - Mark-Simulacrum:bitset-xor-eq, r=jackh726
bors [Wed, 5 May 2021 01:23:01 +0000 (01:23 +0000)]
Auto merge of #84915 - Mark-Simulacrum:bitset-xor-eq, r=jackh726

Retain data in vectorized registers for longer

This seems to be a mild performance improvement on the keccak crate at least, though not sure it'll show up more broadly.

3 years agoAuto merge of #84707 - Stupremee:remove-fake-defids-in-rustdoc, r=jyn514,GuillaumeGomez
bors [Tue, 4 May 2021 20:56:49 +0000 (20:56 +0000)]
Auto merge of #84707 - Stupremee:remove-fake-defids-in-rustdoc, r=jyn514,GuillaumeGomez

Get rid of fake `DefId`s in rustdoc

Right now there are *many* errors left, but I wanted to show the current state since all that is left to do is fixing the errors.

Resolves #83183

r? `@jyn514`

3 years agoAuto merge of #84900 - hyd-dev:miri, r=RalfJung
bors [Tue, 4 May 2021 18:35:08 +0000 (18:35 +0000)]
Auto merge of #84900 - hyd-dev:miri, r=RalfJung

Update Miri

This should fix #84848.

r? `@RalfJung`

3 years agoAdd type to differentiate between fake and real DefId's
Justus K [Thu, 29 Apr 2021 19:36:54 +0000 (21:36 +0200)]
Add type to differentiate between fake and real DefId's

3 years agoChange bitwise operator to more easily keep data in vector registers
Mark Rousskov [Tue, 4 May 2021 15:53:57 +0000 (11:53 -0400)]
Change bitwise operator to more easily keep data in vector registers

3 years agoDo not ICE on invalid const param
Esteban Küber [Tue, 4 May 2021 15:41:40 +0000 (08:41 -0700)]
Do not ICE on invalid const param

When encountering a path that can't have generics, do not call
`generics_of`. This would happen when writing something like
`path::this_is_a_mod<const_val>`.

Fix #84831.

3 years agoAuto merge of #84894 - joshtriplett:clang-12, r=Mark-Simulacrum
bors [Tue, 4 May 2021 15:03:50 +0000 (15:03 +0000)]
Auto merge of #84894 - joshtriplett:clang-12, r=Mark-Simulacrum

Update clang to 12.0.0 on Windows and macOS

Needed for https://github.com/rust-lang/rust/pull/84764 . Tarballs
already uploaded to the CI mirror bucket.

3 years agoAuto merge of #84017 - Smittyvb:int-literal-underscores, r=jyn514
bors [Tue, 4 May 2021 10:42:13 +0000 (10:42 +0000)]
Auto merge of #84017 - Smittyvb:int-literal-underscores, r=jyn514

Valid underscores in hex/octal/binary literal docs

Currently hex/octal/binary literals with computed values are displayed like `0_xff_fff_fffu32`, which is invalid since underscores can't be in the middle of integer prefixes. This properly formats prefixed integers.

This causes  [`std::u32::MAX`](https://doc.rust-lang.org/std/u32/constant.MAX.html) to be displayed as
```rust
pub const MAX: u32 = u32::MAX; // 0_xff_fff_fffu32
```

This PR changes it to be displayed as:
```rust
pub const MAX: u32 = u32::MAX; // 0xffff_ffffu32
```

3 years agoRemove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`
hyd-dev [Tue, 4 May 2021 10:27:02 +0000 (18:27 +0800)]
Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`

3 years agoUpdate Miri
hyd-dev [Tue, 4 May 2021 09:07:39 +0000 (17:07 +0800)]
Update Miri

3 years agoAuto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis
bors [Tue, 4 May 2021 08:09:23 +0000 (08:09 +0000)]
Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis

Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021

This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition.

r? `@estebank`

3 years agoUpdate clang to 12.0.0 on Windows and macOS
Josh Triplett [Tue, 4 May 2021 05:54:50 +0000 (22:54 -0700)]
Update clang to 12.0.0 on Windows and macOS

Needed for https://github.com/rust-lang/rust/pull/84764 . Tarballs
already uploaded to the CI mirror bucket.

3 years agoAuto merge of #84874 - joshtriplett:ci-extract-llvm-win64-installer, r=Mark-Simulacrum
bors [Tue, 4 May 2021 05:40:24 +0000 (05:40 +0000)]
Auto merge of #84874 - joshtriplett:ci-extract-llvm-win64-installer, r=Mark-Simulacrum

CI: Extract LLVM win64 installer directly, using 7z

Currently, we have LLVM tarballs for win64, generated by someone running
the installer via wine and tarring up the result.

7z knows how to extract NSIS installers directly, and the result is
identical to our tarball, except that it doesn't include `Uninstall.exe`
(which we don't care about) and it includes the NSIS plugin directory
(which we also don't care about).

This simplifies the process of upgrading CI, and allows us to just
mirror the upstream release .exe directly. This also improves our
supply chain.

3 years agoAuto merge of #84833 - Mark-Simulacrum:thread-local-consts, r=varkor
bors [Tue, 4 May 2021 03:14:32 +0000 (03:14 +0000)]
Auto merge of #84833 - Mark-Simulacrum:thread-local-consts, r=varkor

"const" initialized thread locals in rustc

This appears to give a slight speedup on many of our benchmarks.

3 years agoAuto merge of #84472 - Aaron1011:conservative-paramenv-and, r=lcnr
bors [Tue, 4 May 2021 00:48:42 +0000 (00:48 +0000)]
Auto merge of #84472 - Aaron1011:conservative-paramenv-and, r=lcnr

Be more conservative about discarding caller_bound in `ParamEnv::and`

3 years agoValid underscores in hex/octal/binary literal docs
Smitty [Thu, 8 Apr 2021 21:18:25 +0000 (17:18 -0400)]
Valid underscores in hex/octal/binary literal docs

Currently hex/octal/binary literals with computed values are displayed
like `0_xff_fff_fffu32`, which is invalid since underscores can't be in
the middle of integer prefixes. This properly formats prefixed integers.

3 years agoUpdate `ptr` docs with regards to `ptr::addr_of!`
Julian Frimmel [Sat, 27 Mar 2021 10:44:39 +0000 (11:44 +0100)]
Update `ptr` docs with regards to `ptr::addr_of!`

This updates the documentation since `ptr::addr_of!` and
`ptr::addr_of_mut!` are now stable. One might remove the distinction
between the sections `# On packed structs` and `# Examples`, as the old
section on packed structs was primarily to prevent users of doing unde-
fined behavior, which is not necessary anymore.
There is also a new section in "how to obtain a pointer", which referen-
ces the `ptr::addr_of!` macros.

This commit contains squashed commits from code review.

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Co-authored-by: Soveu <marx.tomasz@gmail.com>
Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoplatform-support: Center the contents of the `std` and `host` columns
Josh Triplett [Mon, 3 May 2021 20:01:40 +0000 (13:01 -0700)]
platform-support: Center the contents of the `std` and `host` columns

3 years agoClarify documentation for `[T]::contains`. Fixes #84877.
Jim Blandy [Mon, 3 May 2021 19:01:16 +0000 (12:01 -0700)]
Clarify documentation for `[T]::contains`. Fixes #84877.

3 years agoCI: Extract LLVM win64 installer directly, using 7z
Josh Triplett [Mon, 3 May 2021 18:23:00 +0000 (11:23 -0700)]
CI: Extract LLVM win64 installer directly, using 7z

Currently, we have LLVM tarballs for win64, generated by someone running
the installer via wine and tarring up the result.

7z knows how to extract NSIS installers directly, and the result is
identical to our tarball, except that it doesn't include `Uninstall.exe`
(which we don't care about) and it includes the NSIS plugin directory
(which we also don't care about).

This simplifies the process of upgrading CI, and allows us to just
mirror the upstream release .exe directly. This also improves our
supply chain.

3 years agoChange `std::sys::unix::ext::fs::PermissionsExt::from_mode` to `std::os::imp::unix...
Christiaan Dirkx [Sun, 25 Apr 2021 11:10:19 +0000 (13:10 +0200)]
Change `std::sys::unix::ext::fs::PermissionsExt::from_mode` to `std::os::imp::unix::fs::PermissionsExt::from_mode` in Clippy

3 years agoAllow documenting on `hermit`
Christiaan Dirkx [Sun, 18 Apr 2021 02:16:02 +0000 (04:16 +0200)]
Allow documenting on `hermit`

3 years agoRework `os` to avoid using `cfg_if!` with public items
Christiaan Dirkx [Wed, 14 Apr 2021 19:36:13 +0000 (21:36 +0200)]
Rework `os` to avoid using `cfg_if!` with public items

3 years agoMove `std::sys::sgx::ext` to `std::os::fortanix_sgx`
Christiaan Dirkx [Thu, 4 Mar 2021 14:45:27 +0000 (15:45 +0100)]
Move `std::sys::sgx::ext` to `std::os::fortanix_sgx`

3 years agoMove `std::sys::wasi::ext` to `std::os::wasi`
Christiaan Dirkx [Thu, 4 Mar 2021 14:39:31 +0000 (15:39 +0100)]
Move `std::sys::wasi::ext` to `std::os::wasi`

3 years agoMove `std::sys::unix::ext` to `std::os::unix`
Christiaan Dirkx [Thu, 4 Mar 2021 14:26:41 +0000 (15:26 +0100)]
Move `std::sys::unix::ext` to `std::os::unix`

3 years agoMove `std::sys::windows::ext` to `std::os::windows`
Christiaan Dirkx [Thu, 4 Mar 2021 14:15:26 +0000 (15:15 +0100)]
Move `std::sys::windows::ext` to `std::os::windows`

3 years agoMove `std::sys::hermit::ext` to `std::os::hermit`
Christiaan Dirkx [Thu, 4 Mar 2021 13:14:44 +0000 (14:14 +0100)]
Move `std::sys::hermit::ext` to `std::os::hermit`

3 years agoCleanup `std::os`
Christiaan Dirkx [Thu, 4 Mar 2021 13:03:26 +0000 (14:03 +0100)]
Cleanup `std::os`

3 years agoAuto merge of #84862 - GuillaumeGomez:rollup-cbc93h4, r=GuillaumeGomez
bors [Mon, 3 May 2021 14:35:12 +0000 (14:35 +0000)]
Auto merge of #84862 - GuillaumeGomez:rollup-cbc93h4, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #84835 (Add link to Issue #34202 in udp docs)
 - #84852 (Change librustdoc write!(.. \n) to writeln!(..); fix comment grammar)
 - #84854 (use double quotes and full path for E0761)
 - #84856 (Correct stability of ErrorKind::OutOfMemory)
 - #84858 (Fix stability attributes of byte-to-string specialization)
 - #84860 (Link to MCP from target tier policy)

Failed merges:

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

3 years agorustbuild: Pass a `threads` flag that works to windows-gnu lld
Vadim Petrochenkov [Mon, 3 May 2021 13:38:11 +0000 (16:38 +0300)]
rustbuild: Pass a `threads` flag that works to windows-gnu lld

MinGW driver for COFF LLD doesn't currently translate GNU-style `--threads=N` to native `/threads:N`, so we have to pass the option in its native form to avoid an error.

Also pass the `threads` flag to lld-link as well

3 years agoUpdate RELEASES.md for 1.52.0
Erin Power [Wed, 14 Apr 2021 09:34:20 +0000 (11:34 +0200)]
Update RELEASES.md for 1.52.0

3 years agoRollup merge of #84860 - badboy:link-to-mcp, r=GuillaumeGomez
Guillaume Gomez [Mon, 3 May 2021 13:08:12 +0000 (15:08 +0200)]
Rollup merge of #84860 - badboy:link-to-mcp, r=GuillaumeGomez

Link to MCP from target tier policy

Promoting new targets requires filing a MCP. Probably good to link to the documentation what that even is.

3 years agoRollup merge of #84858 - LingMan:patch-1, r=JohnTitor
Guillaume Gomez [Mon, 3 May 2021 13:08:11 +0000 (15:08 +0200)]
Rollup merge of #84858 - LingMan:patch-1, r=JohnTitor

Fix stability attributes of byte-to-string specialization

3 years agoRollup merge of #84856 - kornelski:enomem, r=JohnTitor
Guillaume Gomez [Mon, 3 May 2021 13:08:10 +0000 (15:08 +0200)]
Rollup merge of #84856 - kornelski:enomem, r=JohnTitor

Correct stability of ErrorKind::OutOfMemory

Fix for #84744

3 years agoRollup merge of #84854 - hi-rustin:rustin-patch-E0761, r=varkor
Guillaume Gomez [Mon, 3 May 2021 13:08:09 +0000 (15:08 +0200)]
Rollup merge of #84854 - hi-rustin:rustin-patch-E0761, r=varkor

use double quotes and full path for E0761

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

3 years agoRollup merge of #84852 - mautamu:master, r=GuillaumeGomez
Guillaume Gomez [Mon, 3 May 2021 13:08:07 +0000 (15:08 +0200)]
Rollup merge of #84852 - mautamu:master, r=GuillaumeGomez

Change librustdoc write!(.. \n) to writeln!(..); fix comment grammar

Howdy,

This PR does the following:
1. Updates the grammar of a comment in librustdoc.
2. Replaces a few write!(..\n) macros with writeln!(..\n) for clarity. (Please let me know if there is a reason why this might be wrong!)

Best,
Mautamu

3 years agoRollup merge of #84835 - wcampbell0x2a:add-issue-34202-link, r=m-ou-se
Guillaume Gomez [Mon, 3 May 2021 13:08:02 +0000 (15:08 +0200)]
Rollup merge of #84835 - wcampbell0x2a:add-issue-34202-link, r=m-ou-se

Add link to Issue #34202 in udp docs

3 years agoLink to MCP from target tier policy
Jan-Erik Rediger [Mon, 3 May 2021 11:48:56 +0000 (13:48 +0200)]
Link to MCP from target tier policy

3 years agouse `else if` in std library
wcampbell [Mon, 3 May 2021 00:06:17 +0000 (20:06 -0400)]
use `else if` in std library

Clippy: Decreases indentation and improves readability

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
3 years agoFix stability attributes of byte-to-string specialization
LingMan [Mon, 3 May 2021 11:00:34 +0000 (13:00 +0200)]
Fix stability attributes of byte-to-string specialization

3 years agouse full path for E0761
hi-rustin [Mon, 3 May 2021 10:57:48 +0000 (18:57 +0800)]
use full path for E0761

3 years agoAuto merge of #83312 - petrochenkov:noinner, r=Aaron1011
bors [Mon, 3 May 2021 10:56:15 +0000 (10:56 +0000)]
Auto merge of #83312 - petrochenkov:noinner, r=Aaron1011

parser: Remove support for inner attributes on non-block expressions

Remove support for attributes like
```rust
fn attrs() {
    (#![print_target_and_args(fifth)] 1, 2);

    [#![print_target_and_args(sixth)] 1 , 2];
    [#![print_target_and_args(seventh)] true ; 5];

    match 0 {
        #![print_target_and_args(eighth)]
        _ => {}
    }

    MyStruct { #![print_target_and_args(ninth)] field: true };
}
```
They are
- useless
- unstable (modulo holes like https://github.com/rust-lang/rust/issues/65860)
- pessimize compiler performance, namely token collection for macros (cc https://github.com/rust-lang/rust/pull/82608)

I still want to run crater on this to check whether the stability holes are exploited in practice, and whether such attributes are used at all.

3 years agoparser: Remove support for inner attributes on non-block expressions
Vadim Petrochenkov [Fri, 19 Mar 2021 23:52:07 +0000 (02:52 +0300)]
parser: Remove support for inner attributes on non-block expressions

3 years agoCorrect stability of ErrorKind::OutOfMemory
Kornel [Mon, 3 May 2021 09:28:19 +0000 (10:28 +0100)]
Correct stability of ErrorKind::OutOfMemory

3 years agoAuto merge of #84845 - wcampbell0x2a:clippy-redundant-field-names, r=joshtriplett
bors [Mon, 3 May 2021 08:05:12 +0000 (08:05 +0000)]
Auto merge of #84845 - wcampbell0x2a:clippy-redundant-field-names, r=joshtriplett

[clippy] remove redundant field names

3 years agouse double quotes for E0761
hi-rustin [Mon, 3 May 2021 08:02:54 +0000 (16:02 +0800)]
use double quotes for E0761

3 years agoChange librustdoc write(.. \n) to writeln(..); fix comment in grammar
mautamu [Mon, 3 May 2021 07:14:56 +0000 (02:14 -0500)]
Change librustdoc write(.. \n) to writeln(..); fix comment in grammar

More grammar

3 years agoAuto merge of #84842 - blkerby:null_lowercase, r=joshtriplett
bors [Mon, 3 May 2021 05:41:23 +0000 (05:41 +0000)]
Auto merge of #84842 - blkerby:null_lowercase, r=joshtriplett

Replace 'NULL' with 'null'

This replaces occurrences of "NULL" with "null" in docs, comments, and compiler error/lint messages. This is for the sake of consistency, as the lowercase "null" is already the dominant form in Rust. The all-caps NULL looks like the C macro (or SQL keyword), which seems out of place in a Rust context, given that NULL does not exist in the Rust language or standard library (instead having [`ptr::null()`](https://doc.rust-lang.org/stable/std/ptr/fn.null.html)).

3 years ago[clippy] remove redundant field names
wcampbell [Mon, 3 May 2021 00:24:17 +0000 (20:24 -0400)]
[clippy] remove redundant field names

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
3 years agoAuto merge of #84840 - Dylan-DPC:rollup-uzk7w0h, r=Dylan-DPC
bors [Mon, 3 May 2021 00:17:16 +0000 (00:17 +0000)]
Auto merge of #84840 - Dylan-DPC:rollup-uzk7w0h, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #84072 (Allow setting `target_family` to multiple values, and implement `target_family="wasm"`)
 - #84744 (Add ErrorKind::OutOfMemory)
 - #84784 (Add help message to suggest const for unused type param)
 - #84811 (RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo)
 - #84818 (suggestion for unit enum variant when matched with a patern)
 - #84832 (Do not print visibility in external traits)

Failed merges:

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

3 years agoChange 'NULL' to 'null'
Brent Kerby [Sun, 2 May 2021 21:55:22 +0000 (15:55 -0600)]
Change 'NULL' to 'null'

3 years agoAdd link to Issue #34202 in udp docs
wcampbell [Sun, 2 May 2021 20:15:27 +0000 (16:15 -0400)]
Add link to Issue #34202 in udp docs

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
3 years agoRollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514
Dylan DPC [Sun, 2 May 2021 22:32:45 +0000 (00:32 +0200)]
Rollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514

Do not print visibility in external traits

This PR fixes the bug that caused traits, which were re-exported, having visibility modifiers in front of methods, which is invalid.

It would be nice to add a test for this, but I don't even know if tests with multiple crates are possible.

Resolves #81274

3 years agoRollup merge of #84818 - ABouttefeux:enum-suggest, r=jackh726
Dylan DPC [Sun, 2 May 2021 22:32:44 +0000 (00:32 +0200)]
Rollup merge of #84818 - ABouttefeux:enum-suggest, r=jackh726

suggestion for unit enum variant when matched with a patern

resolve #84700

add suggestion for code like
```rust
enum FarmAnimal {
    Worm,
    Cow,
    Bull,
    Chicken { num_eggs: usize },
    Dog (String),
}

fn what_does_the_animal_say(animal: &FarmAnimal) {

    let noise = match animal {
        FarmAnimal::Cow(_) => "moo".to_string(),
        _ => todo!()
    };

    println!("{:?} says: {:?}", animal, noise);
}
```

```
error[E0532]: expected tuple struct or tuple variant, found unit variant `FarmAnimal::Cow`
  --> $DIR/issue-84700.rs:15:9
   |
LL |     Cow,
   |     --- `FarmAnimal::Cow` defined here
...
LL |         FarmAnimal::Cow(_) => "moo".to_string(),
   |         ^^^^^^^^^^^^^^^^^^ help: use this syntax instead: `FarmAnimal::Cow`
   ```

3 years agoRollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514
Dylan DPC [Sun, 2 May 2021 22:32:43 +0000 (00:32 +0200)]
Rollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514

RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo

Fixes #84782

The code was assuming `Trait` when adding bounds to the cache, so add a check on the DefId to see what its kind really is.

r? `@jyn514`

Before:
![image](https://user-images.githubusercontent.com/18526288/116775611-6a751e80-aa53-11eb-84d0-ed6b7782be3c.png)

After:
![image](https://user-images.githubusercontent.com/18526288/116802227-d19cdc80-ab00-11eb-8133-7b34dd750da2.png)

3 years agoRollup merge of #84784 - JulianKnodt:suggest_const, r=lcnr
Dylan DPC [Sun, 2 May 2021 22:32:42 +0000 (00:32 +0200)]
Rollup merge of #84784 - JulianKnodt:suggest_const, r=lcnr

Add help message to suggest const for unused type param

r? `@lcnr`

3 years agoRollup merge of #84744 - kornelski:enomem, r=joshtriplett
Dylan DPC [Sun, 2 May 2021 22:32:41 +0000 (00:32 +0200)]
Rollup merge of #84744 - kornelski:enomem, r=joshtriplett

Add ErrorKind::OutOfMemory

Ability to express `ENOMEM` as an `io::Error`.

I've used `OutOfMemory` as opposed to `NotEnoughMem` or `AllocationFailed`, because "OOM" is used in Rust already.

See also #84612

3 years agoRollup merge of #84072 - nagisa:target-family-two-the-movie, r=petrochenkov
Dylan DPC [Sun, 2 May 2021 22:32:40 +0000 (00:32 +0200)]
Rollup merge of #84072 - nagisa:target-family-two-the-movie, r=petrochenkov

Allow setting `target_family` to multiple values, and implement `target_family="wasm"`

As per the conclusion in [this thread](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233158441), this implements an ability to specify any number of `target_family` values, allowing for more flexible generic groups, or "families", to be created than just the OS-based unix/windows dichotomy.

cc https://github.com/rust-lang/reference/pull/1006

3 years agoAuto merge of #82576 - gilescope:to_string, r=Amanieu
bors [Sun, 2 May 2021 22:01:57 +0000 (22:01 +0000)]
Auto merge of #82576 - gilescope:to_string, r=Amanieu

i8 and u8::to_string() specialisation (far less asm).

Take 2. Around 1/6th of the assembly to without specialisation.

https://godbolt.org/z/bzz8Mq

(partially fixes #73533 )

3 years agoSet target_family="wasm" for wasm targets
Simonas Kazlauskas [Sat, 10 Apr 2021 20:28:58 +0000 (23:28 +0300)]
Set target_family="wasm" for wasm targets

3 years agoAuto merge of #84754 - GuillaumeGomez:toggle-migration, r=jsha
bors [Sun, 2 May 2021 19:46:10 +0000 (19:46 +0000)]
Auto merge of #84754 - GuillaumeGomez:toggle-migration, r=jsha

Migrate trait and impl blocks' toggles into

Part of #83332

After this, I think only the "global" doc comment will be used as JS toggle. Once this PR is merged, I check what remains and remove them.

There is one change that this PR brings:

![Screenshot from 2021-04-30 15-39-04](https://user-images.githubusercontent.com/3050060/116713412-0f9ce200-a9d5-11eb-979c-2e7a73d16706.png)
![Screenshot from 2021-04-30 15-39-07](https://user-images.githubusercontent.com/3050060/116713415-10357880-a9d5-11eb-9868-1ba9e5ebf65e.png)

As you can see, I had to move the "undocumented" items below, they're not mixed with the others anymore. Unfortunately, I don't see a way to keep the current appearance without JS. As a a reminder, currently it looks like this:

![Screenshot from 2021-04-30 15-39-12](https://user-images.githubusercontent.com/3050060/116713547-31966480-a9d5-11eb-90bb-686042eefeec.png)
![Screenshot from 2021-04-30 15-39-15](https://user-images.githubusercontent.com/3050060/116713549-322efb00-a9d5-11eb-94a9-cfea073120db.png)

r? `@jsha`

3 years agoPR feedback
Scott McMurray [Sun, 2 May 2021 19:11:13 +0000 (12:11 -0700)]
PR feedback

3 years agoDo not print visibility in external traits
Justus K [Sun, 2 May 2021 17:39:33 +0000 (19:39 +0200)]
Do not print visibility in external traits

3 years agoUse new thread-local const-init
Mark Rousskov [Sun, 2 May 2021 18:04:25 +0000 (14:04 -0400)]
Use new thread-local const-init

Let's see if this gives us any speedup - some of the TLS state modified in this
commit *is* pretty heavily accessed, so we can hope!

3 years agoImprove code readability
Guillaume Gomez [Sat, 1 May 2021 18:41:00 +0000 (20:41 +0200)]
Improve code readability

3 years agoAuto merge of #84822 - Dylan-DPC:rollup-wego8d6, r=Dylan-DPC
bors [Sun, 2 May 2021 15:01:52 +0000 (15:01 +0000)]
Auto merge of #84822 - Dylan-DPC:rollup-wego8d6, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #84358 (Update closure capture error logging for disjoint captures for disjoint captures)
 - #84392 (Make AssertKind::fmt_assert_args public)
 - #84752 (Fix debuginfo for generators)
 - #84763 (shrink doctree::Module)
 - #84821 (Fix nit in rustc_session::options)

Failed merges:

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

3 years agoRollup merge of #84821 - jyn514:fix-nit, r=Mark-Simulacrum
Dylan DPC [Sun, 2 May 2021 15:00:25 +0000 (17:00 +0200)]
Rollup merge of #84821 - jyn514:fix-nit, r=Mark-Simulacrum

Fix nit in rustc_session::options

Addresses https://github.com/rust-lang/rust/pull/84802#discussion_r624578203 - I never actually pushed the commit before that PR got merged.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514
Dylan DPC [Sun, 2 May 2021 15:00:24 +0000 (17:00 +0200)]
Rollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514

shrink doctree::Module

helps https://github.com/rust-lang/rust/issues/76382

3 years agoRollup merge of #84752 - lrh2000:generator-debuginfo, r=tmandry
Dylan DPC [Sun, 2 May 2021 15:00:23 +0000 (17:00 +0200)]
Rollup merge of #84752 - lrh2000:generator-debuginfo, r=tmandry

Fix debuginfo for generators

First, all fields except the discriminant (including `outer_fields`) should be put into structures inside the variant part, which gives an equivalent layout but offers us much better integration with debuggers.

Second, artificial flags in generator variants should be removed.
 - Literally, variants are not artificial. We have `yield` statements, upvars and inner variables in the source code.
 - Functionally, we don't want debuggers to suppress the variants. It contains the state of the generator, which is useful when debugging. So they shouldn't be marked artificial.
 - Debuggers may use artificial flags to find the active variant. In this case, marking variants artificial will make debuggers not work properly.

Fixes #62572.
Fixes #79009.

And refer https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Debuginfo.20for.20generators.

3 years agoRollup merge of #84392 - dario23:fmt-assert-args-pub, r=varkor,RalfJung
Dylan DPC [Sun, 2 May 2021 15:00:22 +0000 (17:00 +0200)]
Rollup merge of #84392 - dario23:fmt-assert-args-pub, r=varkor,RalfJung

Make AssertKind::fmt_assert_args public

3 years agoRollup merge of #84358 - sexxi-goose:print_captures_borrowck_rebased, r=nikomatsakis
Dylan DPC [Sun, 2 May 2021 15:00:21 +0000 (17:00 +0200)]
Rollup merge of #84358 - sexxi-goose:print_captures_borrowck_rebased, r=nikomatsakis

Update closure capture error logging for disjoint captures for disjoint captures

Improved error logging when `#![feature(capture_disjoint_fields)]` is used.

Closes https://github.com/rust-lang/project-rfc-2229/issues/8
Closes https://github.com/rust-lang/project-rfc-2229/issues/36
Closes https://github.com/rust-lang/project-rfc-2229/issues/39
Closes #76005

3 years agoFix nit in rustc_session::options
Joshua Nelson [Sun, 2 May 2021 14:08:08 +0000 (10:08 -0400)]
Fix nit in rustc_session::options

3 years agoUpdate tests
Guillaume Gomez [Fri, 30 Apr 2021 13:29:24 +0000 (15:29 +0200)]
Update tests

3 years agoAdd missing CSS rules for associated types
Guillaume Gomez [Fri, 30 Apr 2021 14:50:03 +0000 (16:50 +0200)]
Add missing CSS rules for associated types

3 years agoMigrate trait and impl blocks' toggles into
Guillaume Gomez [Wed, 28 Apr 2021 19:19:52 +0000 (21:19 +0200)]
Migrate trait and impl blocks' toggles into

3 years agoadd suggestion for unit enum variant when matched with a patern
Aliénore Bouttefeux [Sun, 2 May 2021 09:46:29 +0000 (11:46 +0200)]
add suggestion for unit enum variant when matched with a patern

3 years agoAuto merge of #84802 - jyn514:option-dead-code, r=Mark-Simulacrum
bors [Sun, 2 May 2021 11:43:39 +0000 (11:43 +0000)]
Auto merge of #84802 - jyn514:option-dead-code, r=Mark-Simulacrum

Remove dead code in `rustc_session::Options`

- Don't recompile the same functions for each debugging option
  This reduces the amount of items in the crate by quite a lot.
- Remove unused `parse_opt_list` and `parse_pathbuf_push` functions
- Remove unused macro parameters
- Remove `allow(dead_code)`.

3 years agoUse ErrorKind::OutOfMemory in unix, windows, and wasi
Kornel [Fri, 30 Apr 2021 11:34:32 +0000 (12:34 +0100)]
Use ErrorKind::OutOfMemory in unix, windows, and wasi

3 years agoAdd ErrorKind::OutOfMemory
Kornel [Fri, 30 Apr 2021 11:15:38 +0000 (12:15 +0100)]
Add ErrorKind::OutOfMemory

3 years agoAuto merge of #84805 - Mark-Simulacrum:no-dup-extend, r=cjgillot
bors [Sun, 2 May 2021 09:22:13 +0000 (09:22 +0000)]
Auto merge of #84805 - Mark-Simulacrum:no-dup-extend, r=cjgillot

Avoid generating QueryMap::extend for each key type

Should be a small win on compile times for rustc_query_impl, where this ends up getting codegen'd.

3 years agofix nll test stderr
Chris Pardy [Sun, 2 May 2021 08:01:45 +0000 (04:01 -0400)]
fix nll test stderr

3 years agoAuto merge of #84750 - jyn514:nix-cargo, r=Mark-Simulacrum
bors [Sun, 2 May 2021 07:09:38 +0000 (07:09 +0000)]
Auto merge of #84750 - jyn514:nix-cargo, r=Mark-Simulacrum

Don't download cargo twice when download-rustc is set

Previously, this caused a bug on NixOS:

1. bootstrap.py would download and patch stage0/cargo
2. bootstrap.py would download nightly cargo, but extract it to
   stage0/cargo instead of ci-rustc/cargo. It would still try (and fail) to patch ci-rustc/cargo.
3. bootstrap.py would fail to build rustbuild because stage0/cargo
   wasn't patched.

The "proper" fix is to extract nightly cargo to ci-rustc instead, but it
doesn't seem to be necessary at all, so this just skips downloading it
instead.

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