Commit Graph

226472 Commits

Author SHA1 Message Date
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
Thom Chiovoloni
9e5573a0d2
Use 128 bits for TypeId hash
- Switch TypeId to 128 bits
- Hack around the fact that tracing-subscriber dislikes how TypeId is hashed
- Remove lowering of type_id128 from rustc_codegen_llvm
- Remove unnecessary `type_id128` intrinsic (just change return type of `type_id`)
- Only hash the lower 64 bits of the TypeId
- Reword comment
2023-06-04 08:34:48 -07: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
Victor Gil
1f5361b40c Added custom risc32-imac for esp-espidf target 2023-06-04 15:49:04 +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
bors
4fb1df6b7a Auto merge of #14961 - HKalbasi:mir-fix, r=HKalbasi
Fix drop scopes problems in mir

Fix false positives of `need-mut` emerged from #14955

There are still 5 `need-mut` false positives on self, all related to `izip!` macro hygenic issue. I will try to do something about that before monday release.
2023-06-03 21:40:09 +00:00
hkalbasi
08f89193b5 Fix drop scopes in mir 2023-06-04 01:03:32 +03:30
Rémy Rakic
4117b5e65b improve target selection conditions 2023-06-03 19:50:45 +00:00
bors
398fa2187c Auto merge of #112253 - matthiaskrgr:rollup-c37jpm5, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #111659 (suggest `Option::as_deref(_mut)` on type mismatch in option combinator if it passes typeck)
 - #111702 (Option::map_or_else: Show an example of integrating with Result)
 - #111878 (Fix codegen test suite for bare-metal-like targets)
 - #111969 (bootstrap: Make `clean` respect `dry-run`)
 - #111998 (Add other workspaces to `linkedProjects` in rust_analyzer_settings)
 - #112215 (only suppress coercion error if type is definitely unsized)
 - #112231 (Make sure the build.rustc version is either the same or 1 apart (revised))

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-03 19:18:43 +00:00
Matthias Krüger
d4f87d1e4f
Rollup merge of #112231 - chenyukang:yukang-fix-110067-version-issue, r=jyn514
Make sure the build.rustc version is either the same or 1 apart (revised)

https://github.com/rust-lang/rust/pull/111538 is reverted in https://github.com/rust-lang/rust/pull/112023.

This PR will only check `build.rustc` to confirm the correct version.
2023-06-03 20:38:13 +02:00
Matthias Krüger
20cbbbb977
Rollup merge of #112215 - compiler-errors:check-sized-better, r=cjgillot
only suppress coercion error if type is definitely unsized

we previously suppressed coercion errors when the return type was `dyn Trait` because we expect a far more descriptive `Sized` trait error to be emitted instead, however the code that does this suppression does not consider where-clause predicates since it just looked at the HIR. let's do that instead by creating an obligation and checking if it may hold.

fixes #110683
fixes #112208
2023-06-03 20:38:12 +02:00
Matthias Krüger
ea8b4ff2a6
Rollup merge of #111998 - jyn514:ra-dogfooding, r=Mark-Simulacrum
Add other workspaces to `linkedProjects` in rust_analyzer_settings

This makes go-to-definition, etc. work in cg_clif, cg_gcc, rust-analyzer, and src/tools/x.
2023-06-03 20:38:12 +02:00
Matthias Krüger
95b909a119
Rollup merge of #111969 - clubby789:clean-dry-run, r=Mark-Simulacrum
bootstrap: Make `clean` respect `dry-run`

I noticed `clean_default` was getting run twice as the `DryRun::SelfCheck` flag is ignored
2023-06-03 20:38:11 +02:00
Matthias Krüger
bdf9ed497a
Rollup merge of #111878 - ferrocene:pa-codegen-tests, r=Mark-Simulacrum
Fix codegen test suite for bare-metal-like targets

For Ferrocene I needed to run the test suite for custom target with no unwinding and static relocation. Running the tests uncovered ~20 failures due to the test suite not accounting for these options. This PR fixes them by:

* Fixing `CHECK`s to account for functions having extra LLVM IR attributes (in this case `nounwind`).
* Fixing `CHECK`s to account for the `dso_local` LLVM IR modifier, which is [added to every item when relocation is static](f3d597b31c/compiler/rustc_codegen_llvm/src/mono_item.rs (L139-L142)).
* Fixing `CHECK`s to account for missing `uwtables` attributes.
* Added the `needs-unwind` attributes for tests that are designed to check unwinding.

There is no part of Rust CI that checks this unfortunately, and testing whether the PR works locally is kinda hard because you need a target with std enabled but no unwinding and static relocations. Still, this works in my local testing, and if future PRs accidentally break this Ferrocene will take care of sending followup PRs.
2023-06-03 20:38:11 +02:00
Matthias Krüger
6e024ecab8
Rollup merge of #111702 - cgwalters:option-map-or-else-with-result, r=Mark-Simulacrum
Option::map_or_else: Show an example of integrating with Result

Moving this from https://github.com/rust-lang/libs-team/issues/59 where an API addition was rejected.  But I think it's valuable to add this example to the documentation at least.
2023-06-03 20:38:11 +02:00
Matthias Krüger
91f222f931
Rollup merge of #111659 - y21:suggest-as-deref, r=cjgillot
suggest `Option::as_deref(_mut)` on type mismatch in option combinator if it passes typeck

Fixes #106342.
This adds a suggestion to call `.as_deref()` (or `.as_deref_mut()` resp.) if typeck fails due to a type mismatch in the function passed to an `Option` combinator such as `.map()` or `.and_then()`.
For example:
```rs
fn foo(_: &str) {}
Some(String::new()).map(foo);
```
The `.map()` method requires its argument to satisfy `F: FnOnce(String)`, but it received `fn(&str)`, which won't pass. However, placing a `.as_deref()` before the `.map()` call fixes this since `&str == &<String as Deref>::Target`
2023-06-03 20:38:10 +02:00