]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #83568 - RalfJung:uninit_array, r=dtolnay
Dylan DPC [Tue, 30 Mar 2021 09:34:23 +0000 (11:34 +0200)]
Rollup merge of #83568 - RalfJung:uninit_array, r=dtolnay

update comment at MaybeUninit::uninit_array

https://github.com/rust-lang/rust/issues/49147 is closed; this now instead needs inline const expressions (#76001).

3 years agoAuto merge of #83649 - bjorn3:dedup_providers, r=petrochenkov
bors [Tue, 30 Mar 2021 06:22:29 +0000 (06:22 +0000)]
Auto merge of #83649 - bjorn3:dedup_providers, r=petrochenkov

Don't duplicate the extern providers once for each crate

This should give a small perf improvement for small crates by avoiding a memcpy of a pretty big struct for each loaded crate. In addition would be useful for replacing the sequential `CrateNum` everywhere with the hash based `StableCrateId` introduced in #81635, which would allow avoiding remapping of `CrateNum`'s when loading crate metadata. While this PR is not strictly needed for that, it is necessary to prevent a performance loss due to it.

I think this duplication was done in https://github.com/rust-lang/rust/pull/40008 (which introduced the query system) to make it possible to compile multiple crates in a single session in the future. I think this is unlikely to be implemented any time soon. In addition this PR can easily be reverted if necessary to implement this.

3 years agoAuto merge of #83357 - saethlin:vec-reserve-inlining, r=dtolnay
bors [Tue, 30 Mar 2021 03:41:14 +0000 (03:41 +0000)]
Auto merge of #83357 - saethlin:vec-reserve-inlining, r=dtolnay

Reduce the impact of Vec::reserve calls that do not cause any allocation

I think a lot of callers expect `Vec::reserve` to be nearly free when no resizing is required, but unfortunately that isn't the case. LLVM makes remarkably poor inlining choices (along the path from `Vec::reserve` to `RawVec::grow_amortized`), so depending on the surrounding context you either get a huge blob of `RawVec`'s resizing logic inlined into some seemingly-unrelated function, or not enough inlining happens and/or the actual check in `needs_to_grow` ends up behind a function call. My goal is to make the codegen for `Vec::reserve` match the mental that callers seem to have: It's reliably just a `sub cmp ja` if there is already sufficient capacity.

This patch has the following impact on the serde_json benchmarks: https://github.com/serde-rs/json-benchmark/tree/ca3efde8a5b75ff59271539b67452911860248c7 run with `cargo +stage1 run --release -- -n 1024`

Before:
```
                                DOM                  STRUCT
======= serde_json ======= parse|stringify ===== parse|stringify ====
data/canada.json         340 MB/s   490 MB/s   630 MB/s   370 MB/s
data/citm_catalog.json   460 MB/s   540 MB/s  1010 MB/s   550 MB/s
data/twitter.json        330 MB/s   840 MB/s   640 MB/s   630 MB/s

======= json-rust ======== parse|stringify ===== parse|stringify ====
data/canada.json         580 MB/s   990 MB/s
data/citm_catalog.json   720 MB/s   660 MB/s
data/twitter.json        570 MB/s   960 MB/s
```

After:
```
                                DOM                  STRUCT
======= serde_json ======= parse|stringify ===== parse|stringify ====
data/canada.json         330 MB/s   510 MB/s   610 MB/s   380 MB/s
data/citm_catalog.json   450 MB/s   640 MB/s   970 MB/s   830 MB/s
data/twitter.json        330 MB/s   880 MB/s   670 MB/s   960 MB/s

======= json-rust ======== parse|stringify ===== parse|stringify ====
data/canada.json         560 MB/s  1130 MB/s
data/citm_catalog.json   710 MB/s   880 MB/s
data/twitter.json        530 MB/s  1230 MB/s

```

That's approximately a one-third increase in throughput on two of the benchmarks, and no effect on one (The benchmark suite has sufficient jitter that I could pick a run where there are no regressions, so I'm not convinced they're meaningful here).

This also produces perf increases on the order of 3-5% in a few other microbenchmarks that I'm tracking. It might be useful to see if this has a cascading effect on inlining choices in some large codebases.

Compiling this simple program demonstrates the change in codegen that causes the perf impact:
```rust
fn main() {
    reserve(&mut Vec::new());
}

#[inline(never)]
fn reserve(v: &mut Vec<u8>) {
    v.reserve(1234);
}
```

Before:
```rust
00000000000069b0 <scratch::reserve>:
    69b0:       53                      push   %rbx
    69b1:       48 83 ec 30             sub    $0x30,%rsp
    69b5:       48 8b 47 08             mov    0x8(%rdi),%rax
    69b9:       48 8b 4f 10             mov    0x10(%rdi),%rcx
    69bd:       48 89 c2                mov    %rax,%rdx
    69c0:       48 29 ca                sub    %rcx,%rdx
    69c3:       48 81 fa d1 04 00 00    cmp    $0x4d1,%rdx
    69ca:       77 73                   ja     6a3f <scratch::reserve+0x8f>
    69cc:       48 81 c1 d2 04 00 00    add    $0x4d2,%rcx
    69d3:       72 75                   jb     6a4a <scratch::reserve+0x9a>
    69d5:       48 89 fb                mov    %rdi,%rbx
    69d8:       48 8d 14 00             lea    (%rax,%rax,1),%rdx
    69dc:       48 39 ca                cmp    %rcx,%rdx
    69df:       48 0f 47 ca             cmova  %rdx,%rcx
    69e3:       48 83 f9 08             cmp    $0x8,%rcx
    69e7:       be 08 00 00 00          mov    $0x8,%esi
    69ec:       48 0f 47 f1             cmova  %rcx,%rsi
    69f0:       48 85 c0                test   %rax,%rax
    69f3:       74 17                   je     6a0c <scratch::reserve+0x5c>
    69f5:       48 8b 0b                mov    (%rbx),%rcx
    69f8:       48 89 0c 24             mov    %rcx,(%rsp)
    69fc:       48 89 44 24 08          mov    %rax,0x8(%rsp)
    6a01:       48 c7 44 24 10 01 00    movq   $0x1,0x10(%rsp)
    6a08:       00 00
    6a0a:       eb 08                   jmp    6a14 <scratch::reserve+0x64>
    6a0c:       48 c7 04 24 00 00 00    movq   $0x0,(%rsp)
    6a13:       00
    6a14:       48 8d 7c 24 18          lea    0x18(%rsp),%rdi
    6a19:       48 89 e1                mov    %rsp,%rcx
    6a1c:       ba 01 00 00 00          mov    $0x1,%edx
    6a21:       e8 9a fe ff ff          call   68c0 <alloc::raw_vec::finish_grow>
    6a26:       48 8b 7c 24 20          mov    0x20(%rsp),%rdi
    6a2b:       48 8b 74 24 28          mov    0x28(%rsp),%rsi
    6a30:       48 83 7c 24 18 01       cmpq   $0x1,0x18(%rsp)
    6a36:       74 0d                   je     6a45 <scratch::reserve+0x95>
    6a38:       48 89 3b                mov    %rdi,(%rbx)
    6a3b:       48 89 73 08             mov    %rsi,0x8(%rbx)
    6a3f:       48 83 c4 30             add    $0x30,%rsp
    6a43:       5b                      pop    %rbx
    6a44:       c3                      ret
    6a45:       48 85 f6                test   %rsi,%rsi
    6a48:       75 08                   jne    6a52 <scratch::reserve+0xa2>
    6a4a:       ff 15 38 c4 03 00       call   *0x3c438(%rip)        # 42e88 <_GLOBAL_OFFSET_TABLE_+0x490>
    6a50:       0f 0b                   ud2
    6a52:       ff 15 f0 c4 03 00       call   *0x3c4f0(%rip)        # 42f48 <_GLOBAL_OFFSET_TABLE_+0x550>
    6a58:       0f 0b                   ud2
    6a5a:       66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
```

After:
```asm
0000000000006910 <scratch::reserve>:
    6910:       48 8b 47 08             mov    0x8(%rdi),%rax
    6914:       48 8b 77 10             mov    0x10(%rdi),%rsi
    6918:       48 29 f0                sub    %rsi,%rax
    691b:       48 3d d1 04 00 00       cmp    $0x4d1,%rax
    6921:       77 05                   ja     6928 <scratch::reserve+0x18>
    6923:       e9 e8 fe ff ff          jmp    6810 <alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle>
    6928:       c3                      ret
    6929:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
```

3 years agoAuto merge of #83664 - Dylan-DPC:rollup-wx6idpd, r=Dylan-DPC
bors [Tue, 30 Mar 2021 01:16:08 +0000 (01:16 +0000)]
Auto merge of #83664 - Dylan-DPC:rollup-wx6idpd, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #82331 (alloc: Added `as_slice` method to `BinaryHeap` collection)
 - #83130 (escape_ascii take 2)
 - #83374 (unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs)
 - #83543 (Lint on unknown intra-doc link disambiguators)
 - #83636 (Add a regression test for issue-82792)
 - #83643 (Remove a FIXME resolved by #73578)
 - #83644 (:arrow_up: rust-analyzer)

Failed merges:

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

3 years agoRollup merge of #83644 - lnicola:rust-analyzer-2021-03-29, r=jonas-schievink
Dylan DPC [Mon, 29 Mar 2021 22:32:25 +0000 (00:32 +0200)]
Rollup merge of #83644 - lnicola:rust-analyzer-2021-03-29, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #83643 - JohnTitor:is-freeze-no-longer-uses-span, r=RalfJung
Dylan DPC [Mon, 29 Mar 2021 22:32:24 +0000 (00:32 +0200)]
Rollup merge of #83643 - JohnTitor:is-freeze-no-longer-uses-span, r=RalfJung

Remove a FIXME resolved by #73578

r? ``@RalfJung``

3 years agoRollup merge of #83636 - JohnTitor:const-generics-defualts-regg-test, r=lcnr
Dylan DPC [Mon, 29 Mar 2021 22:32:23 +0000 (00:32 +0200)]
Rollup merge of #83636 - JohnTitor:const-generics-defualts-regg-test, r=lcnr

Add a regression test for issue-82792

Closes #82792

r? ``@lcnr``

3 years agoRollup merge of #83543 - camelid:lint-unknown-disambiguator, r=jyn514
Dylan DPC [Mon, 29 Mar 2021 22:32:22 +0000 (00:32 +0200)]
Rollup merge of #83543 - camelid:lint-unknown-disambiguator, r=jyn514

Lint on unknown intra-doc link disambiguators

3 years agoRollup merge of #83374 - reyk:fix/bsd-ancillary, r=joshtriplett
Dylan DPC [Mon, 29 Mar 2021 22:32:21 +0000 (00:32 +0200)]
Rollup merge of #83374 - reyk:fix/bsd-ancillary, r=joshtriplett

unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs

This adds support for CMSG handling on macOS and fixes it on OpenBSD and possibly other BSDs.

When traversing the CMSG list, the previous code had an exception for Android where the next element after the last pointer could point to the first pointer instead of NULL.  This is actually not specific to Android: the `libc::CMSG_NXTHDR` implementation for Linux and emscripten have a special case to return NULL when the length of the previous element is zero; most other implementations simply return the previous element plus a zero offset in this case.

This MR makes the check non-optional which fixes CMSG handling and a possible endless loop on such systems; tested with file descriptor passing on OpenBSD, Linux, and macOS.

This MR additionally adds `SocketAncillary::is_empty` because clippy is right that it should be added.

This belongs to the `feature(unix_socket_ancillary_data)` tracking issue:  https://github.com/rust-lang/rust/issues/76915

r? `@joshtriplett`

3 years agoRollup merge of #83130 - clarfonthey:escape, r=m-ou-se
Dylan DPC [Mon, 29 Mar 2021 22:32:20 +0000 (00:32 +0200)]
Rollup merge of #83130 - clarfonthey:escape, r=m-ou-se

escape_ascii take 2

The previous PR, #73111 was closed for inactivity; since I've had trouble in the past reopening closed PRs, I'm just making a new one.

I'm still running the tests locally but figured I'd open the PR in the meantime. Will fix whatever errors show up so we don't have to wait again for this.

r? ``@m-ou-se``

3 years agoRollup merge of #82331 - frol:feat/std-binary-heap-as-slice, r=Amanieu
Dylan DPC [Mon, 29 Mar 2021 22:32:18 +0000 (00:32 +0200)]
Rollup merge of #82331 - frol:feat/std-binary-heap-as-slice, r=Amanieu

alloc: Added `as_slice` method to `BinaryHeap` collection

I initially asked about whether it is useful addition on https://internals.rust-lang.org/t/should-i-add-as-slice-method-to-binaryheap/13816, and it seems there were no objections, so went ahead with this PR.

> There is [`BinaryHeap::into_vec`](https://doc.rust-lang.org/std/collections/struct.BinaryHeap.html#method.into_vec), but it consumes the value. I wonder if there is API design limitation that should be taken into account. Implementation-wise, the inner buffer is just a Vec, so it is trivial to expose as_slice from it.

Please, guide me through if I need to add tests or something else.

UPD: Tracking issue #83659

3 years agoAuto merge of #82864 - jyn514:short-circuit, r=GuillaumeGomez
bors [Mon, 29 Mar 2021 22:27:16 +0000 (22:27 +0000)]
Auto merge of #82864 - jyn514:short-circuit, r=GuillaumeGomez

rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls

Less broken version of https://github.com/rust-lang/rust/pull/82856.

get_blanket_impls is a *very* hot region of rustdoc, so even small changes like this should help. Unfortunately I don't have benchmarks for this until https://github.com/rust-lang/rustc-perf/pull/802 is merged.

3 years agoUpdated the tracking issue #
Vlad Frolov [Mon, 29 Mar 2021 19:44:48 +0000 (22:44 +0300)]
Updated the tracking issue #

3 years agoAuto merge of #83185 - jyn514:remove-dead-code, r=oli-obk
bors [Mon, 29 Mar 2021 19:44:27 +0000 (19:44 +0000)]
Auto merge of #83185 - jyn514:remove-dead-code, r=oli-obk

Remove (lots of) dead code

Builds on
- [ ] https://github.com/rust-lang/rust/pull/83161
- [x] https://github.com/rust-lang/rust/pull/83230
- [x] https://github.com/rust-lang/rust/pull/83197.

Found with https://github.com/est31/warnalyzer.
See https://github.com/rust-lang/rust/pull/77739 for a similar change in the past.

Dubious changes:
- Maybe some of the dead code in rustc_data_structures should be kept, in case someone wants to use it in the future?

TODO:
- [ ] check if any of the comments on the deleted code should be kept.
- [x] update the compiler documentation; right now it fails to build
- [x] finish moving `cfg(test)` changes into https://github.com/rust-lang/rust/pull/83197

cc `@est31`

3 years agoRevert changes to sync data structures
Joshua Nelson [Mon, 29 Mar 2021 17:50:40 +0000 (13:50 -0400)]
Revert changes to sync data structures

There isn't currently a good reviewer for these, and I don't want to
remove things that will just be added again. I plan to make a separate
PR for these changes so the rest of the cleanup can land.

3 years agoAuto merge of #80839 - tblah:riscv64linux_links, r=Mark-Simulacrum
bors [Mon, 29 Mar 2021 16:48:45 +0000 (16:48 +0000)]
Auto merge of #80839 - tblah:riscv64linux_links, r=Mark-Simulacrum

Riscv64linux Test fixes

Get tests passing again using the riscv64gc-unknown-linux-gnu docker image.

Test with
```
src/ci/docker/run.sh riscv64gc-linux
```

## linkcheck
Linkcheck tests that interdocument links in the documentation are correct. Some interdocument links go between rustc and tools (such as rustdoc and cargo). When cross compiling, rustc is built for the host while some tools are built for the target. This goes for the documentation too. Because of this, links in the rustc documentation reffering to cargo or rustdoc documentation look broken.

This issue is worked around by disabling linkcheck for cross compilation builds.

## run-make tests

#78911 seems to happen because `--target` was not passed to `rustc`, but the target linker was specified, causing the target linker to be called with options intended for the host.

Resolves #78911

In a separate issue, `issue-36710` was trying to run a binary built for the target on the host system. This will not work for any platform using `remote-test-server`/`client` (such as riscv64). I don't know of a way of skipping those platforms specifically, so I set this test to skip only on riscv64 for now.

3 years agoDon't duplicate the extern providers once for each crate
bjorn3 [Mon, 29 Mar 2021 16:03:07 +0000 (18:03 +0200)]
Don't duplicate the extern providers once for each crate

3 years agoAuto merge of #83609 - klensy:c-str, r=m-ou-se
bors [Mon, 29 Mar 2021 14:07:32 +0000 (14:07 +0000)]
Auto merge of #83609 - klensy:c-str, r=m-ou-se

ffi::c_str removed bound checks on as_bytes, to_bytes

This removes bound checks on CString::as_bytes() and CStr::to_bytes() and adds test.

3 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 29 Mar 2021 13:12:26 +0000 (16:12 +0300)]
:arrow_up: rust-analyzer

3 years agoRemove a FIXME resolved by #73578
JohnTitor [Mon, 29 Mar 2021 12:41:50 +0000 (21:41 +0900)]
Remove a FIXME resolved by #73578

3 years agoffi::c_str smaller as_bytes
klensy [Sun, 28 Mar 2021 16:55:09 +0000 (19:55 +0300)]
ffi::c_str smaller as_bytes

3 years agoAuto merge of #83637 - bjorn3:sync_cg_clif-2021-03-29, r=bjorn3
bors [Mon, 29 Mar 2021 11:20:25 +0000 (11:20 +0000)]
Auto merge of #83637 - bjorn3:sync_cg_clif-2021-03-29, r=bjorn3

Sync rustc_codegen_cranelift

The main highlight of this sync is support for cross-compiling to Windows using MinGW. Native compilation with MinGW would also work I think, but using the MSVC toolchain is not yet supported as PE TLS is not yet implemented. Another nice improvement is that crate metadata is now loaded using mmap instead of by reading files. This improves compilation time a bit.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

3 years agoMerge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into sync_cg_clif-2021-03-29
bjorn3 [Mon, 29 Mar 2021 08:45:09 +0000 (10:45 +0200)]
Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into sync_cg_clif-2021-03-29

3 years agoPrefer 4 spaces
JohnTitor [Mon, 29 Mar 2021 08:32:27 +0000 (17:32 +0900)]
Prefer 4 spaces

3 years agoAdd a regression test for issue-82792
JohnTitor [Mon, 29 Mar 2021 08:31:12 +0000 (17:31 +0900)]
Add a regression test for issue-82792

3 years agoAuto merge of #83565 - RalfJung:miri, r=oli-obk
bors [Mon, 29 Mar 2021 08:27:59 +0000 (08:27 +0000)]
Auto merge of #83565 - RalfJung:miri, r=oli-obk

update Miri, and also run test suite with mir-opt-level=4

In the Miri repo, we run the Miri test suite once with default flags and once with `-O -Zmir-opt-level=4`. This helps identify and document situations where MIR optimizations mask UB -- it is okay for that to happen, but it might be god to look into it when it does happen. Recently these tests failed fairly frequently as new MIR optimizations were added, and since we only run them on the Miri side, it is not even clear which rustc PR introduced the change. So I propose we also run these tests in the rustc repo, such that toolstate tracking will tell us the exact PR (or at least the rollup) that caused the change.

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/83590

3 years agoRustup to rustc 1.53.0-nightly (4a20eb6a9 2021-03-28)
bjorn3 [Mon, 29 Mar 2021 08:26:20 +0000 (10:26 +0200)]
Rustup to rustc 1.53.0-nightly (4a20eb6a9 2021-03-28)

3 years agoInline `find_suffix` closure that's only used once
Camelid [Mon, 29 Mar 2021 00:22:45 +0000 (17:22 -0700)]
Inline `find_suffix` closure that's only used once

3 years agoAdd test for weird backticks placement
Camelid [Mon, 29 Mar 2021 00:16:54 +0000 (17:16 -0700)]
Add test for weird backticks placement

3 years agoPoint to disambiguator instead of whole link
Camelid [Mon, 29 Mar 2021 00:02:26 +0000 (17:02 -0700)]
Point to disambiguator instead of whole link

And, now that we do that, we can remove the explanatory note since the
error span should make it clear what the disambiguator is.

3 years agoAuto merge of #83605 - RalfJung:unaligned, r=petrochenkov
bors [Mon, 29 Mar 2021 00:17:23 +0000 (00:17 +0000)]
Auto merge of #83605 - RalfJung:unaligned, r=petrochenkov

unaligned_references: align(N) fields in packed(N) structs are fine

This removes some false positives from the unaligned_references lint: in a `repr(packed(2))` struct, fields of alignment 2 (and less) are guaranteed to be properly aligned, so we do not have to consider them "disaligned".

3 years agoAdd escape_default method to u8 and [u8]
ltdk [Sat, 24 Oct 2020 04:45:41 +0000 (00:45 -0400)]
Add escape_default method to u8 and [u8]

3 years agoAuto merge of #83619 - petrochenkov:nx, r=nagisa
bors [Sun, 28 Mar 2021 21:36:27 +0000 (21:36 +0000)]
Auto merge of #83619 - petrochenkov:nx, r=nagisa

linker: Use data execution prevention options by default when linker supports them

Do it in a centralized way in `link.rs` instead of individual target specs.
r? `@nagisa`

3 years agolinker: Use data execution prevention options by default when linker supports them
Vadim Petrochenkov [Sun, 28 Mar 2021 20:18:39 +0000 (23:18 +0300)]
linker: Use data execution prevention options by default when linker supports them

3 years agoAuto merge of #83602 - JohnTitor:cloudabi-flag-is-unnecessary, r=Xanewok
bors [Sun, 28 Mar 2021 17:05:52 +0000 (17:05 +0000)]
Auto merge of #83602 - JohnTitor:cloudabi-flag-is-unnecessary, r=Xanewok

Remove unnecessary `ignore-cloudabi` flag

...since we dropped the CloudABI support.

3 years agoffi::c_str added tests for empty strings
klensy [Sun, 28 Mar 2021 16:34:38 +0000 (19:34 +0300)]
ffi::c_str added tests for empty strings

3 years agotest: run-make: skip tests on unsupported platforms
Tom Eccles [Tue, 16 Mar 2021 18:22:21 +0000 (18:22 +0000)]
test: run-make: skip tests on unsupported platforms

The tests issue-36710 and incr-prev-body-beyond-eof were changed in a
previous commit so that the correct target was passed to rustc
(previously rustc was building for the host not for the specific
target).

Since that change it turns out that these platforms never worked (they
only appeared to work because rustc was actually building for the host
architecture).

The wasm architectures fall over trying to build the C++ file in
issue-36710. They look for clang (which isn't installed in the
test-various docker container). If clang is installed, they can't find
a wasm c++ standard library to link to.

nvtptx64-nvidia-cuda fails in rustc saying it can't find std. The rust
platforms support page says that std is supported on cuda so this is
surprising.

dist-i586-gnu-i586-i686-musl can't find the C++ compiler. There is only
a musl-gcc and no musl-g++ in /musl-i586/bin/. The Docker image probably
needs tweaking.

3 years agotest: run-make: flag tests which won't work in no-std environments
Tom Eccles [Mon, 15 Mar 2021 18:00:14 +0000 (18:00 +0000)]
test: run-make: flag tests which won't work in no-std environments

3 years agoci: docker: x86_64: specify host explicitly
Tom Eccles [Sun, 21 Feb 2021 19:32:16 +0000 (19:32 +0000)]
ci: docker: x86_64: specify host explicitly

3 years agobootstrap: don't run linkcheck when crosscompiling
Tom Eccles [Sun, 21 Feb 2021 11:19:50 +0000 (11:19 +0000)]
bootstrap: don't run linkcheck when crosscompiling

When we cross compile, some things (and their documentation) are built
for the host (e.g. rustc), while others (and their documentation) are built
for the target. This generated documentation will have broken links
between documentation for different platforms e.g. between rustc and
cargo.

3 years agoci: docker: riscv64gc: specify host explicitly
Tom Eccles [Sat, 20 Feb 2021 19:31:28 +0000 (19:31 +0000)]
ci: docker: riscv64gc: specify host explicitly

3 years agorun-make: skip issue-36710 on riscv64 and armhf
Tom Eccles [Mon, 11 Jan 2021 18:24:54 +0000 (18:24 +0000)]
run-make: skip issue-36710 on riscv64 and armhf

The test assumes it can run target binaries on the host. This not true
for riscv64 CI (or for other platforms using remote-test-server).

3 years agorun-make: Specify --target to rustc
Tom Eccles [Sat, 9 Jan 2021 22:54:21 +0000 (22:54 +0000)]
run-make: Specify --target to rustc

Resolves #78911

The target's linker was used but rustc wasn't told to build for that
target (instead defaulting to the host). This led to the host instead of
the target getting tested and to the linker getting inappropriate
arguments.

3 years agoAuto merge of #83582 - jyn514:might-not, r=joshtriplett
bors [Sun, 28 Mar 2021 14:16:03 +0000 (14:16 +0000)]
Auto merge of #83582 - jyn514:might-not, r=joshtriplett

may not -> might not

may not -> might not

"may not" has two possible meanings:
1. A command: "You may not stay up past your bedtime."
2. A fact that's only sometimes true: "Some cities may not have bike lanes."

In some cases, the meaning is ambiguous: "Some cars may not have snow
tires." (do the cars *happen* to not have snow tires, or is it
physically impossible for them to have snow tires?)

This changes places where the standard library uses the "description of
fact" meaning to say "might not" instead.

This is just `std::vec` for now - if you think this is a good idea I can
convert the rest of the standard library.

3 years agoadjust old test
Ralf Jung [Sun, 28 Mar 2021 11:54:27 +0000 (13:54 +0200)]
adjust old test

3 years agoAuto merge of #83577 - geeklint:slice_to_ascii_case_doc_links, r=m-ou-se
bors [Sun, 28 Mar 2021 11:34:55 +0000 (11:34 +0000)]
Auto merge of #83577 - geeklint:slice_to_ascii_case_doc_links, r=m-ou-se

Adjust documentation links for slice::make_ascii_*case

The documentation for the functions `slice::to_ascii_lowercase` and `slice::to_ascii_uppercase` contain the suggestion

> To lowercase the value in-place, use `make_ascii_lowercase`

however the link to the suggested method takes you to the page for `u8`, rather than the method of that name on the same page.

3 years agounaligned_references: align(N) fields in packed(N) structs are fine
Ralf Jung [Sun, 28 Mar 2021 10:50:20 +0000 (12:50 +0200)]
unaligned_references: align(N) fields in packed(N) structs are fine

3 years agoupdate Miri
Ralf Jung [Sat, 27 Mar 2021 13:23:29 +0000 (14:23 +0100)]
update Miri

3 years agoAuto merge of #83593 - petrochenkov:nounwrap, r=nagisa
bors [Sun, 28 Mar 2021 08:53:51 +0000 (08:53 +0000)]
Auto merge of #83593 - petrochenkov:nounwrap, r=nagisa

rustc_target: Avoid unwraps when adding linker flags

These `unwrap`s assume that some linker flags were already added by `*_base::opts()` methods, but that's doesn't necessarily remain the case when we are reducing the number of flags hardcoded in targets, as https://github.com/rust-lang/rust/pull/83587 shows.

r? `@nagisa`

3 years agoRemove unnecessary `ignore-cloudabi` flag
JohnTitor [Sun, 28 Mar 2021 06:34:59 +0000 (15:34 +0900)]
Remove unnecessary `ignore-cloudabi` flag

3 years agoAuto merge of #81728 - Qwaz:fix-80335, r=joshtriplett
bors [Sun, 28 Mar 2021 06:32:34 +0000 (06:32 +0000)]
Auto merge of #81728 - Qwaz:fix-80335, r=joshtriplett

Fixes API soundness issue in join()

Fixes #80335

3 years agoAuto merge of #81354 - SkiFire13:binary-search-assume, r=nagisa
bors [Sun, 28 Mar 2021 03:51:22 +0000 (03:51 +0000)]
Auto merge of #81354 - SkiFire13:binary-search-assume, r=nagisa

Instruct LLVM that binary_search returns a valid index

This allows removing bound checks when the return value of `binary_search` is used to index into the slice it was call on. I also added a codegen test for this, not sure if it's the right thing to do (I didn't find anything on the dev guide), but it felt so.

3 years agoAddress more review comments
Joshua Nelson [Sun, 28 Mar 2021 02:16:17 +0000 (22:16 -0400)]
Address more review comments

- Add back various diagnostic methods on `Session`.

  It seems unfortunate to duplicate these in so many places, but in the
  meantime, making the API inconsistent between `Session` and `Diagnostic`
  also seems unfortunate.

- Add back TyCtxtAt methods

  These will hopefully be used in the near future.

- Add back `with_const`, it would need to be added soon after anyway.
- Add back `split()` and `get_mut()`, they're useful.

3 years agoFix compiler docs
Joshua Nelson [Wed, 17 Mar 2021 13:59:45 +0000 (09:59 -0400)]
Fix compiler docs

3 years agoAddress review comments
Joshua Nelson [Tue, 16 Mar 2021 16:57:31 +0000 (12:57 -0400)]
Address review comments

- Add back `HirIdVec`, with a comment that it will soon be used.
- Add back `*_region` functions, with a comment they may soon be used.
- Remove `-Z borrowck_stats` completely. It didn't do anything.
- Remove `make_nop` completely.
- Add back `current_loc`, which is used by an out-of-tree tool.
- Fix style nits
- Remove `AtomicCell` with `cfg(parallel_compiler)` for consistency.

3 years agoRemove (lots of) dead code
Joshua Nelson [Tue, 16 Mar 2021 05:50:34 +0000 (01:50 -0400)]
Remove (lots of) dead code

Found with https://github.com/est31/warnalyzer.

Dubious changes:
- Is anyone else using rustc_apfloat? I feel weird completely deleting
  x87 support.
- Maybe some of the dead code in rustc_data_structures, in case someone
  wants to use it in the future?
- Don't change rustc_serialize

  I plan to scrap most of the json module in the near future (see
  https://github.com/rust-lang/compiler-team/issues/418) and fixing the
  tests needed more work than I expected.

TODO: check if any of the comments on the deleted code should be kept.

3 years agoRemove unused `DiagnosticBuilder::sub` function
Joshua Nelson [Mon, 15 Mar 2021 19:11:40 +0000 (15:11 -0400)]
Remove unused `DiagnosticBuilder::sub` function

`Diagnostic::sub` is only ever used directly; it doesn't need to be
included in the builder.

3 years agoAuto merge of #83587 - petrochenkov:asneeded, r=nagisa
bors [Sun, 28 Mar 2021 01:00:25 +0000 (01:00 +0000)]
Auto merge of #83587 - petrochenkov:asneeded, r=nagisa

linker: Use `--as-needed` by default when linker supports it

Do it in a centralized way in `link.rs` instead of individual target specs.
Majority of relevant target specs were already passing it.

3 years agorustc_target: Avoid unwraps when adding linker flags
Vadim Petrochenkov [Sat, 27 Mar 2021 23:21:36 +0000 (02:21 +0300)]
rustc_target: Avoid unwraps when adding linker flags

3 years agolinker: Use `--as-needed` by default when linker supports it
Vadim Petrochenkov [Sat, 27 Mar 2021 21:02:23 +0000 (00:02 +0300)]
linker: Use `--as-needed` by default when linker supports it

3 years agoAuto merge of #83103 - petrochenkov:unilex, r=Aaron1011
bors [Sat, 27 Mar 2021 22:19:17 +0000 (22:19 +0000)]
Auto merge of #83103 - petrochenkov:unilex, r=Aaron1011

resolve: Partially unify early and late scope-relative identifier resolution

Reuse `early_resolve_ident_in_lexical_scope` instead of a chunk of code in `resolve_ident_in_lexical_scope` doing the same job.

`early_resolve_ident_in_lexical_scope`/`visit_scopes` had to be slightly extended to be able to 1) start from a specific module instead of the current parent scope and 2) report one deprecation lint.
`early_resolve_ident_in_lexical_scope` still doesn't support walking through "ribs", that part is left in `resolve_ident_in_lexical_scope` (moreover, I'm pretty sure it's buggy, but that's a separate issue, cc https://github.com/rust-lang/rust/issues/52389 at least).

3 years agoresolve: Partially unify early and late scope-relative ident resolution
Vadim Petrochenkov [Sat, 13 Mar 2021 19:23:18 +0000 (22:23 +0300)]
resolve: Partially unify early and late scope-relative ident resolution

3 years agomay not -> might not
Joshua Nelson [Sat, 27 Mar 2021 19:56:07 +0000 (15:56 -0400)]
may not -> might not

"may not" has two possible meanings:
1. A command: "You may not stay up past your bedtime."
2. A fact that's only sometimes true: "Some cities may not have bike lanes."

In some cases, the meaning is ambiguous: "Some cars may not have snow
tires." (do the cars *happen* to not have snow tires, or is it
physically impossible for them to have snow tires?)

This changes places where the standard library uses the "description of
fact" meaning to say "might not" instead.

This is just `std::vec` for now - if you think this is a good idea I can
convert the rest of the standard library.

3 years agoAuto merge of #83580 - Dylan-DPC:rollup-1zod4p7, r=Dylan-DPC
bors [Sat, 27 Mar 2021 19:38:01 +0000 (19:38 +0000)]
Auto merge of #83580 - Dylan-DPC:rollup-1zod4p7, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #81351 (combine: stop eagerly evaluating consts)
 - #82525 (make unaligned_references future-incompat lint warn-by-default)
 - #82626 (update array missing `IntoIterator` msg)
 - #82917 (Add function core::iter::zip)
 - #82993 (rustdoc: Use diagnostics for error when including sources)
 - #83522 (Improve fs error open_from unix)
 - #83548 (Always preserve `None`-delimited groups in a captured `TokenStream`)
 - #83555 (Add #[inline] to io::Error methods)

Failed merges:

 - #83130 (escape_ascii take 2)

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

3 years agoRollup merge of #83555 - m-ou-se:inline-io-error-new-const, r=jackh726
Dylan DPC [Sat, 27 Mar 2021 19:37:13 +0000 (20:37 +0100)]
Rollup merge of #83555 - m-ou-se:inline-io-error-new-const, r=jackh726

Add #[inline] to io::Error methods

Fixes #82812

3 years agoRollup merge of #83548 - Aaron1011:capture-none-delims, r=petrochenkov
Dylan DPC [Sat, 27 Mar 2021 19:37:12 +0000 (20:37 +0100)]
Rollup merge of #83548 - Aaron1011:capture-none-delims, r=petrochenkov

Always preserve `None`-delimited groups in a captured `TokenStream`

Previously, we would silently remove any `None`-delimiters when
capturing a `TokenStream`, 'flattenting' them to their inner tokens.
This was not normally visible, since we usually have
`TokenKind::Interpolated` (which gets converted to a `None`-delimited
group during macro invocation) instead of an actual `None`-delimited
group.

However, there are a couple of cases where this becomes visible to
proc-macros:
1. A cross-crate `macro_rules!` macro has a `None`-delimited group
   stored in its body (as a result of being produced by another
   `macro_rules!` macro). The cross-crate `macro_rules!` invocation
   can then expand to an attribute macro invocation, which needs
   to be able to see the `None`-delimited group.
2. A proc-macro can invoke an attribute proc-macro with its re-collected
   input. If there are any nonterminals present in the input, they will
   get re-collected to `None`-delimited groups, which will then get
   captured as part of the attribute macro invocation.

Both of these cases are incredibly obscure, so there hopefully won't be
any breakage. This change will allow more agressive 'flattenting' of
nonterminals in #82608 without losing `None`-delimited groups.

3 years agoRollup merge of #83522 - pickfire:patch-6, r=JohnTitor
Dylan DPC [Sat, 27 Mar 2021 19:37:11 +0000 (20:37 +0100)]
Rollup merge of #83522 - pickfire:patch-6, r=JohnTitor

Improve fs error open_from unix

Consistency for #79399
Suggested by JohnTitor

r? `@JohnTitor`

Not user if the error is too long now, do we handle long errors well?

3 years agoRollup merge of #82993 - camelid:source-use-diag, r=jyn514
Dylan DPC [Sat, 27 Mar 2021 19:37:09 +0000 (20:37 +0100)]
Rollup merge of #82993 - camelid:source-use-diag, r=jyn514

rustdoc: Use diagnostics for error when including sources

This error probably almost never happens, but we should still use the
diagnostic infrastructure. My guess is that the error was added back
before rustdoc used the rustc diagnostic infrastructure (it was all
`println!` and `eprintln!` back then!) and since it likely rarely occurs
and this code doesn't change that much, no one thought to transition it
to using diagnostics.

Note that the old error was actually a warning (it didn't stop the rest
of doc building). It seems very unlikely that this would fail without
the rest of the doc build failing, so it makes more sense for it to be a
hard error.

The error looks like this:

    error: failed to render source code for `src/test/rustdoc/smart-punct.rs`: "bar": foo
      --> src/test/rustdoc/smart-punct.rs:3:1
       |
    3  | / #![crate_name = "foo"]
    4  | |
    5  | | //! This is the "start" of the 'document'! How'd you know that "it's" ...
    6  | | //!
    ...  |
    22 | | //! I say "don't smart-punct me -- please!"
    23 | | //! ```
       | |_______^

I wasn't sure how to trigger the error, so to create that message I
temporarily made rustdoc always emit it. That's also why it says "bar"
and "foo" instead of a real error message.

Note that the span of the diagnostic starts at line 3 because line 1 of
that file is a (non-doc) comment and line 2 is a blank line.

3 years agoRollup merge of #82917 - cuviper:iter-zip, r=m-ou-se
Dylan DPC [Sat, 27 Mar 2021 19:37:07 +0000 (20:37 +0100)]
Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-se

Add function core::iter::zip

This makes it a little easier to `zip` iterators:

```rust
for (x, y) in zip(xs, ys) {}
// vs.
for (x, y) in xs.into_iter().zip(ys) {}
```

You can `zip(&mut xs, &ys)` for the conventional `iter_mut()` and
`iter()`, respectively. This can also support arbitrary nesting, where
it's easier to see the item layout than with arbitrary `zip` chains:

```rust
for ((x, y), z) in zip(zip(xs, ys), zs) {}
for (x, (y, z)) in zip(xs, zip(ys, zs)) {}
// vs.
for ((x, y), z) in xs.into_iter().zip(ys).zip(xz) {}
for (x, (y, z)) in xs.into_iter().zip((ys.into_iter().zip(xz)) {}
```

It may also format more nicely, especially when the first iterator is a
longer chain of methods -- for example:

```rust
    iter::zip(
        trait_ref.substs.types().skip(1),
        impl_trait_ref.substs.types().skip(1),
    )
    // vs.
    trait_ref
        .substs
        .types()
        .skip(1)
        .zip(impl_trait_ref.substs.types().skip(1))
```

This replaces the tuple-pair `IntoIterator` in #78204.
There is prior art for the utility of this in [`itertools::zip`].

[`itertools::zip`]: https://docs.rs/itertools/0.10.0/itertools/fn.zip.html

3 years agoRollup merge of #82626 - lcnr:encode_with_shorthandb, r=estebank
Dylan DPC [Sat, 27 Mar 2021 19:37:06 +0000 (20:37 +0100)]
Rollup merge of #82626 - lcnr:encode_with_shorthandb, r=estebank

update array missing `IntoIterator` msg

fixes #82602

r? ```@estebank``` do you know whether we can use the expr span in `rustc_on_unimplemented`? The label isn't too great rn

3 years agoRollup merge of #82525 - RalfJung:unaligned-ref-warn, r=petrochenkov
Dylan DPC [Sat, 27 Mar 2021 19:37:05 +0000 (20:37 +0100)]
Rollup merge of #82525 - RalfJung:unaligned-ref-warn, r=petrochenkov

make unaligned_references future-incompat lint warn-by-default

and also remove the safe_packed_borrows lint that it replaces.

`std::ptr::addr_of!` has hit beta now and will hit stable in a month, so I propose we start fixing https://github.com/rust-lang/rust/issues/27060 for real: creating a reference to a field of a packed struct needs to eventually become a hard error; this PR makes it a warn-by-default future-incompat lint. (The lint already existed, this just raises its default level.) At the same time I removed the corresponding code from unsafety checking; really there's no reason an `unsafe` block should make any difference here.

For references to packed fields outside `unsafe` blocks, this means `unaligned_refereces` replaces the previous `safe_packed_borrows` warning with a link to https://github.com/rust-lang/rust/issues/82523 (and no more talk about unsafe blocks making any difference). So behavior barely changes, the warning is just worded differently. For references to packed fields inside `unsafe` blocks, this PR shows a new future-incompat warning.

Closes https://github.com/rust-lang/rust/issues/46043 because that lint no longer exists.

3 years agoRollup merge of #81351 - lcnr:big-money-big-prices, r=oli-obk
Dylan DPC [Sat, 27 Mar 2021 19:37:04 +0000 (20:37 +0100)]
Rollup merge of #81351 - lcnr:big-money-big-prices, r=oli-obk

combine: stop eagerly evaluating consts

`super_relate_consts` eagerly evaluates constants which doesn't seem too great.

I now also finally understand why all of the unused substs test passed. The reason being
that we just evaluated the constants in `super_relate_consts` :laughing:

While this change isn't strictly necessary as evaluating consts here doesn't hurt, it still feels a lot cleaner to do it this way

r? `@oli-obk` `@nikomatsakis`

3 years agorevert rustdoc links in core to use #method. because they link to alloc, which may...
Violet [Sat, 27 Mar 2021 18:38:43 +0000 (14:38 -0400)]
revert rustdoc links in core to use #method. because they link to alloc, which may not be available

3 years agoadjust documentation links for slice ascii case functions to use newer rustdoc link...
Violet [Sat, 27 Mar 2021 18:15:42 +0000 (14:15 -0400)]
adjust documentation links for slice ascii case functions to use newer rustdoc link format

3 years agoupdate links to make_ascii_lowercase for slice to point to methods on the same type...
Violet [Sat, 27 Mar 2021 17:45:30 +0000 (13:45 -0400)]
update links to make_ascii_lowercase for slice to point to methods on the same type, rather than on u8

3 years agoAdd the tracking issue for `#![feature(iter_zip)]`
Josh Stone [Sat, 27 Mar 2021 17:14:54 +0000 (10:14 -0700)]
Add the tracking issue for `#![feature(iter_zip)]`

3 years agoAuto merge of #83573 - JohnTitor:rollup-28jnzsr, r=JohnTitor
bors [Sat, 27 Mar 2021 16:34:59 +0000 (16:34 +0000)]
Auto merge of #83573 - JohnTitor:rollup-28jnzsr, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #79399 (Use detailed and shorter fs error explaination)
 - #83348 (format macro argument parsing fix)
 - #83462 (ExitStatus: print "exit status: {}" rather than "exit code: {}" on unix)
 - #83526 (lazily calls some fns)
 - #83558 (Use DebugStruct::finish_non_exhaustive() in std.)
 - #83559 (Fix Debug implementation for RwLock{Read,Write}Guard.)
 - #83560 (Derive Debug for io::Chain instead of manually implementing it.)
 - #83561 (Improve Debug implementations of Mutex and RwLock.)
 - #83567 (Update rustup cross-compilation docs link)
 - #83569 (Add regression tests for #56445)

Failed merges:

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

3 years agoRollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726
Yuki Okushi [Sat, 27 Mar 2021 16:33:23 +0000 (01:33 +0900)]
Rollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726

Add regression tests for #56445

Closes #56445.

3 years agoRollup merge of #83567 - jonjensen:patch-1, r=GuillaumeGomez
Yuki Okushi [Sat, 27 Mar 2021 16:33:22 +0000 (01:33 +0900)]
Rollup merge of #83567 - jonjensen:patch-1, r=GuillaumeGomez

Update rustup cross-compilation docs link

3 years agoRollup merge of #83561 - m-ou-se:lock-debug, r=jackh726
Yuki Okushi [Sat, 27 Mar 2021 16:33:21 +0000 (01:33 +0900)]
Rollup merge of #83561 - m-ou-se:lock-debug, r=jackh726

Improve Debug implementations of Mutex and RwLock.

This improves the Debug implementations of Mutex and RwLock.

They now show the poison flag and use debug_non_exhaustive. (See #67364.)

3 years agoRollup merge of #83560 - m-ou-se:io-chain-debug, r=sfackler
Yuki Okushi [Sat, 27 Mar 2021 16:33:19 +0000 (01:33 +0900)]
Rollup merge of #83560 - m-ou-se:io-chain-debug, r=sfackler

Derive Debug for io::Chain instead of manually implementing it.

This derives Debug for io::Chain instead of manually implementing it.

The manual implementation has the same bounds, so I don't think there's any reason for a manual implementation. The names used in the derive implementation are even nicer (`first`/`second`) than the manual implementation (`t`/`u`), and include the `done_first` field too.

3 years agoRollup merge of #83559 - m-ou-se:rwlock-guard-debug-fix, r=jackh726
Yuki Okushi [Sat, 27 Mar 2021 16:33:18 +0000 (01:33 +0900)]
Rollup merge of #83559 - m-ou-se:rwlock-guard-debug-fix, r=jackh726

Fix Debug implementation for RwLock{Read,Write}Guard.

This would attempt to print the Debug representation of the lock that the guard has locked, which will try to lock again, fail, and just print `"<locked>"` unhelpfully.

After this change, this just prints the contents of the mutex, like the other smart pointers (and MutexGuard) do.

MutexGuard had this problem too: https://github.com/rust-lang/rust/issues/57702

3 years agoRollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726
Yuki Okushi [Sat, 27 Mar 2021 16:33:17 +0000 (01:33 +0900)]
Rollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726

Use DebugStruct::finish_non_exhaustive() in std.

See https://github.com/rust-lang/rust/issues/67364

3 years agoRollup merge of #83526 - klensy:lazy-too, r=petrochenkov
Yuki Okushi [Sat, 27 Mar 2021 16:33:16 +0000 (01:33 +0900)]
Rollup merge of #83526 - klensy:lazy-too, r=petrochenkov

lazily calls some fns

Replaced some fn's with it's lazy variants.

3 years agoRollup merge of #83462 - ijackson:exitstatus-message-wording, r=joshtriplett
Yuki Okushi [Sat, 27 Mar 2021 16:33:15 +0000 (01:33 +0900)]
Rollup merge of #83462 - ijackson:exitstatus-message-wording, r=joshtriplett

ExitStatus: print "exit status: {}" rather than "exit code: {}" on unix

Proper Unix terminology is "exit status" (vs "wait status").  "exit
code" is imprecise on Unix and therefore unclear.  (As far as I can
tell, "exit code" is correct terminology on Windows.)

This new wording is unfortunately inconsistent with the identifier
names in the Rust stdlib.

It is the identifier names that are wrong, as discussed at length in eg
  https://doc.rust-lang.org/nightly/std/process/struct.ExitStatus.html
  https://doc.rust-lang.org/nightly/std/os/unix/process/trait.ExitStatusExt.html

Unfortunately for API stability reasons it would be a lot of work, and
a lot of disruption, to change the names in the stdlib (eg to rename
`std::process::ExitStatus` to `std::process::ChildStatus` or
something), but we should fix the message output.  Many (probably
most) readers of these messages about exit statuses will be users and
system administrators, not programmers, who won't even know that Rust
has this wrong terminology.

So I think the right thing is to fix the documentation (as I have
already done) and, now, the terminology in the implementation.

This is a user-visible change to the behaviour of all Rust programs
which run Unix subprocesses.  Hopefully no-one is matching against the
exit status string, except perhaps in tests.

3 years agoRollup merge of #83348 - osa1:issue83344, r=jackh726
Yuki Okushi [Sat, 27 Mar 2021 16:33:13 +0000 (01:33 +0900)]
Rollup merge of #83348 - osa1:issue83344, r=jackh726

format macro argument parsing fix

When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344

---

r? ```@estebank```

3 years agoRollup merge of #79399 - pickfire:patch-3, r=JohnTitor
Yuki Okushi [Sat, 27 Mar 2021 16:33:11 +0000 (01:33 +0900)]
Rollup merge of #79399 - pickfire:patch-3, r=JohnTitor

Use detailed and shorter fs error explaination

Includes suggestion from `@the8472` https://github.com/rust-lang/rust/issues/79390#issuecomment-733263336

3 years agoMake all compiler-builtins symbols hidden
bjorn3 [Sat, 27 Mar 2021 16:32:41 +0000 (17:32 +0100)]
Make all compiler-builtins symbols hidden

This matches cg_llvm

Fixes #1152

3 years agomake unaligned_refereces future-incompat lint warn-by-default, and remove the safe_pa...
Ralf Jung [Thu, 25 Feb 2021 18:38:53 +0000 (19:38 +0100)]
make unaligned_refereces future-incompat lint warn-by-default, and remove the safe_packed_borrows lint that it replaces

3 years agoupdate tests
lcnr [Mon, 15 Mar 2021 22:10:24 +0000 (23:10 +0100)]
update tests

3 years agocombine: stop eagerly evaluating consts
Bastian Kauschke [Sun, 24 Jan 2021 19:08:12 +0000 (20:08 +0100)]
combine: stop eagerly evaluating consts

3 years agoAdd regression tests for #56445
Simon Jakobi [Sat, 27 Mar 2021 03:22:22 +0000 (04:22 +0100)]
Add regression tests for #56445

Closes #56445.

3 years agoupdate comment at MaybeUninit::uninit_array
Ralf Jung [Sat, 27 Mar 2021 13:58:23 +0000 (14:58 +0100)]
update comment at MaybeUninit::uninit_array

3 years agoUpdate rustup cross-compilation docs link
Jon Jensen [Sat, 27 Mar 2021 13:51:46 +0000 (07:51 -0600)]
Update rustup cross-compilation docs link

3 years agoAuto merge of #83245 - the8472:generalize-slice-fill, r=m-ou-se
bors [Sat, 27 Mar 2021 13:25:16 +0000 (13:25 +0000)]
Auto merge of #83245 - the8472:generalize-slice-fill, r=m-ou-se

Generalize and inline slice::fill specializations

This makes the memset specialization applicable to more types. And since the code now lives in a generic method it is also eligible for cross-crate inlining which  should fix #83235

3 years agoImprove fs error open_from unix
Ivan Tham [Fri, 26 Mar 2021 17:21:35 +0000 (01:21 +0800)]
Improve fs error open_from unix

Consistency for #79399
Suggested by JohnTitor

Improve fs error invaild input for sys_common

The text was duplicated from unix.

3 years agoRun Miri test suite with mir-opt-level=4
Ralf Jung [Sat, 27 Mar 2021 13:03:31 +0000 (14:03 +0100)]
Run Miri test suite with mir-opt-level=4

3 years agoUse detailed and shorter fs error explaination
Ivan Tham [Wed, 25 Nov 2020 03:22:19 +0000 (11:22 +0800)]
Use detailed and shorter fs error explaination

Includes suggestion from the8472 https://github.com/rust-lang/rust/issues/79390#issuecomment-733263336

More detail error explanation in fs doc

3 years agoImprove Debug implementations of Mutex and RwLock.
Mara Bos [Sat, 27 Mar 2021 12:47:11 +0000 (13:47 +0100)]
Improve Debug implementations of Mutex and RwLock.

They now show the poison flag and use debug_non_exhaustive.

3 years agoDerive Debug for io::Chain instead of manually implementing it.
Mara Bos [Sat, 27 Mar 2021 12:36:07 +0000 (13:36 +0100)]
Derive Debug for io::Chain instead of manually implementing it.

The manual implementation has the same bounds, so I don't think there's
any reason for a manual implementation. The names used in the derive
implementation are even nicer (`first`/`second`) than the manual
implementation (`t`/`u`), and include the `done_first` field too.