Commit Graph

207505 Commits

Author SHA1 Message Date
Matthias Krüger
40c1410ce4
Rollup merge of #102871 - notriddle:notriddle/trait-impl-anchor, r=GuillaumeGomez
rustdoc: clean up overly complex `.trait-impl` CSS selectors

When added in 45964368f4, these multi-class selectors were present in the initial commit, but no reason was given why the shorter selector wouldn't work.
2022-10-10 20:47:33 +02:00
Matthias Krüger
973afb15e0
Rollup merge of #102846 - zertosh:update-syn, r=dtolnay
update to syn-1.0.102

This update removes the only `.gitignore` found in `rustc-src`:

    vendor/syn/tests/.gitignore
    vendor/syn-1.0.91/tests/.gitignore
    vendor/syn-1.0.95/tests/.gitignore

To check-in `rustc-src` for hermetic builds in environments with
restrictive `.gitignore` policies, one has to remove these
`tests/.gitignore` and patch the respective
`.cargo-checksum.json`.`syn` >1.0.101 includes dtolnay/syn@3c49303bed,
which removes its `tests/.gitignore`. Now the `syn` crates.io package
has no `.gitignore`.

[`rustc-src`'s `vendor`][] is produced from the root `Cargo.toml`,
`src/tools/rust-analyzer/Cargo.toml`,
`compiler/rustc_codegen_cranelift/Cargo.toml`, and
`src/bootstrap/Cargo.toml`. `rustc_codegen_cranelift` does not use
`syn`.

[`rustc-src`'s `vendor`]:
  https://github.com/rust-lang/rust/blob/c0784109daa0/src/bootstrap/dist.rs#L934-L940

This was produced with:

    cargo update --package syn --precise 1.0.102 \

    cargo update --package syn --precise 1.0.102 \
        --manifest-path src/tools/rust-analyzer/Cargo.toml

    cargo update --package syn --precise 1.0.102 \
        --manifest-path src/bootstrap/Cargo.toml
2022-10-10 20:47:33 +02:00
Matthias Krüger
01a2246000
Rollup merge of #101789 - gimbles:let, r=estebank
`let`'s not needed in struct field definitions

Fixes #101683
2022-10-10 20:47:32 +02:00
Matthias Krüger
d8d01e3216
Rollup merge of #101360 - compiler-errors:multiple-closure-bounds, r=petrochenkov
Point out incompatible closure bounds

Fixes #100295
2022-10-10 20:47:31 +02:00
Guillaume Gomez
d565200270 Fix unclosed HTML tag in clippy doc 2022-10-10 20:45:04 +02:00
bors
a6b7274a46 Auto merge of #102596 - scottmcm:option-bool-calloc, r=Mark-Simulacrum
Do the `calloc` optimization for `Option<bool>`

Inspired by <https://old.reddit.com/r/rust/comments/xtiqj8/why_is_this_functional_version_faster_than_my_for/iqqy37b/>.
2022-10-10 18:42:40 +00:00
Michael Howell
b63b02f872 rustdoc: remove unneeded <div> wrapper from sidebar DOM
When this was added, the sidebar had a bit more complex style. It can be
removed, now.
2022-10-10 11:40:15 -07:00
Ralf Jung
a52cde3da5 update compiler_builtins 2022-10-10 20:13:45 +02:00
Takayuki Maeda
68260289b5 fix #102878 2022-10-11 02:43:36 +09:00
Camille GILLOT
a474ec50b7 Move lifetime resolution module to rustc_hir_analysis. 2022-10-10 17:40:52 +00:00
Guillaume Gomez
14de94aec5 Fix unclosed HTML tag in rustfmt doc 2022-10-10 18:29:17 +02:00
Guillaume Gomez
adc24d1b5e Fix compiler docs 2022-10-10 18:28:29 +02:00
Guillaume Gomez
3416fa1882 Fix doc lint error 2022-10-10 18:28:29 +02:00
Guillaume Gomez
d9570e0510 Stabilize rustdoc CHECK_INVALID_HTML_TAGS check 2022-10-10 18:28:29 +02:00
Guillaume Gomez
c23ed655eb Update rustdoc tests 2022-10-10 18:28:29 +02:00
Guillaume Gomez
6add6a1e1e Change default lint level of INVALID_HTML_TAGS to warning 2022-10-10 18:28:29 +02:00
Nathan Stocks
5ef1c03bd8 make up your mind, rustfmt 2022-10-10 10:06:52 -06:00
Guillaume Gomez
9c5a769119 Simplify result color checks 2022-10-10 18:00:10 +02:00
Guillaume Gomez
c6803fa30e Update browser-ui-test version to 0.12.2 2022-10-10 18:00:05 +02:00
Nathan Stocks
50e2795624 remove out-of-date fixme 2022-10-10 09:52:53 -06:00
bors
0265a3e93b Auto merge of #96711 - emilio:inline-slice-clone, r=nikic
slice: #[inline] a couple iterator methods.

The one I care about and actually saw in the wild not getting inlined is
clone(). We ended up doing a whole function call for something that just
copies two pointers.

I ended up marking as_slice / as_ref as well because make_slice is
inline(always) itself, and is also the kind of think that can kill
performance in hot loops if you expect it to get inlined. But happy to
undo those.
2022-10-10 12:09:21 +00:00
gimbles
6071b4b8a6 let is not allowed in struct field definitions
Co-authored-by: jyn514 <jyn514@gmail.com>
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-10-10 16:53:13 +05:30
bors
691aeaad6c Auto merge of #102875 - Dylan-DPC:rollup-zwcq8h9, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #99696 (Uplift `clippy::for_loops_over_fallibles` lint into rustc)
 - #102055 (Move some tests to more reasonable directories)
 - #102786 (Remove tuple candidate, nothing special about it)
 - #102794 (Make tests capture the error printed by a Result return)
 - #102853 (Skip chained OpaqueCast when building captures.)
 - #102868 (Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-10 09:12:06 +00:00
Dylan DPC
81b9d0b1d1
Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki
Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`

Thanks `@camsteffen` for catching this in ast too, cc https://github.com/rust-lang/rust/pull/102829#issuecomment-1272649247
2022-10-10 13:43:43 +05:30
Dylan DPC
5a09b72156
Rollup merge of #102853 - cjgillot:skip-opaque-cast, r=jackh726
Skip chained OpaqueCast when building captures.

Fixes https://github.com/rust-lang/rust/issues/102089
2022-10-10 13:43:42 +05:30
Dylan DPC
302bf31826
Rollup merge of #102794 - dtolnay:termination, r=thomcc
Make tests capture the error printed by a Result return

An error returned by tests previously would get written directly to stderr, instead of to the capture buffer set up by the test harness. This PR makes it write to the capture buffer so that it can be integrated as part of the test output by build tools such as `buck test`, since being able to read the error message returned by a test is pretty critical to debugging why the test failed.

<br>

**Before:**

```rust
// tests/test.rs

#[test]
fn test() -> Result<(), &'static str> {
    println!("STDOUT");
    eprintln!("STDERR");
    Err("RESULT")
}
```

```console
$ cargo build --test test
$ target/debug/deps/test-???????????????? -Z unstable-options --format=json
{ "type": "suite", "event": "started", "test_count": 1 }
{ "type": "test", "event": "started", "name": "test" }
Error: "RESULT"
{ "type": "test", "name": "test", "event": "failed", "stdout": "STDOUT\nSTDERR\n" }
{ "type": "suite", "event": "failed", "passed": 0, "failed": 1, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": 0.00040313 }
```

**After:**

```console
$ target/debug/deps/test-???????????????? -Z unstable-options --format=json
{ "type": "suite", "event": "started", "test_count": 1 }
{ "type": "test", "event": "started", "name": "test" }
{ "type": "test", "name": "test", "event": "failed", "stdout": "STDOUT\nSTDERR\nError: \"RESULT\"" }
{ "type": "suite", "event": "failed", "passed": 0, "failed": 1, "ignored": 0, "measured": 0, "filtered_out": 0, "exec_time": 0.000261894 }
```
2022-10-10 13:43:41 +05:30
Dylan DPC
58d533dfc1
Rollup merge of #102786 - compiler-errors:no-tuple-candidate, r=lcnr
Remove tuple candidate, nothing special about it

r? `@lcnr` you mentioned this during the talk you gave i think
2022-10-10 13:43:41 +05:30
Dylan DPC
0c17324c92
Rollup merge of #102055 - c410-f3r:moar-errors, r=petrochenkov
Move some tests to more reasonable directories

r? ``@petrochenkov``
2022-10-10 13:43:40 +05:30
Dylan DPC
7e16f9f1ea
Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-dead
Uplift `clippy::for_loops_over_fallibles` lint into rustc

This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this:
```rust
for _ in Some(1) {}
for _ in Ok::<_, ()>(1) {}
```
i.e. directly iterating over `Option` and `Result` using `for` loop.

There are a number of suggestions that this PR adds (on top of what clippy suggested):
1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later)
   ```rust
    for _ in iter.next() {}
    // turns into
    for _ in iter.by_ref() {}
    ```
2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels
   ```rust
   for _ in rx.recv() {}
   // turns into
   while let Some(_) = rx.recv() {}
   ```
3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?`
   ```rust
   for _ in f() {}
   // turns into
   for _ in f()? {}
   ```
4. To preserve the original behavior and clear intent, we can suggest using `if let`
   ```rust
   for _ in f() {}
   // turns into
   if let Some(_) = f() {}
   ```
(P.S. `Some` and `Ok` are interchangeable depending on the type)

I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)!

Resolves #99272

[`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
2022-10-10 13:43:40 +05:30
Michael Howell
03fe005f49 rustdoc: clean up overly complex .trait-impl CSS selectors
When added in 45964368f4, these multi-class
selectors were present in the initial commit, but no reason was given why
the shorter selector wouldn't work.
2022-10-09 23:19:50 -07:00
bors
8dfb40722d Auto merge of #94381 - Kobzol:llvm-bolt, r=Mark-Simulacrum
Use BOLT in CI to optimize LLVM

This PR adds an optimization step in the Linux `dist` CI pipeline that uses [BOLT](https://github.com/llvm/llvm-project/tree/main/bolt) to optimize the `libLLVM.so` library built by boostrap.

Steps:
- [x] Use LLVM 15 as a bootstrap compiler and use it to build BOLT
- [x] Compile LLVM with support for relocations (`-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-q"`)
- [x] Gather profile data using instrumented LLVM
- [x] Apply profile to LLVM that has already been PGOfied
- [x] Run with BOLT profiling on more benchmarks
- [x] Decide on the order of optimization (PGO -> BOLT?)
- [x] Decide how we should get `bolt` (currently we use the host `bolt`)
- [x] Clean up

The latest perf results can be found [here](https://github.com/rust-lang/rust/pull/94381#issuecomment-1258269440). The current CI build time with BOLT applied is around 1h 55 minutes.
2022-10-10 06:18:58 +00:00
Michael Goulet
693485373b Point out incompatible closure bounds 2022-10-10 05:05:26 +00:00
Ariel Davis
61519b8cf1 Add basename and dirname aliases 2022-10-09 21:44:44 -07:00
bors
e495b37c9a Auto merge of #102867 - JohnTitor:rollup-qnwsajt, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #102275 (Stabilize `half_open_range_patterns`)
 - #102323 (Trying to suggest additional lifetime parameter)
 - #102345 (Recover from impl Trait in type param bound)
 - #102845 (Elaborate trait ref to compute object safety.)
 - #102860 (Add missing documentation for FileNameDisplayPreference variants)
 - #102862 (From<Alignment> for usize & NonZeroUsize)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-10 03:20:03 +00:00
SparrowLii
0571b0af65 suggest candidates for unresolved import 2022-10-10 11:14:32 +08:00
Michael Goulet
d3bd6beb97 Rename AssocItemKind::TyAlias to AssocItemKind::Type 2022-10-10 02:31:37 +00:00
Yuki Okushi
6d35efe03a
Rollup merge of #102862 - scottmcm:more-alignment-traits, r=thomcc
From<Alignment> for usize & NonZeroUsize

Since you mentioned these two in https://github.com/rust-lang/rust/pull/102072#issuecomment-1272390033,
r? ``@thomcc``

Tracking Issue: https://github.com/rust-lang/rust/issues/102070
2022-10-10 10:23:06 +09:00
Yuki Okushi
e435a051dd
Rollup merge of #102860 - GuillaumeGomez:missing-docs-FileNameDisplayPreference, r=nagisa
Add missing documentation for FileNameDisplayPreference variants

Took me a while to find the information when I needed it so hopefully it should save some time for the next ones.

r? ``@thomcc``
2022-10-10 10:23:05 +09:00
Yuki Okushi
a4e5577262
Rollup merge of #102845 - cjgillot:gat-object, r=fee1-dead
Elaborate trait ref to compute object safety.

instead of building them manually from supertraits and associated items.

This allows to have the correct substs for GATs.

Fixes https://github.com/rust-lang/rust/issues/102751
2022-10-10 10:23:05 +09:00
Yuki Okushi
303ebd5b04
Rollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebank
Recover from impl Trait in type param bound

Fixes #102182
r? ``@estebank``
2022-10-10 10:23:04 +09:00
Yuki Okushi
0db05f16c8
Rollup merge of #102323 - Stoozy:master, r=cjgillot
Trying to suggest additional lifetime parameter

``@cjgillot`` This is what I have so far for #100615
2022-10-10 10:23:04 +09:00
Yuki Okushi
c50e64d872
Rollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillot
Stabilize `half_open_range_patterns`

This PR stabilize `feature(half_open_range_patterns)`:
```
Allows using `..=X` as a pattern.
```

And adds a new `feature(half_open_range_patterns_in_slices)` for the slice part, https://github.com/rust-lang/rust/pull/102275#issuecomment-1267422806.

The FCP was completed in https://github.com/rust-lang/rust/issues/67264.
2022-10-10 10:23:03 +09:00
Scott McMurray
0718aeceb3 From<Alignment> for usize & NonZeroUsize 2022-10-09 15:44:49 -07:00
Guillaume Gomez
550f579816 Add missing documentation for FileNameDisplayPreference variants 2022-10-09 23:32:15 +02:00
bors
1a7c203e7f Auto merge of #89123 - the8472:push_in_capacity, r=amanieu
add Vec::push_within_capacity - fallible, does not allocate

This method can serve several purposes. It

* is fallible
* guarantees that items in Vec aren't moved
* allows loops that do `reserve` and `push` separately to avoid pulling in the allocation machinery a second time in the `push` part which should make things easier on the optimizer
* eases the path towards `ArrayVec` a bit since - compared to `push()` - there are fewer questions around how it should be implemented

I haven't named it `try_push` because that should probably occupy a middle ground that will still try to reserve and only return an error in the unlikely OOM case.

resolves #84649
2022-10-09 21:02:33 +00:00
bors
81f3919303 Auto merge of #102850 - JohnTitor:rollup-lze1w03, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #101118 (fs::get_mode enable getting the data via fcntl/F_GETFL on major BSD)
 - #102072 (Add `ptr::Alignment` type)
 - #102799 (rustdoc: remove hover gap in file picker)
 - #102820 (Show let-else suggestion on stable.)
 - #102829 (rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`)
 - #102831 (Don't use unnormalized type in `Ty::fn_sig` call in rustdoc `clean_middle_ty`)
 - #102834 (Remove unnecessary `lift`/`lift_to_tcx` calls from rustdoc)
 - #102838 (remove cfg(bootstrap) from Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-09 18:15:26 +00:00
Andres Suarez
a65ddf06e0 update to syn-1.0.102 2022-10-09 13:51:55 -04:00
Camille GILLOT
e828ce53b9 Skip chained OpaqueCast when building captures. 2022-10-09 16:18:16 +00:00
Yuki Okushi
f59e8afb66
Rollup merge of #102838 - RalfJung:miri-bootstrap, r=oli-obk
remove cfg(bootstrap) from Miri

Looks like this was forgotten in the bootstrap bump.

r? `@oli-obk`
2022-10-10 00:09:43 +09:00
Yuki Okushi
deb93ca060
Rollup merge of #102834 - compiler-errors:unnecessary-lift, r=jyn514
Remove unnecessary `lift`/`lift_to_tcx` calls from rustdoc

Not sure why they were here in the first place
2022-10-10 00:09:43 +09:00