Commit Graph

141230 Commits

Author SHA1 Message Date
bors
16156fb278 Auto merge of #83674 - Dylan-DPC:rollup-bcuc1hl, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #83568 (update comment at MaybeUninit::uninit_array)
 - #83571 (Constantify some slice methods)
 - #83579 (Improve pointer arithmetic docs)
 - #83645 (Wrap non-pre code blocks)
 - #83656 (Add a regression test for issue-82865)
 - #83662 (Update books)
 - #83667 (Suggest box/pin/arc ing receiver on method calls)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-30 11:44:36 +00:00
Dylan DPC
5b467787b6
Rollup merge of #83667 - estebank:cool-bears-hot-tip, r=lcnr
Suggest box/pin/arc ing receiver on method calls

_Extracted from https://fasterthanli.me/articles/pin-and-suffering_
2021-03-30 11:34:30 +02:00
Dylan DPC
36eee62c08
Rollup merge of #83662 - ehuss:update-books, r=ehuss
Update books

## reference

4 commits in d10a0af8dca25d9d548ca6a369fd66ad06acb3c9..fd97729e2d82f8b08d68a31c9bfdf0c37a7fd542
2021-03-21 11:14:06 -0700 to 2021-03-28 14:29:19 -0700
- Editorial cleanup on expressions (part 1) (rust-lang-nursery/reference#967)
- Update type casts section (rust-lang-nursery/reference#961)
- Add missing "?" notion (rust-lang-nursery/reference#989)
- Fix typo (rust-lang-nursery/reference#988)

## book

8 commits in fc2f690fc16592abbead2360cfc0a42f5df78052..b54090a99ec7c4b46a5203a9c927fdbc311bb1f5
2021-03-05 14:03:22 -0500 to 2021-03-24 11:21:46 -0500
- correct the signature of the `deref` method (rust-lang/book#2658)
- Clarify the immutability of a reference (rust-lang/book#2646)
- Tweak wording around Windows representation of enter
- Ch. 02 note - Enter results in CRLF on Windows (rust-lang/book#2648)
- Added an example of slicing result (rust-lang/book#2649)
- Fix word wrapping, mention dictionary.txt is also in the ci dir
- README: note that spellcheck.sh is in ci directory (rust-lang/book#2652)
- Change someurl.com to example.org (rust-lang/book#2655)

## rust-by-example

12 commits in eead22c6c030fa4f3a167d1798658c341199e2ae..29d91f591c90dd18fdca6d23f1a9caf9c139d0d7
2021-03-04 16:26:43 -0300 to 2021-03-23 09:03:39 -0300
- Unwrap some drinks. (rust-lang/rust-by-example#1431)
- doc(testcase_linked_list): add a little extra note about pattern (rust-lang/rust-by-example#1408)
- Update function name in comment (rust-lang/rust-by-example#1413)
- Fixes minor typo in src/types/cast.md (rust-lang/rust-by-example#1414)
- Add destructuring example to generics new type (rust-lang/rust-by-example#1416)
- update struct.md (rust-lang/rust-by-example#1419)
- fix name from rectangle to Rectangle (rust-lang/rust-by-example#1420)
- Typo "incures" in code comment (rust-lang/rust-by-example#1422)
- Changed impl to use Self::Item (rust-lang/rust-by-example#1425)
- Fix code highlighting in some places (rust-lang/rust-by-example#1427)
- Update multi_bounds.md (rust-lang/rust-by-example#1428)
- Reformulated text for redability (rust-lang/rust-by-example#1429)

## rustc-dev-guide

3 commits in 67ebd4b55dba44edfc351621cef6e5e758169c55..0687daac28939c476df51778f5a1d1aff1a3fddf
2021-03-11 13:36:25 -0800 to 2021-03-28 13:33:56 -0400
- Add notes about nightly rustc version for the rustc-driver examples
- Update rustc-driver-*.rs examples (rust-lang/rustc-dev-guide#1095)
- Fix rust compiler meeting info (rust-lang/rustc-dev-guide#1087)

## embedded-book

1 commits in f61685755fad7d3b88b4645adfbf461d500563a2..d3f2ace94d51610cf3e3c265705bb8416d37f8e4
2021-03-08 01:06:44 +0000 to 2021-03-17 07:53:09 +0000
- Add binary attribute to .jpeg files, closes rust-embedded/book#287  (rust-embedded/book#288)
2021-03-30 11:34:29 +02:00
Dylan DPC
55171e425c
Rollup merge of #83656 - JohnTitor:resolve-test, r=petrochenkov
Add a regression test for issue-82865

Closes #82865
r? `@petrochenkov`
2021-03-30 11:34:28 +02:00
Dylan DPC
9f9577c1aa
Rollup merge of #83645 - pickfire:patch-3, r=GuillaumeGomez
Wrap non-pre code blocks

Fix #83550 regression

```
$ cargo new --lib whitespace && cd whitespace && echo '//! `"   foo   "`' > src/lib.rs && cargo doc --open
```

Before

![](https://user-images.githubusercontent.com/89623/112713498-c0dfc200-8ed5-11eb-8c57-efdf26372e74.png)

After

![](https://user-images.githubusercontent.com/89623/112713538-f08eca00-8ed5-11eb-8a98-675179f60ae2.png)

r? ``@GuillaumeGomez``
cc ``@mgeisler``
2021-03-30 11:34:27 +02:00
Dylan DPC
5b67543c98
Rollup merge of #83579 - RalfJung:ptr-arithmetic, r=dtolnay
Improve pointer arithmetic docs

* Add slightly more detailed definition of "allocated object" to the module docs, and link it from everywhere.
* Clarify the "remains attached" wording a bit (at least I hope this is clearer).
* Remove the sentence about using integer arithmetic; this seems to confuse people even if it is technically correct.

As usual, the edit needs to be done in a dozen places to remain consistent, I hope I got them all.
2021-03-30 11:34:26 +02:00
Dylan DPC
ad2a80e412
Rollup merge of #83571 - a1phyr:feature_const_slice_first_last, r=dtolnay
Constantify some slice methods

Tracking issue: #83570

This PR constantifies the following functions under feature `const_slice_first_last`:
- `slice::first`
- `slice::split_first`
- `slice::last`
- `slice::split_last`

Blocking on `#![feature(const_mut_refs)]`:
- `slice::first_mut`
- `slice::split_first_mut`
- `slice::last_mut`
- `slice::split_last_mut`
2021-03-30 11:34:25 +02:00
Dylan DPC
9ab5f7db30
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).
2021-03-30 11:34:23 +02:00
bors
689e8470ff Auto merge of #83458 - saethlin:improve-vec-benches, r=dtolnay
Clean up Vec's benchmarks

The Vec benchmarks need a lot of love. I sort of noticed this in https://github.com/rust-lang/rust/pull/83357 but the overall situation is much less awesome than I thought at the time. The first commit just removes a lot of asserts and does a touch of other cleanup.

A number of these benchmarks are poorly-named. For example, `bench_map_fast` is not in fact fast, `bench_rev_1` and `bench_rev_2` are vague, `bench_in_place_zip_iter_mut` doesn't call `zip`, `bench_in_place*` don't do anything in-place... Should I fix these, or is there tooling that depend on the names not changing?

I've also noticed that `bench_rev_1` and `bench_rev_2` are remarkably fragile. It looks like poking other code in `Vec` can cause the codegen of this benchmark to switch to a version that has almost exactly half its current throughput and I have absolutely no idea why.

Here's the fast version:
```asm
  0.69 │110:   movdqu -0x20(%rbx,%rdx,4),%xmm0
  1.76 │       movdqu -0x10(%rbx,%rdx,4),%xmm1
  0.71 │       pshufd $0x1b,%xmm1,%xmm1
  0.60 │       pshufd $0x1b,%xmm0,%xmm0
  3.68 │       movdqu %xmm1,-0x30(%rcx)
 14.36 │       movdqu %xmm0,-0x20(%rcx)
 13.88 │       movdqu -0x40(%rbx,%rdx,4),%xmm0
  6.64 │       movdqu -0x30(%rbx,%rdx,4),%xmm1
  0.76 │       pshufd $0x1b,%xmm1,%xmm1
  0.77 │       pshufd $0x1b,%xmm0,%xmm0
  1.87 │       movdqu %xmm1,-0x10(%rcx)
 13.01 │       movdqu %xmm0,(%rcx)
 38.81 │       add    $0x40,%rcx
  0.92 │       add    $0xfffffffffffffff0,%rdx
  1.22 │     ↑ jne    110
```
And the slow one:
```asm
  0.42 │9a880:   movdqa     %xmm2,%xmm1
  4.03 │9a884:   movq       -0x8(%rbx,%rsi,4),%xmm4
  8.49 │9a88a:   pshufd     $0xe1,%xmm4,%xmm4
  2.58 │9a88f:   movq       -0x10(%rbx,%rsi,4),%xmm5
  7.02 │9a895:   pshufd     $0xe1,%xmm5,%xmm5
  4.79 │9a89a:   punpcklqdq %xmm5,%xmm4
  5.77 │9a89e:   movdqu     %xmm4,-0x18(%rdx)
 15.74 │9a8a3:   movq       -0x18(%rbx,%rsi,4),%xmm4
  3.91 │9a8a9:   pshufd     $0xe1,%xmm4,%xmm4
  5.04 │9a8ae:   movq       -0x20(%rbx,%rsi,4),%xmm5
  5.29 │9a8b4:   pshufd     $0xe1,%xmm5,%xmm5
  4.60 │9a8b9:   punpcklqdq %xmm5,%xmm4
  9.81 │9a8bd:   movdqu     %xmm4,-0x8(%rdx)
 11.05 │9a8c2:   paddq      %xmm3,%xmm0
  0.86 │9a8c6:   paddq      %xmm3,%xmm2
  5.89 │9a8ca:   add        $0x20,%rdx
  0.12 │9a8ce:   add        $0xfffffffffffffff8,%rsi
  1.16 │9a8d2:   add        $0x2,%rdi
  2.96 │9a8d6: → jne        9a880 <<alloc::vec::Vec<T,A> as core::iter::traits::collect::Extend<&T>>::extend+0xd0>
```
2021-03-30 09:03:29 +00:00
JohnTitor
4f2c25a998 Add a regression test for issue-75801 2021-03-30 17:02:23 +09:00
bors
a0e229abad 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.
2021-03-30 06:22:29 +00:00
Amanieu d'Antras
cad9b6b695 Apply review feedback 2021-03-30 07:03:41 +01:00
bors
32d3276561 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: ca3efde8a5 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)
```
2021-03-30 03:41:14 +00:00
Esteban Küber
0195f8d375 Hide unnecessary reference to trait
When the problem for a method not being found in its receiver is due to
arbitrary self-types, we don't want to mention importing or implementing
the trait, instead we suggest wrapping.
2021-03-29 20:39:42 -07:00
Cheng XU
974192cd98
Disallow octal format in Ipv4 string
In its original specification, leading zero in Ipv4 string is interpreted
as octal literals. So a IP address 0127.0.0.1 actually means 87.0.0.1.

This confusion can lead to many security vulnerabilities. Therefore, in
[IETF RFC 6943], it suggests to disallow octal/hexadecimal format in Ipv4
string all together.

Existing implementation already disallows hexadecimal numbers. This commit
makes Parser reject octal numbers.

Fixes #83648.

[IETF RFC 6943]: https://tools.ietf.org/html/rfc6943#section-3.1.1
2021-03-30 10:24:23 +08:00
bors
902ca44c19 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 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-30 01:16:08 +00:00
Esteban Küber
6f2d8a018e Suggest box/pin/arc ing receiver on method calls 2021-03-29 18:14:44 -07:00
Amanieu d'Antras
26d260bfa4 Run LLVM coverage instrumentation passes before optimization passes
This matches the behavior of Clang and allows us to remove several
hacks which were needed to ensure functions weren't optimized away
before reaching the instrumentation pass.
2021-03-30 02:10:28 +01:00
JohnTitor
edacd0f981 Add a regression test for issue-82865 2021-03-30 07:34:49 +09:00
Dylan DPC
6738ee7d59
Rollup merge of #83644 - lnicola:rust-analyzer-2021-03-29, r=jonas-schievink
⬆️ rust-analyzer
2021-03-30 00:32:25 +02:00
Dylan DPC
fca8e7dd88
Rollup merge of #83643 - JohnTitor:is-freeze-no-longer-uses-span, r=RalfJung
Remove a FIXME resolved by #73578

r? ``@RalfJung``
2021-03-30 00:32:24 +02:00
Dylan DPC
6b5ba539c5
Rollup merge of #83636 - JohnTitor:const-generics-defualts-regg-test, r=lcnr
Add a regression test for issue-82792

Closes #82792

r? ``@lcnr``
2021-03-30 00:32:23 +02:00
Dylan DPC
25ade6910c
Rollup merge of #83543 - camelid:lint-unknown-disambiguator, r=jyn514
Lint on unknown intra-doc link disambiguators
2021-03-30 00:32:22 +02:00
Dylan DPC
772582e19e
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`
2021-03-30 00:32:21 +02:00
Dylan DPC
68964d1fc2
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``
2021-03-30 00:32:20 +02:00
Dylan DPC
2843baaeb6
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
2021-03-30 00:32:18 +02:00
bors
50489e3b00 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.
2021-03-29 22:27:16 +00:00
Eric Huss
180ac80272 Update books 2021-03-29 13:53:10 -07:00
Josh Triplett
68dbdfb5bf Simplify Command::spawn (no semantic change)
This minimizes the size of an unsafe block, and allows outdenting some
complex code.
2021-03-29 13:37:24 -07:00
Vlad Frolov
595f3f25fc Updated the tracking issue # 2021-03-29 22:44:48 +03:00
bors
48691ea6e6 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`
2021-03-29 19:44:27 +00:00
JohnTitor
7e6fd40614 Do not emit a suggestion that causes the E0632 error 2021-03-30 03:00:25 +09:00
Joshua Nelson
526bb10701 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.
2021-03-29 13:50:40 -04:00
bors
2917eda69d 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.
2021-03-29 16:48:45 +00:00
bjorn3
cd7a011f37 Don't duplicate the extern providers once for each crate 2021-03-29 18:03:07 +02:00
bors
7750402c5e 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.
2021-03-29 14:07:32 +00:00
Ivan Tham
7d21972579
Wrap non-pre code blocks
Fix #83550 regression
2021-03-29 21:49:58 +08:00
Frank Steffahn
761296bcb3 Change back prelude headline 2021-03-29 15:14:14 +02:00
Laurențiu Nicola
79acd5e318 ⬆️ rust-analyzer 2021-03-29 16:12:26 +03:00
JohnTitor
48f9f0864b Remove a FIXME resolved by #73578 2021-03-29 21:41:50 +09:00
klensy
a0ff4612f2 ffi::c_str smaller as_bytes 2021-03-29 15:32:25 +03:00
bors
3aedcf06b7 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
2021-03-29 11:20:25 +00:00
Ömer Sinan Ağacan
8d7432af7b Replace tabs in err messages before rendering
This is done in other call sites, but was missing in one place.

Fixes #83638
2021-03-29 13:38:36 +03:00
bjorn3
5444b46234 Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into sync_cg_clif-2021-03-29 2021-03-29 10:45:09 +02:00
JohnTitor
c9562fd2d0 Prefer 4 spaces 2021-03-29 17:32:27 +09:00
JohnTitor
29d4a7d377 Add a regression test for issue-82792 2021-03-29 17:31:12 +09:00
bors
40334da7a6 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
2021-03-29 08:27:59 +00:00
bjorn3
0969bc6dde Rustup to rustc 1.53.0-nightly (4a20eb6a9 2021-03-28) 2021-03-29 10:26:20 +02:00
Camelid
141df6f60e Inline find_suffix closure that's only used once 2021-03-28 17:27:19 -07:00
Camelid
5497f158af Add test for weird backticks placement 2021-03-28 17:18:55 -07:00