Commit Graph

226326 Commits

Author SHA1 Message Date
hkalbasi
5531d46c95 Emit '_ for lifetime generics in HirDisplay 2023-06-05 10:55:47 +03:30
Esme Yi
e31661cb9e Address @bjorn3's comments. 2023-06-05 15:15:09 +08:00
bors
51f714c8c5 Auto merge of #110945 - wackbyte:doc-vis-on-inherent-assoc-types, r=jsha
rustdoc: render visibility on associated types

This should only affect inherent associated types (#8995).
2023-06-05 04:54:21 +00:00
jyn
af4e6c1937 Don't double-print status messages in GHA
Before:

```
Building stage0 tool jsondocck (x86_64-unknown-linux-gnu)
  Building stage0 tool jsondocck (x86_64-unknown-linux-gnu)
   Downloading crates ...
```

After:

```
Building stage0 tool jsondocck (x86_64-unknown-linux-gnu)
   Downloading crates ...
```
2023-06-04 22:12:29 -05:00
jyn
5eeeed1aa1 Greatly decrease the size of rustc_driver.so when debuginfo is enabled
- Only add -gz if it's supported
- Don't include extra unnecessary debuginfo when only debuginfo-level=1 is set
- Compress debuginfo sections to reduce the size of debuginfo on disk.

before: 650 MB
line tables only: 335 MB
compressed only: 216 MB
compressed and line tables: 186 MB
no debuginfo at all: 130 MB

I want to investigate why `-C line-tables-only` is still ~tripling the
size of the binary, but this seems like a good improvement in the
meantime.

I've tested that both valgrind and perf can read the debuginfo:
```
(bash@dev-desktop-us-1.infra.rust-lang.org) ~/rust [08:31:08]
; valgrind $(rustup which rustc --toolchain rust_stage2) --version
==441671== Memcheck, a memory error detector
==441671== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==441671== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==441671== Command: /home/gh-jyn514/.local/lib/rustup/toolchains/rust_stage2/bin/rustc --version
==441671==
rustc 1.70.0-dev
==441671==
==441671== HEAP SUMMARY:
==441671==     in use at exit: 231,289 bytes in 1,874 blocks
==441671==   total heap usage: 2,538 allocs, 664 frees, 486,368 bytes allocated
==441671==
==441671== LEAK SUMMARY:
==441671==    definitely lost: 70,656 bytes in 1 blocks
==441671==    indirectly lost: 0 bytes in 0 blocks
==441671==      possibly lost: 0 bytes in 0 blocks
==441671==    still reachable: 160,633 bytes in 1,873 blocks
==441671==         suppressed: 0 bytes in 0 blocks
==441671== Rerun with --leak-check=full to see details of leaked memory
==441671==
==441671== For lists of detected and suppressed errors, rerun with: -s
==441671== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
; perf record $(rustup which rustc --toolchain rust_stage2) --version
rustc 1.70.0-dev
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.005 MB perf.data (70 samples) ]
; perf report
Samples: 70  of event 'cycles:u', Event count (approx.): 21356967
Overhead  Command  Shared Object                        Symbol
  51.55%  rustc    ld-linux-aarch64.so.1                [.] _dl_lookup_symbol_x
  18.70%  rustc    ld-linux-aarch64.so.1                [.] _dl_relocate_object
  11.95%  rustc    ld-linux-aarch64.so.1                [.] do_lookup_x
   5.55%  rustc    [unknown]                            [k] 0xffffa9ad41cfcfdc
   2.68%  rustc    libc.so.6                            [.] __GI___strlen_asimd
   2.42%  rustc    librustc_driver-1a385c366c35e81a.so  [.] llvm::StringMapImpl::LookupBucketFor
   2.16%  rustc    librustc_driver-1a385c366c35e81a.so  [.] _GLOBAL__sub_I_X86InstructionSelector.cpp
   1.96%  rustc    libstd-990fe978dab76ef3.so           [.] <alloc::vec::Vec<T,A> as core::clone::Clone>::clone
   1.60%  rustc    librustc_driver-1a385c366c35e81a.so  [.] llvm:🆑:opt<bool, false, llvm:🆑:parser<bool> >::~opt
   1.22%  rustc    ld-linux-aarch64.so.1                [.] strcmp
   0.13%  rustc    ld-linux-aarch64.so.1                [.] stat64
   0.05%  rustc    ld-linux-aarch64.so.1                [.] __minimal_calloc
   0.02%  rustc    ld-linux-aarch64.so.1                [.] __GI___tunables_init
   0.02%  rustc    ld-linux-aarch64.so.1                [.] _dl_start
   0.00%  rustc    [unknown]                            [k] 0xffffa9ad41cfd844
   0.00%  rustc    ld-linux-aarch64.so.1                [.] _start
```
2023-06-04 21:04:10 -05:00
bors
e4106065bf Auto merge of #112272 - jieyouxu:issue-112269, r=compiler-errors
Show note for type ascription on a local binding interpreted as a constant pattern and not a new variable

Given the code

```rust
pub fn main() {
    const y: i32 = 4;
    let y: i32 = 3;
}
```

`y` in the let binding is actually interpreted as a constant pattern and is not a new variable, causing confusing diagnostics about refutable patterns in local binding.

This PR extends the note for type ascription of a constant pattern to `AscribeUserType` patterns which have `Constant` subpatterns.

Fixes #112269.
2023-06-05 01:33:58 +00:00
bors
dcf3571c51 Auto merge of #112266 - Swatinem:fix-async-block-inference, r=compiler-errors
Fix type-inference regression in #112225

The type inference of argument-position closures and async blocks regressed in 1.70 as the evaluation order of async blocks changed, as they are not implicitly wrapped in an identity-function anymore.

Fixes #112225 by making sure the evaluation order stays the same as it used to.

r? `@compiler-errors`

As this was a stable-to-stable regression, it might be worth to consider backporting. Although the workaround for this is trivial as well: Just wrap the async block in another block.
2023-06-04 22:21:42 +00:00
Matthew Esposito
7ed7e208ab
Run Rustfmt before RustAnalyzer 2023-06-04 18:06:52 -04:00
Matthew Esposito
1835d0333b
Make RustAnalyzer check off by default 2023-06-04 18:06:34 -04:00
bors
101fa903bb Auto merge of #112282 - matthiaskrgr:rollup-1g9w02p, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #112247 (rust-lld: add rpath entry to the correct `lib` folder)
 - #112274 (Migrate GUI colors test to original CSS color format)
 - #112277 (Don't require the output from libtest to be valid UTF-8)

Failed merges:

 - #112251 (rustdoc: convert `if let Some()` that always matches to variable)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-04 19:38:09 +00:00
bors
2f1b7cedcf Auto merge of #14971 - lowr:fix/captured-item-ty-outer-binder, r=HKalbasi
fix: consider outer binders when folding captured items' type

Fixes #14966

Basically, the crash is caused by us producing a broken type and passing it to chalk: `&dyn for<type> [for<> Implemented(^1.0: A<^0.0>)]` (notice the innermost bound var `^0.0` has no corresponding binder). It's created in `CapturedItemWithoutTy::with_ty()`, which didn't consider outer binders when folding types to replace placeholders with bound variables.

The fix is one-liner, but I've also refactored the surrounding code a little.
2023-06-04 18:25:23 +00:00
Matthias Krüger
0716ac9bff
Rollup merge of #112277 - jyn514:non-utf8-tests, r=ozkanonur
Don't require the output from libtest to be valid UTF-8

On Windows this is sometimes not the case, for reasons I can't track down (maybe related to localization? the bug report had a french locale).

This works around the problem, although I'm not sure how to confirm we're not generating invalid build metrics in this case.

Fixes https://github.com/rust-lang/rust/issues/112273.
2023-06-04 19:41:16 +02:00
Matthias Krüger
97b702fda9
Rollup merge of #112274 - GuillaumeGomez:migrate-gui-test-color-11, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

The update for `browser-ui-test` version is because for hex color conversions, it used a precision of 1 instead of 2, which was problematic.

r? `@notriddle`
2023-06-04 19:41:15 +02:00
Matthias Krüger
ef2c64ba6c
Rollup merge of #112247 - lqd:lld-rpath, r=Mark-Simulacrum
rust-lld: add rpath entry to the correct `lib` folder

An explanation, for our linux rustup toolchain:
- `lld` / `rust-lld` is built as a regular LLVM tool, but is not distributed via the `llvm-tools` component. It's distributed by default, like a regular rust binary, like cargo and rustc. The general expected setup is: binaries in `bin` and libraries in `lib`, so the rpath we use for a `bin/$executable` is `$ORIGIN/../lib`.
- However, `rust-lld` is _not_ in the same location as our other executables (`$root/bin`), it's in `$root/lib/rustlib/$host/bin/`. The current rpath thus expects the LLVM's shared library to be in `$root/lib/rustlib/$host/lib/`.
- That .so is only present in `$root/lib`, causing #80703. (LLVM's shared library is also copied to `$root/lib/rustlib/$host/lib/` with the `llvm-tools` component, so it also was [a workaround for the issue](https://github.com/rust-lang/rust/issues/80703#issuecomment-1574788504))

rustup's `LD_LIBRARY_PATH` overrides made this discrepancy invisible when we switched to `llvm.link-shared = true`, and this only showed up when running `rustc` or `rust-lld`'s executables directly.

To fix this we could:
- copy the .so to this expected location all the time, but that seems wasteful.
- or, add an rpath entry when building LLD, which seems preferable to me (but I don't know if it could cause issues).

This PR does the latter, tweaking how bootstrap builds LLD to point to the expected directory, and fixes #80703.

(Since this is related to P-high issues about switching to lld by default, I'll cc `@petrochenkov` to keep them updated.)
2023-06-04 19:41:14 +02:00
bors
5545961df2 Auto merge of #14976 - HKalbasi:mir-fix, r=HKalbasi
Fix missing terminator for slice pattern
2023-06-04 17:30:16 +00:00
hkalbasi
b4907a531f Fix missing terminator for slice pattern 2023-06-04 20:59:27 +03:30
bors
dc25fbe984 Auto merge of #112176 - jyn514:ci-debugging, r=clubby789
Print the full arguments passed to `./configure` in CI

This is useful to replicate CI failures locally. Before, the arguments would be truncated and it would be hard to tell what it was actually doing.

Before:
```
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--save-t ...
```

After:
```
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--save-toolstates=/tmp/toolstate/toolstates.json', '--enable-verbose', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--disable-dist-src', '--set', 'rust.download-rustc=if-unchanged', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'llvm.download-ci-llvm=if-available', '--enable-missing-tools']
```
2023-06-04 16:41:37 +00:00
jyn
f9a81e4769 Don't require the output from libtest to be valid UTF-8
On Windows this is sometimes not the case, for reasons I can't track down.

This works around the problem, although I'm not sure how to confirm we're not generating invalid
build metrics in this case.
2023-06-04 09:18:23 -05:00
Grisha Vartanyan
dd2bd03d0a Remove ExtendWith and ExtendElement 2023-06-04 15:55:34 +02:00
Guillaume Gomez
d67e00eb26 Migrate GUI colors test to original CSS color format 2023-06-04 15:55:30 +02:00
bors
e04e19d222 Auto merge of #112270 - matthiaskrgr:rollup-umplsb6, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #109093 (add `#[doc(alias="flatmap")]` to `Option::and_then`)
 - #110701 (Fix `x test core` when download-rustc is enabled)
 - #111982 (Revert "Enable incremental independent of stage")
 - #112158 (Add portable-simd mention)
 - #112172 (doc: improve explanation)
 - #112178 (Fix bug where private item with intermediate doc hidden re-export was not inlined)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-04 13:54:31 +00:00
Guillaume Gomez
100db9946b Update browser-ui-test version 2023-06-04 15:50:42 +02:00
许杰友 Jieyou Xu (Joe)
55b4549602
Show note for type ascription interpreted as a constant pattern, not a new variable
Given the code

```rust
pub fn main() {
    const y: i32 = 4;
    let y: i32 = 3;
}
```

`y` in the let binding is actually interpreted as a constant pattern
and is not a new variable, causing confusing diagnostics about
refutable patterns in local binding.

This commit extends the note for type ascription as a constant pattern
to `AscribeUserType` patterns as well.
2023-06-04 20:49:30 +08:00
bors
17426835d8 Auto merge of #14972 - HKalbasi:mir-fix, r=HKalbasi
Fix `unused-mut` false positive for `Box`
2023-06-04 12:26:39 +00:00
hkalbasi
0408af6453 Fix unused-mut false positive for Box 2023-06-04 15:56:01 +03:30
Ryo Yoshida
f549cacc1d
Destructure InferenceResult in resolve_all()
so that whenever new fields are added we don't forget to handle them.
2023-06-04 20:38:40 +09:00
Matthias Krüger
0d6749c2af
Rollup merge of #112178 - GuillaumeGomez:fix-inline-private-intermediate, r=notriddle
Fix bug where private item with intermediate doc hidden re-export was not inlined

This fixes this bug:

```rust
mod private {
    /// Original.
    pub struct Bar3;
}

/// Hidden.
#[doc(hidden)]
pub use crate::private::Bar3;
/// Visible.
pub use self::Bar3 as Reexport;
```

In this case, `private::Bar3` should be inlined and renamed `Reexport` but instead we have:

```
pub use self::Bar3 as Reexport;
```

and no links.

There were actually two issues: the first one is that we forgot to check if the next intermediate re-export was doc hidden. The second was that we made the `#[doc(hidden)]` attribute inheritable, which shouldn't be possible.

r? `@notriddle`
2023-06-04 13:21:28 +02:00
Matthias Krüger
cbc3e3f641
Rollup merge of #112172 - tshepang:patch-1, r=Mark-Simulacrum
doc: improve explanation
2023-06-04 13:21:27 +02:00
Matthias Krüger
629a1e4419
Rollup merge of #112158 - calebzulawski:cc, r=Mark-Simulacrum
Add portable-simd mention

Adds a triagebot message for portable-simd
2023-06-04 13:21:27 +02:00
Matthias Krüger
d545220fd9
Rollup merge of #111982 - jyn514:disable-incremental, r=Mark-Simulacrum
Revert "Enable incremental independent of stage"

This reverts commit 827f656ebb.

Incremental is not sound to use across stages. Arbitrary changes to the compiler can invalidate the incremental cache - even changes to normal queries, not incremental itself! - and we do not currently enable `incremental-verify-ich` in bootstrap. Since 2018, we highly recommend and nudge users towards stage 1 builds instead of stage 2, and using `keep-stage` for anything other than libstd is very rare.

I don't think the risk of unsoundness is worth the very minor speedup when building libstd. Disable incremental to avoid spurious panics and miscompilations when building with the stage 1 and 2 sysroot.

Combined with https://github.com/rust-lang/rust/pull/111329, this should fix https://github.com/rust-lang/rust/issues/76720.

r? `@Mark-Simulacrum`
2023-06-04 13:21:26 +02:00
Matthias Krüger
f2f0e6cc81
Rollup merge of #110701 - jyn514:test-core, r=Mark-Simulacrum
Fix `x test core` when download-rustc is enabled

Fix `x test --stage 2 core` when download-rustc is enabled

This works by building std from source instead of downloading it, for library tests only.

This was somewhat complicated because of the following requirements:
1. Unconditionally downloading libstd breaks `x test core`, because `coretests` requires the std loaded from the sysroot to match the std that's currently being tested.
2. Unconditionally rebuilding libstd breaks `x test ui-fulldeps librustdoc`, because anything loading `rustc_private` needs to use the same libstd that rustc was built with.

Break the knot by introducing a new `stage2-test-sysroot`, used only for testing `std` itself. This
holds a freshly compiled std, while `stage2` and `ci-rustc-sysroot` still hold the downloaded std.

This also extends the existing `cp_filtered` in Sysroot to apply to the `rust-std` component, not just the `rustc-dev` component, to avoid having both versions of std in `stage2-test-sysroot`.

Fixes #110352.
2023-06-04 13:21:26 +02:00
Matthias Krüger
7ee2505529
Rollup merge of #109093 - Dante-Broggi:patch-2, r=joshtriplett
add `#[doc(alias="flatmap")]` to `Option::and_then`

I keep forgetting that rust calls this `and_then` and trying to search for `flatmap`. `and_then`'s docs even mention "Some languages call this operation flatmap", but it doesn't show up as a result in the search at `https://doc.rust-lang.org/std/?search=flatmap`
2023-06-04 13:21:25 +02:00
bors
a28e125b21 Auto merge of #109525 - bzEq:aix-bootstrap-no-rpath, r=Mark-Simulacrum
Rpath is not supported on AIX

Both `-Wl,-rapth` and `-Wl,-z,origin` are not supported on AIX.

AIX linker is documented in https://www.ibm.com/docs/en/aix/7.1?topic=l-ld-command.
2023-06-04 11:09:58 +00:00
Ryo Yoshida
a3789eabc9
Minor refactorings
- use `DefWithBodyId::as_generic_def_id()`
- add comments on `InferenceResult` invariant
- move local helper function to bottom to comply with style guide
2023-06-04 19:39:49 +09:00
Ryo Yoshida
275afd6e79
fix: consider outer binders when folding captured items' type 2023-06-04 19:38:47 +09:00
bors
9d5c34a80e Auto merge of #14970 - HKalbasi:mir-fix, r=HKalbasi
Detect "bound more than once" error and suppress `need-mut` for it.

Fix the `need-mut` false positive for `izip!`
2023-06-04 09:33:53 +00:00
hkalbasi
71f3e4b08c Detect "bound more than once" error and suppress need-mut for it. 2023-06-04 12:39:36 +03:30
Arpad Borsos
75b557a2c4
Fix type-inference regression in #112225
The type inference of argument-position closures and async blocks
regressed in 1.70 as the evaluation order of async blocks changed, as
they are not implicitly wrapped in an identity-function anymore.

Fixes #112225 by making sure the evaluation order stays the same as it
used to.
2023-06-04 10:56:00 +02:00
bors
c4eb3946fa Auto merge of #14969 - Veykril:inert-attrs, r=Veykril
Update builtin attribute list
2023-06-04 08:02:36 +00:00
Lukas Wirth
f9a9e40c0a Update builtin attribute list 2023-06-04 10:02:11 +02:00
Scott McMurray
e1b020df9f Use load-store instead of memcpy for short integer arrays 2023-06-04 00:51:49 -07:00
Scott McMurray
cce0b52e7b Add a codegen test for manually swapping a small Copy type
To confirm we're not just helping `mem::swap`
2023-06-04 00:50:55 -07:00
bors
48f8799bf1 Auto merge of #14967 - rust-lang:revert-14965-panic-ctx, r=Veykril
Revert "Add mandatory panic contexts to all threadpool tasks"

Reverts rust-lang/rust-analyzer#14965

This won't quite work actually given the use of `catch_unwind` in some of these
2023-06-04 07:30:54 +00:00
Lukas Wirth
a1af9eb1f8
Revert "Add mandatory panic contexts to all threadpool tasks" 2023-06-04 09:30:21 +02:00
bors
de2320e461 Auto merge of #14965 - Veykril:panic-ctx, r=Veykril
Add mandatory panic contexts to all threadpool tasks

the diagnostics task is panicking I think, but without this you can't really tell because the stack trace ends in a generic iterator fold call instead of something specific.
2023-06-04 07:10:45 +00:00
Lukas Wirth
2d0510e226 Add mandatory panic contexts to all threadpool tasks 2023-06-04 09:09:25 +02:00
bors
9eee230cd0 Auto merge of #112240 - cjgillot:recurse-inline, r=scottmcm
Only check inlining counter after recursing.

This PR aims to reduce the strength of https://github.com/rust-lang/rust/pull/105119 even more.

In the current implementation, we check the inline count before recursing. This means that we never actually reach inlining depth 3.

This PR checks the counter after recursion, to give a chance to inline at depth >= 3.

r? `@scottmcm`
cc `@JakobDegen`
2023-06-04 03:39:24 +00:00
bors
d8095acb5f Auto merge of #112259 - weihanglo:update-cargo, r=weihanglo
Update cargo

14 commits in f7b95e31642e09c2b6eabb18ed75007dda6677a0..b0fa79679e717cd077b7fc0fa4166f47107f1ba9
2023-05-30 19:25:02 +0000 to 2023-06-03 14:19:48 +0000
- Emit error when users try to use a toolchain via the `add` or `install` command (rust-lang/cargo#12226)
- Support "default" option for `build.jobs` (rust-lang/cargo#12222)
- Fix typo in changelog (rust-lang/cargo#12227)
- chore: Sort `-Z` flags match statement (rust-lang/cargo#12223)
- Update curl-sys (rust-lang/cargo#12218)
- Bump to 0.73.0; update changelog (rust-lang/cargo#12219)
- refactor: housekeeping for 1.70.0 (rust-lang/cargo#12217)
- nit: fix typo in changelog for 1.70 (rust-lang/cargo#12215)
- Remove a noop `.clone` (rust-lang/cargo#12213)
- refactor: compiler invocations (rust-lang/cargo#12211)
- cargo clean: use `remove_dir_all` (rust-lang/cargo#11442)
- Add a small note about indexes ignoring SemVer build metadata. (rust-lang/cargo#12206)
- Revert "chore: detect the channel a PR wants to merge into" (rust-lang/cargo#12204)
- Don't distinguish `Debuginfo::None` and `Debuginfo::Explicit(None)` (rust-lang/cargo#12205)

r? `@ghost`
2023-06-04 00:47:08 +00:00
bors
4e4f0417aa Auto merge of #112244 - RalfJung:miri, r=oli-obk
update Miri

Also adjust Miri's compiletest a little: in pre-subtree days we added `-A unused -Astable-features` to have the Miri toolstate break less often. But nowadays it just causes confusion when Miri CI works in rustc but fails on the Miri side so let's get rid of this difference.

r? `@oli-obk`
2023-06-03 21:57:24 +00:00
Weihang Lo
5839b028d5
Update cargo 2023-06-03 22:48:30 +01:00