Commit Graph

223086 Commits

Author SHA1 Message Date
bors
f2eb9f85b9 Auto merge of #111017 - matthiaskrgr:rollup-yy9updi, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #110118 (download-rustc: Give a better error message if artifacts can't be dowloaded)
 - #110631 (rustdoc: catch and don't blow up on impl Trait cycles)
 - #110732 (Make ConstProp some tests unit.)
 - #110996 (bootstrap: Fix compile error: unused-mut)
 - #110999 (Output some bootstrap messages on stderr)
 - #111000 (Remove unneeded function call in `core::option`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-30 16:54:16 +00:00
Matthias Krüger
d8d24d498f
Rollup merge of #111000 - JohnBobbo96:core_option_unneeded_function, r=jyn514
Remove unneeded function call in `core::option`.

r? `@jyn514`
2023-04-30 16:25:48 +02:00
Matthias Krüger
a42261086f
Rollup merge of #110999 - clubby789:bootstrap-stderr, r=Mark-Simulacrum
Output some bootstrap messages on stderr

Fixes #110995
2023-04-30 16:25:48 +02:00
Matthias Krüger
9b10f985f9
Rollup merge of #110996 - loongarch-rs:fix-bootstrap, r=ozkanonur
bootstrap: Fix compile error: unused-mut

Compile errors:

```
   Compiling bootstrap v0.0.0 (/home/hev/rust/rust/src/bootstrap)
error: variable does not need to be mutable
    --> config.rs:1312:17
     |
1312 |             let mut build_target = config
     |                 ----^^^^^^^^^^^^
     |                 |
     |                 help: remove this `mut`
     |
     = note: `-D unused-mut` implied by `-D warnings`

error: could not compile `bootstrap` (lib) due to previous error
```
2023-04-30 16:25:47 +02:00
Matthias Krüger
eae208eef6
Rollup merge of #110732 - cjgillot:unit-const-prop, r=tmiasko
Make ConstProp some tests unit.

Part of the effort to tidy up mir-opt test suite.
2023-04-30 16:25:47 +02:00
Matthias Krüger
5dec8dff7b
Rollup merge of #110631 - notriddle:notriddle/impl-trait-cycle, r=GuillaumeGomez
rustdoc: catch and don't blow up on impl Trait cycles

Fixes #110629

An odd feature of Rust is that `Foo` is invalid, but `Bar` is okay:

    type Foo<'a, 'b> = Box<dyn PartialEq<Foo<'a, 'b>>>;
    type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>>;

To get it right, track every time rustdoc descends into a type alias, so if it shows up twice, it can be write the path instead of infinitely expanding it.
2023-04-30 16:25:46 +02:00
Matthias Krüger
b64d4c2f26
Rollup merge of #110118 - jyn514:download-error, r=Mark-Simulacrum
download-rustc: Give a better error message if artifacts can't be dowloaded

It should be very rare in practice to happen; people would need to both have `download-ci-llvm` disabled and `download-rustc` enabled. I think it may be more common if we start turning this on by default, though.

Helps with https://github.com/rust-lang/rust/issues/81930.

Before:
```
downloading https://ci-artifacts.rust-lang.org/rustc-builds/bf5cad8e775fb326465e5c1b98693e5d259da156/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
curl: (22) The requested URL returned error: 404
```

After:
```
downloading https://ci-artifacts.rust-lang.org/rustc-builds/bf5cad8e775fb326465e5c1b98693e5d259da156/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
curl: (22) The requested URL returned error: 404

error: failed to download pre-built rustc from CI

note: old builds get deleted after a certain time
help: if trying to compile an old commit of rustc, disable `download-rustc` in config.toml:

[rust]
download-rustc = false
```
2023-04-30 16:25:46 +02:00
bors
831c9298c8 Auto merge of #103406 - Jules-Bertholet:from_clone_slice_to_box, r=dtolnay
Loosen `From<&[T]> for Box<[T]>` bound to `T: Clone`

Also loosens `From<Cow<'_, [T]>> for Box<[T]>`'s bound.

[Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/From.3C.26.5BT.5D.3E.20impls.20consistency)
2023-04-30 13:58:00 +00:00
bors
89158e210c Auto merge of #110942 - Zalathar:coverage-tests, r=Mark-Simulacrum
Don't accidentally ignore all output in `tests/run-make/coverage-reports` diffs

Because the literal pipe `|` character was not escaped, these regexes ended up accidentally ignoring every line in the coverage report output, so the tests would not fail even if the output was wrong.
2023-04-30 10:36:06 +00:00
bors
c1bb0e0911 Auto merge of #110935 - scottmcm:always-ord, r=Mark-Simulacrum
`inline(always)` for `lt`/`le`/`ge`/`gt` on integers and floats

I happened to notice one of these not getting inlined as part of `Range::next` in <https://rust.godbolt.org/z/4WKWWxj1G>
```rust
    bb1: {
        StorageLive(_5);
        _6 = &mut _4;
        StorageLive(_21);
        StorageLive(_14);
        StorageLive(_15);
        _15 = &((*_6).0: usize);
        StorageLive(_16);
        _16 = &((*_6).1: usize);
        _14 = <usize as PartialOrd>::lt(move _15, move _16) -> bb7;
    }
```

So since a call for something that's just one instruction is never the right choice, `#[inline(always)]` seems appropriate, like we have it on things like the rotate methods on integers.
2023-04-30 07:43:18 +00:00
bors
d3edfd18c7 Auto merge of #111001 - matthiaskrgr:rollup-u590scu, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #110586 (Fix Unreadable non-UTF-8 output on localized MSVC)
 - #110652 (Add test for warning-free builds of `core` under `no_global_oom_handling`)
 - #110973 (improve error notes for packed struct reference diagnostic)
 - #110981 (Move most rustdoc-ui tests into subdirectories)
 - #110983 (rustdoc: Get `repr` information through `AdtDef` for foreign items)
 - #110984 (Do not resolve anonymous lifetimes in consts to be static.)
 - #110997 (Improve internal field comments on `slice::Iter(Mut)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-30 00:31:02 +00:00
Michael Howell
b1d08275a9 rustdoc: catch and don't blow up on impl Trait cycles
An odd feature of Rust is that `Foo` is invalid, but `Bar` is okay:

    type Foo<'a, 'b> = Box<dyn PartialEq<Foo<'a, 'b>>>;
    type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>>;

To get it right, track every time rustdoc descends into a type alias,
so if it shows up twice, it can be write the path instead of
infinitely expanding it.
2023-04-29 16:53:02 -07:00
Matthias Krüger
f7208139de
Rollup merge of #110997 - scottmcm:slice-iter-comments, r=the8472
Improve internal field comments on `slice::Iter(Mut)`

I wrote these in a previous PR that I ended up withdrawing, so might as well submit them separately.

`@bors` rollup=always
2023-04-30 01:14:59 +02:00
Matthias Krüger
a656a2019a
Rollup merge of #110984 - cjgillot:const-infer-lifetime, r=compiler-errors
Do not resolve anonymous lifetimes in consts to be static.

Fixes https://github.com/rust-lang/rust/issues/110931
2023-04-30 01:14:59 +02:00
Matthias Krüger
549b3a13a1
Rollup merge of #110983 - GuillaumeGomez:foreign-repr, r=notriddle
rustdoc: Get `repr` information through `AdtDef` for foreign items

As suggested by `@notriddle,` this approach works too. The only downside is that the display of the original attribute isn't kept, but I think it's an acceptable downside.

r? `@notriddle`
2023-04-30 01:14:59 +02:00
Matthias Krüger
4b79276e60
Rollup merge of #110981 - jyn514:rustdoc-tests, r=notriddle
Move most rustdoc-ui tests into subdirectories

This makes it easier to know where to add a new test, and makes the top-level directory less overwhelming.
2023-04-30 01:14:58 +02:00
Matthias Krüger
791d33c5eb
Rollup merge of #110973 - bindsdev:packed-struct-ref-diagnostic-note, r=compiler-errors
improve error notes for packed struct reference diagnostic

Addresses #110199
2023-04-30 01:14:58 +02:00
Matthias Krüger
e4daa810ff
Rollup merge of #110652 - ojeda:core-no_global_oom_handling-test, r=Mark-Simulacrum
Add test for warning-free builds of `core` under `no_global_oom_handling`

`tests/run-make/alloc-no-oom-handling` tests that `alloc` under `no_global_oom_handling` builds and is warning-free.

Do the same for `core` to prevent issues such as [1].

Link: https://github.com/rust-lang/rust/pull/110649 [1]
2023-04-30 01:14:56 +02:00
Matthias Krüger
734e866e63
Rollup merge of #110586 - ChrisDenton:msvc-oem-output, r=workingjubilee
Fix Unreadable non-UTF-8 output on localized MSVC

Fixes #35785 by converting non UTF-8 linker output to Unicode using the OEM code page.

Before:

```text
  = note: Non-UTF-8 output: LINK : fatal error LNK1181: cannot open input file \'m\x84rchenhaft.obj\'\r\n
```

After:

```text
   = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj'
```

The difference is more dramatic if using a non-ascii language pack for Windows.
2023-04-30 01:14:55 +02:00
John Bobbo
a4f391d4de
Remove unneeded function call in core::option. 2023-04-29 15:38:04 -07:00
Jules Bertholet
18d2c60975
cfg-gate BoxFromSlice trait
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2023-04-29 18:10:10 -04:00
bors
f5adff6bd8 Auto merge of #109611 - Zoxc:query-engine-rem, r=cjgillot
Remove `QueryEngine` trait

This removes the `QueryEngine` trait and `Queries` from `rustc_query_impl` and replaced them with function pointers and fields in `QuerySystem`. As a side effect `OnDiskCache` is moved back into `rustc_middle` and the `OnDiskCache` trait is also removed.

This has a couple of benefits.
- `TyCtxt` is used in the query system instead of the removed `QueryCtxt` which is larger.
- Function pointers are more flexible to work with. A variant of https://github.com/rust-lang/rust/pull/107802 is included which avoids the double indirection. For https://github.com/rust-lang/rust/pull/108938 we can name entry point `__rust_end_short_backtrace` to avoid some overhead. For https://github.com/rust-lang/rust/pull/108062 it avoids the duplicate `QueryEngine` structs.
- `QueryContext` now implements `DepContext` which avoids many `dep_context()` calls in `rustc_query_system`.
- The `rustc_driver` size is reduced by 0.33%, hopefully that means some bootstrap improvements.
- This avoids the unsafe code around the `QueryEngine` trait.

r? `@cjgillot`
2023-04-29 21:58:13 +00:00
Guillaume Gomez
b778688f91 Unify attributes retrieval for JSON and HTML rendering 2023-04-29 23:36:48 +02:00
clubby789
8c8d198d59 Output some bootstrap messages on stderr 2023-04-29 22:00:21 +01:00
Guillaume Gomez
2693e20aa3 Extend foreign inlined item with #[repr()] test 2023-04-29 22:53:10 +02:00
Guillaume Gomez
89b0956a9a Fix display of attributes for enums 2023-04-29 22:53:10 +02:00
Guillaume Gomez
61b6f65884 Get repr information through AdtDef for foreign items 2023-04-29 22:53:10 +02:00
Scott McMurray
57aac3f671 Improve internal field comments on slice::Iter(Mut)
I wrote these in a previous PR that I ended up withdrawing, so might as well submit them separately.
2023-04-29 12:50:53 -07:00
bors
87b1f891ea Auto merge of #110576 - jyn514:unify-test-args, r=ozkanonur
bootstrap: Unify test argument handling

Fixes #104198. Does *not* help with https://github.com/rust-lang/rust/issues/80124 because I couldn't figure out a reasonable way to omit `--lib` only for `panic_abort` and not other `std` dependencies.

- Remove unnecessary `test_kind` field and `TestKind` struct. These are just subsets of the existing `builder.kind` / `Kind` struct.
- Add a new `run_cargo_test` function which handles passing arguments to cargo based on `builder.config`
- Switch all Steps in `mod test` to `run_cargo_test` where possible
- Combine several steps into one `CrateBootstrap` step. These tests all do the same thing, just with different crate names.
- Fix `x test --no-doc`. This is much simpler after the refactors mentioned earlier, but I'm happy to split it into a separate PR if desired. Before, this would panic a lot because steps forgot to pass `--lib`.
2023-04-29 18:55:28 +00:00
WANG Rui
489925fcaf bootstrap: Fix compile error: unused-mut 2023-04-30 00:58:09 +08:00
jyn
78a709348d Fix x test --no-deps
- Use `cargo metadata` to determine whether a crate has a library
  package or not
- Collect metadata for all workspaces, not just the root workspace and
  cargo
- Don't pass `--lib` for crates without a library
- Use `run_cargo_test` for rust-installer
- Don't build documentation in `lint-docs` if `--no-doc` is passed
2023-04-29 11:51:57 -05:00
jyn
2a75607bab Combine several Steps into a single step with multiple paths 2023-04-29 11:51:57 -05:00
jyn
ff674c1664 Convert the rest of the test Steps to run_cargo_test 2023-04-29 11:51:57 -05:00
jyn
5da288f842 move lint tests into subdirectories 2023-04-29 11:36:19 -05:00
jyn
5fa975142f Move some rustdoc-ui tests to subdirectories 2023-04-29 11:36:19 -05:00
bors
eb62877597 Auto merge of #110994 - matthiaskrgr:rollup-wv4u5yi, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #105848 (rustdoc: Add a new lint for broken inline code)
 - #110644 (Update tests for libtest `--format json`)
 - #110950 (Deny the `unsafe_op_in_unsafe_fn` lint in `rustc_arena`.)
 - #110951 (Add support for LibreSSL 3.7.x)
 - #110964 (rustdoc: fix weird margins between Deref impl items)
 - #110979 (windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-29 16:17:35 +00:00
Matthias Krüger
72de69e046
Rollup merge of #110979 - jyn514:windows-locking, r=ChrisDenton
windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory

This fixes the following recurring error on windows:
```
Traceback (most recent call last):
  File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
    bootstrap.main()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
    bootstrap(args)
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
    build.download_toolchain()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
    shutil.rmtree(bin_root)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'
```

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

r? ```@ChrisDenton```
2023-04-29 15:51:17 +02:00
Matthias Krüger
39ed894926
Rollup merge of #110964 - notriddle:notriddle/deref-impl, r=GuillaumeGomez
rustdoc: fix weird margins between Deref impl items

## Before

![image](https://user-images.githubusercontent.com/1593513/235245977-90770591-22c1-4a27-9464-248a3729a2b7.png)

## After

![image](https://user-images.githubusercontent.com/1593513/235246009-0e83113e-42b7-4e29-981d-969f9d20af01.png)

## Description

In the old setup, if the dereffed-to item has multiple impl blocks, each one gets its own `div.impl-items` in the section, but there are no headers separating them. Since the last method in a `div.impl-items` has no bottom margin, and there are no margins between these divs, there is no margin between the last method of one impl and the first method of the following impl.

This patch fixes it by simplifying the HTML. Each Deref block gets exactly one `div.impl-items`, no matter how many impl blocks it actually has.
2023-04-29 15:51:17 +02:00
Matthias Krüger
cdcec39be6
Rollup merge of #110951 - mixi:libressl-3.7.x, r=Mark-Simulacrum
Add support for LibreSSL 3.7.x

This updates the `openssl-sys` crate to 0.9.87 to support building the toolchain against the system libraries provided by LibreSSL version 3.7.x.

LibreSSL 3.7.x has been supported since `openssl-sys` version 0.9.85.
2023-04-29 15:51:16 +02:00
Matthias Krüger
0756c1cb89
Rollup merge of #110950 - JohnBobbo96:rustc_arena_unsafe_fn, r=Nilstrieb
Deny the `unsafe_op_in_unsafe_fn` lint in `rustc_arena`.

r? ```@Nilstrieb```
2023-04-29 15:51:16 +02:00
Matthias Krüger
957a6ad4d9
Rollup merge of #110644 - pietroalbini:pa-json-formatting-tests, r=Mark-Simulacrum
Update tests for libtest `--format json`

This PR makes the test work on beta and stable, and adds a test ensuring the option is not available on beta and stable. Backported these commits from https://github.com/rust-lang/rust/pull/110414.
2023-04-29 15:51:15 +02:00
Matthias Krüger
825bc606f5
Rollup merge of #105848 - lukas-code:backticks, r=GuillaumeGomez,jyn514,notriddle
rustdoc: Add a new lint for broken inline code

This patch adds `rustdoc::unescaped_backticks`, a new rustdoc lint that will detect broken inline code nodes.

The lint woks by finding stray backticks and with some heuristics tries to guess where the second backtick might be missing.

Here is how it looks:
```rust
#![warn(rustdoc::unescaped_backticks)]

/// `add(a, b) is the same as `add(b, a)`.
pub fn add(a: i32, b: i32) -> i32 { a + b }
```
```text
warning: unescaped backtick
 --> src/lib.rs:3:41
  |
3 | /// `add(a, b) is the same as `add(b, a)`.
  |                                         ^
  |
help: a previous inline code might be longer than expected
  |
3 | /// `add(a, b)` is the same as `add(b, a)`.
  |               +
help: if you meant to use a literal backtick, escape it
  |
3 | /// `add(a, b) is the same as `add(b, a)\`.
  |                                         +
```

If we can't get proper spans, for example if the doc comment comes from a macro expansion, we print the suggestion in help messages instead. Here's a [real-world example](https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/trait.Filter.html#method.max_level_hint):

```text
warning: unescaped backtick
    --> /tracing-subscriber-0.3.17/src/layer/mod.rs:1400:9
     |
1400 | /         /// Returns an optional hint of the highest [verbosity level][level] that
1401 | |         /// this `Filter` will enable.
1402 | |         ///
1403 | |         /// If this method returns a [`LevelFilter`], it will be used as a hint to
...    |
1427 | |         /// [`Interest`]: tracing_core::subscriber::Interest
1428 | |         /// [rebuild]: tracing_core::callsite::rebuild_interest_cache
     | |_____________________________________________________________________^
     |
     = help: a previous inline code might be longer than expected
              change: Therefore, if the `Filter will change the value returned by this
             to this: Therefore, if the `Filter` will change the value returned by this
     = help: if you meant to use a literal backtick, escape it
              change: [`rebuild_interest_cache`][rebuild] is called after the value of the max
             to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max
```

You can find more examples [here](https://gist.github.com/lukas-code/7678ddf5c608aee97b3a669de80d3465).

A limitation of the current implementation is, that it cannot suggest removing misplaced backticks, for example [here](https://docs.rs/tikv-jemalloc-sys/0.5.3+5.3.0-patched/tikv_jemalloc_sys/fn.mallctl.html).

The lint is allowed by default ~~and nightly-only~~ for now, ~~but without a feature gate. This is similar to how `rustdoc::invalid_html_tags` and `rustdoc::bare_urls` were handled.~~
2023-04-29 15:51:15 +02:00
bors
27d22d2045 Auto merge of #110992 - bjorn3:sync_cg_clif-2023-04-29, r=bjorn3
Sync rustc_codegen_cranelift

Updated Cranelift and fixed a couple of bugs.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2023-04-29 13:24:36 +00:00
bjorn3
d925a536b5 Update list of allowed cg_clif dependencies 2023-04-29 12:09:37 +00:00
bjorn3
a8697f9565 Merge commit 'ef07e8e60f994ec014d049a95591426fb92ebb79' into sync_cg_clif-2023-04-29 2023-04-29 12:00:43 +00:00
bjorn3
ef07e8e60f Integrate better with Cranelift's profiling infrastructure 2023-04-29 11:27:28 +00:00
bjorn3
517b5c1f1b Update Cranelift to 0.95.1
This version was released as part of a security fix for Wasmtime. The
fix didn't change Cranelift though, so this commit is not strictly
necessary, but also doesn't hurt.
2023-04-29 11:24:05 +00:00
bjorn3
ee3721eec6 Rustup to rustc 1.71.0-nightly (f49560538 2023-04-28) 2023-04-29 11:16:48 +00:00
Lukas Markeffsky
4f15a772b3 Add rustdoc::unescaped_backtick lint 2023-04-29 13:13:25 +02:00
bjorn3
72022bb24d Sync from rust f495605381 2023-04-29 11:10:56 +00:00