Commit Graph

250616 Commits

Author SHA1 Message Date
Lukas Wirth
2fae4ee92e Make sysroot mandatory for rustdoc 2024-03-25 22:19:41 +00:00
Lukas Wirth
9ae4e3eb7c Make use of sysroot in librustdoc/config.rs for builtin:$path 2024-03-25 22:18:32 +00:00
Lukas Wirth
91547573af Implement -L builtin:$path 2024-03-25 22:18:31 +00:00
bors
35936c4839 Auto merge of #123041 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-03-25 18:20:03 +00:00
bors
cf1eb93a02 Auto merge of #3414 - RalfJung:rustup, r=RalfJung
Rustup

Fixes https://github.com/rust-lang/miri/issues/3404
2024-03-25 16:34:41 +00:00
Ralf Jung
0d4ef69d66 support '--sysroot=' form of setting the sysroot as well 2024-03-25 17:33:02 +01:00
Ralf Jung
d8be714fee Merge from rustc 2024-03-25 17:17:57 +01:00
Ralf Jung
5b1319c754 Preparing for merge from rustc 2024-03-25 17:17:55 +01:00
bors
60b5ca6275 Auto merge of #123036 - matthiaskrgr:rollup-dj8hra4, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #122842 (Don't emit an error about failing to produce a file with a specific name if user never gave an explicit name)
 - #122881 (Delegation: fix ICE on `bound_vars` divergence)
 - #122910 (Validate that we're only matching on unit struct for path pattern)
 - #122970 (Use `chunk_by` when building `ReverseSccGraph`)
 - #122988 (add even more tests! )
 - #122999 (Fix unpretty UI test when /tmp does not exist)
 - #123001 (Rename `{enter,exit}_lint_attrs` to `check_attributes{,_post}`)
 - #123022 (Add `async-closures/once.rs` back to cranelift tests)
 - #123034 (Add a bunch of needs-unwind annotations to tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-25 16:16:59 +00:00
Matthias Krüger
4369718980
Rollup merge of #123034 - bjorn3:test_ignores, r=compiler-errors
Add a bunch of needs-unwind annotations to tests

To filter out tests that fail with cg_clif due to missing panic=unwind support.
2024-03-25 17:05:36 +01:00
Matthias Krüger
11f168ffa2
Rollup merge of #123022 - compiler-errors:clif-tests-async-closure, r=bjorn3
Add `async-closures/once.rs` back to cranelift tests

This was fixed afaict by #120717

r? `@bjorn3`
2024-03-25 17:05:35 +01:00
Matthias Krüger
10daf8aa99
Rollup merge of #123001 - Alexendoo:check-attributes, r=oli-obk
Rename `{enter,exit}_lint_attrs` to `check_attributes{,_post}`

Several places in Clippy want to check all the attributes of a node, we end up using `hir().attrs()` from several different `check_` functions (e.g. [in our doc lints](95c62ffae9/clippy_lints/src/doc/mod.rs (L396))) but this is error prone, we recently found that doc lints weren't triggering on struct fields for example

I went to add a `check_attributes` function but realised `enter_lint_attrs` is already this, the rename is to encourage their use

Also removes `LateContextAndPass::visit_attribute` since it's unused - `visit_attribute` for HIR visitors is only called by `hir().walk_attributes()` which lint passes do not use
2024-03-25 17:05:35 +01:00
Matthias Krüger
657dd0b797
Rollup merge of #122999 - Alexendoo:unpretty-avoid-crash-test, r=petrochenkov
Fix unpretty UI test when /tmp does not exist

On Windows this test fails if e.g. `C:\tmp` is created successfully
2024-03-25 17:05:35 +01:00
Matthias Krüger
877f29363d
Rollup merge of #122988 - matthiaskrgr:icetests, r=petrochenkov
add even more tests!

Fixes https://github.com/rust-lang/rust/issues/109869
Fixes https://github.com/rust-lang/rust/issues/110453
Fixes https://github.com/rust-lang/rust/issues/109020
Fixes https://github.com/rust-lang/rust/issues/108580
Fixes https://github.com/rust-lang/rust/issues/108220
Fixes https://github.com/rust-lang/rust/issues/113045
Fixes https://github.com/rust-lang/rust/issues/113133
Fixes https://github.com/rust-lang/rust/issues/114464
Fixes https://github.com/rust-lang/rust/issues/116599
Fixes https://github.com/rust-lang/rust/issues/119731
2024-03-25 17:05:34 +01:00
Matthias Krüger
9b4ee1be9e
Rollup merge of #122970 - cuviper:use-chunk_by, r=Mark-Simulacrum
Use `chunk_by` when building `ReverseSccGraph`

With stable `chunk_by` in Rust 1.77, this code doesn't need `Itertools::group_by` anymore.
2024-03-25 17:05:33 +01:00
Matthias Krüger
e9ec44251c
Rollup merge of #122910 - compiler-errors:unit-struct-in-path-pat-only, r=petrochenkov
Validate that we're only matching on unit struct for path pattern

Resolution doesn't validate that we only really take `CtorKind::Unit` in path patterns, since all it sees is `Res::SelfCtor(def_id)`. Check this instead during pattern typeck.

r? petrochenkov

Fixes #122809
2024-03-25 17:05:33 +01:00
Matthias Krüger
ccc5310922
Rollup merge of #122881 - Bryanskiy:delegation-fixes-2, r=petrochenkov
Delegation: fix ICE on `bound_vars` divergence

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

Bug was caused by divergence  between lowered type and corresponding `bound_vars` in `late_bound_vars_map`. In this patch `bound_vars` calculation for delegation item is moved from `lower_fn_ty` to `resolve_bound_vars` query.

r? `@petrochenkov`
2024-03-25 17:05:32 +01:00
Matthias Krüger
ded16b3a97
Rollup merge of #122842 - pacak:explicit_name, r=michaelwoerister
Don't emit an error about failing to produce a file with a specific name if user never gave an explicit name

Fixes #122509

You can ask `rustc` to produce some intermediate results with `--emit foo`, this operation comes in two flavors: `--emit asm` and `--emit asm=foo.s`. First one produces one or more `.s` files without any name guarantees, second one renames it into `foo.s`. Second version only works when compiler produces a single file - for asm files this means using a single compilation unit for example.

In case compilation produced more than a single file `rustc` runs following check to emit some warnings:

```rust
            if crate_output.outputs.contains_key(&output_type) {
                // 2) Multiple codegen units, with `--emit foo=some_name`. We have
                //    no good solution for this case, so warn the user.
                sess.dcx().emit_warn(errors::IgnoringEmitPath { extension });
            } else if crate_output.single_output_file.is_some() {
                // 3) Multiple codegen units, with `-o some_name`. We have
                //    no good solution for this case, so warn the user.
                sess.dcx().emit_warn(errors::IgnoringOutput { extension });
            } else {
                // 4) Multiple codegen units, but no explicit name. We
                //    just leave the `foo.0.x` files in place.
                // (We don't have to do any work in this case.)
            }
```

Comment in the final `else` branch implies that if user didn't ask for a specific name - there's no need to emit warnings. However because of the internal representation of `crate_output.outputs` - this doesn't work as expected: if user asked to produce an asm file without giving it an implicit name it will contain `Some(None)`.

To fix the problem new code actually checks if user gave an explicit name. I think this was an original intentional behavior, at least comments imply that.
2024-03-25 17:05:32 +01:00
bjorn3
5f5dcaefe6 Add needs-unwind for proc macro tests
Rustc gives a warning when compiling proc macros with panic=abort.
2024-03-25 15:02:55 +00:00
bjorn3
3733dcc72d Add needs-unwind annotations to a couple of tests 2024-03-25 14:19:07 +00:00
bors
cb7c63606e Auto merge of #123030 - GuillaumeGomez:rustdoc-sysroot-out-of-arg-file, r=notriddle
Move `--sysroot` argument out of the argument file to fix miri issue

Fixes https://github.com/rust-lang/miri/issues/3404.

For now, miri needs this argument to be moved out of the arg file so they can update it if needed.

cc `@RalfJung`

r? `@notriddle`
2024-03-25 14:09:33 +00:00
bors
c4611708bd Auto merge of #3413 - RalfJung:cargo-miri-misc, r=RalfJung
phase_rustdoc: add a heuristic to make us more certain that this is really rustdoc

Also add anyhow to test-cargo-miri; it has a custom build probe and is widely used so let's make sure the build script does not fail.
2024-03-25 13:51:23 +00:00
Ralf Jung
98e1cbbc02 phase_rustdoc: add a heuristic to make us more certain that this is really rustdoc 2024-03-25 14:40:32 +01:00
Ralf Jung
8afc4862d0 test-cargo-miri: test anyhow 2024-03-25 14:23:42 +01:00
bors
cf172a8ebd Auto merge of #3410 - RalfJung:all-targets, r=RalfJung
CONTRIBUTING: vsocde settings: add --all-targets

Seems like when setting a custom command, one needs to pass this flag manually, it's no longer automatically added by RA.
2024-03-25 12:55:08 +00:00
bors
af98101ed8 Auto merge of #123029 - matthiaskrgr:rollup-6qsevhx, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #122858 (Tweak `parse_dot_suffix_expr`)
 - #122982 (Add more comments to the bootstrap code that handles `tests/coverage`)
 - #122990 (Clarify transmute example)
 - #122995 (Clean up unnecessary headers/flags in coverage mir-opt tests)
 - #123003 (CFI: Handle dyn with no principal)
 - #123005 (CFI: Support complex receivers)
 - #123020 (Temporarily remove nnethercote from the review rotation.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-25 12:00:21 +00:00
Guillaume Gomez
8c219af8bf Move --sysroot argument out of the argument file to fix miri issue 2024-03-25 12:06:47 +01:00
Ralf Jung
89a32d7b5f CONTRIBUTING: vsocde settings: add --all-targets 2024-03-25 11:21:01 +01:00
Matthias Krüger
ab8084a3f7
Rollup merge of #123020 - nnethercote:rm-nnethercote-review, r=nnethercote
Temporarily remove nnethercote from the review rotation.

I will be on vacation for the next three weeks. I will re-add myself when I return.

r? `@nnethercote`
2024-03-25 11:00:15 +01:00
Matthias Krüger
fe0222be07
Rollup merge of #123005 - maurer:cfi-arbitrary-receivers, r=compiler-errors
CFI: Support complex receivers

Right now, we only support rewriting `&self` and `&mut self` into `&dyn MyTrait` and `&mut dyn MyTrait`. This expands it to handle the full gamut of receivers by calculating the receiver based on *substitution* rather than based on a rewrite. This means that, for example, `Arc<Self>` will become `Arc<dyn MyTrait>` appropriately with this change.

This approach also allows us to support associated type constraints as well, so we will correctly rewrite `&self` into `&dyn MyTrait<T=i32>`, for example.

r? ```@workingjubilee```
2024-03-25 11:00:14 +01:00
Matthias Krüger
84ec66e15b
Rollup merge of #123003 - maurer:dyn-empty, r=compiler-errors
CFI: Handle dyn with no principal

In user-facing Rust, `dyn` always has at least one predicate following it. Unfortunately, because we filter out marker traits from receivers at callsites and `dyn Sync` is, for example, legal, this results in us having `dyn` types with no predicates on occasion in our alias set encoding. This patch handles cases where there are no predicates in a `dyn` type which are relevant to its alias set.

Fixes #122998

r? workingjubilee
2024-03-25 11:00:14 +01:00
Matthias Krüger
d1fca06662
Rollup merge of #122995 - Zalathar:flags-mir-opt, r=Mark-Simulacrum
Clean up unnecessary headers/flags in coverage mir-opt tests

During #122542, I noticed that some of the headers and flags I had copied over from `tests/mir-opt/instrument_coverage.rs`  were unnecessary. And while working to remove those, I noticed even more that could be removed or replaced.
2024-03-25 11:00:13 +01:00
Matthias Krüger
e3fbaa87c9
Rollup merge of #122990 - SkiFire13:transmute-may-copy, r=jhpratt
Clarify transmute example

The example claims using an iterator will copy the entire vector, but this is not true in practice thanks to internal specializations in the stdlib (see https://godbolt.org/z/cnxo3MYs5 for confirmation that this doesn't reallocate nor iterate over the vec's elements). Since neither the copy nor the optimization is guaranteed I opted for saying that they _may_ happen.
2024-03-25 11:00:13 +01:00
Matthias Krüger
fbb81fa89c
Rollup merge of #122982 - Zalathar:bootstrap-coverage-docs, r=onur-ozkan
Add more comments to the bootstrap code that handles `tests/coverage`

At the bootstrap level, coverage tests are a bit more complicated than other test suites, because we want to run the same set of test files in multiple different modes, in a way that's convenient and flexible when invoked manually.

This PR adds a few more comments to explain what's going on.
2024-03-25 11:00:12 +01:00
Matthias Krüger
4cae68b0cf
Rollup merge of #122858 - nnethercote:tweak-parse_dot_suffix_expr, r=est31
Tweak `parse_dot_suffix_expr`

I find this function hard to understand, so I rewrote it.

r? ```@est31```
2024-03-25 11:00:12 +01:00
bors
dda2372cf3 Auto merge of #122802 - estebank:unconstrained-generic-const, r=Nadrieril
Provide structured suggestion for unconstrained generic constant

```
error: unconstrained generic constant
  --> $DIR/const-argument-if-length.rs:18:10
   |
LL |     pad: [u8; is_zst::<T>()],
   |          ^^^^^^^^^^^^^^^^^^^
   |
help: try adding a `where` bound
   |
LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: {
   |                                   ++++++++++++++++++++++++++
```

Detect when the constant expression isn't `usize` and suggest casting:

```
error: unconstrained generic constant
 --> f300.rs:6:10
  |
6 |     bb::<{!N}>();
  |          ^^^^
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36
  |
help: try adding a `where` bound
  |
5 | fn b<const N: bool>() where [(); {!N} as usize]: {
  |                       ++++++++++++++++++++++++++
```

Fix #122395.
2024-03-25 09:59:37 +00:00
bors
42198bf562 Auto merge of #122968 - rust-lang:cargo_update, r=Mark-Simulacrum
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt
    Updating aho-corasick v1.1.2 -> v1.1.3
    Updating backtrace v0.3.69 -> v0.3.71
    Updating bitflags v2.4.2 -> v2.5.0
    Updating bytes v1.5.0 -> v1.6.0
    Updating cargo-platform v0.1.7 -> v0.1.8
    Updating fastrand v2.0.1 -> v2.0.2
    Updating indexmap v2.2.5 -> v2.2.6
    Updating libz-sys v1.1.15 -> v1.1.16
    Updating rayon v1.9.0 -> v1.10.0
    Updating reqwest v0.11.26 -> v0.11.27 (latest: v0.12.1)
    Updating rustix v0.38.31 -> v0.38.32
    Updating smallvec v1.13.1 -> v1.13.2
    Updating syn v2.0.53 -> v2.0.55
    Updating uuid v1.7.0 -> v1.8.0
note: pass `--verbose` to see 87 unchanged dependencies behind latest
```
2024-03-25 06:39:44 +00:00
bors
fa374a8071 Auto merge of #122951 - Nilstrieb:nodejs20, r=Kobzol
Update upload-artifact to v4

This contains a breaking change around artifact merging no longer being done. This was not relied on, so it's fine.
2024-03-25 04:39:30 +00:00
Zalathar
1bbab7148b Add more comments to the bootstrap code that handles tests/coverage 2024-03-25 15:31:33 +11:00
Nicholas Nethercote
dce0f7f5c2 Clarify parse_dot_suffix_expr.
For the `MiddleDot` case, current behaviour:
- For a case like `1.2`, `sym1` is `1` and `sym2` is `2`, and `self.token`
  holds `1.2`.
- It creates a new ident token from `sym1` that it puts into `self.token`.
- Then it does `bump_with` with a new dot token, which moves the `sym1`
  token into `prev_token`.
- Then it does `bump_with` with a new ident token from `sym2`, which moves the
  `dot` token into `prev_token` and discards the `sym1` token.
- Then it does `bump`, which puts whatever is next into `self.token`,
  moves the `sym2` token into `prev_token`, and discards the `dot` token
  altogether.

New behaviour:
- Skips creating and inserting the `sym1` and dot tokens, because they are
  unnecessary.
- This also demonstrates that the comment about `Spacing::Alone` is
  wrong -- that value is never used. That comment was added in #77250,
  and AFAICT it has always been incorrect.

The commit also expands comments. I found this code hard to read
previously, the examples in comments make it easier.
2024-03-25 13:08:07 +11:00
Nicholas Nethercote
9c091160dc Change parse_expr_tuple_field_access.
Pass in the span for the field rather than using `prev_token`.
Also rename it `mk_expr_tuple_field_access`, because it doesn't do any
actual parsing, it just creates an expression with what it's given.

Not much of a clarity win by itself, but unlocks additional subsequent
simplifications.
2024-03-25 13:05:59 +11:00
Nicholas Nethercote
90eeb3d681 Remove next_token handling from parse_expr_tuple_field_access.
It's clearer at the call site.
2024-03-25 13:05:59 +11:00
Nicholas Nethercote
42066b029f Inline and remove Parser::parse_expr_tuple_field_access_float.
It has a single call site, and afterwards all the calls to
`parse_expr_tuple_field_access` are in a single method, which is nice.
2024-03-25 13:05:59 +11:00
Michael Goulet
e6918b1e5d Add async-closures/once.rs back to cranelift tests 2024-03-24 21:42:32 -04:00
bors
13dac8fb73 Auto merge of #122721 - oli-obk:merge_queries, r=davidtwco
Replace `mir_built` query with a hook and use mir_const everywhere instead

A small perf improvement due to less dep graph handling.

Mostly just a cleanup to get rid of one of our many mir queries
2024-03-25 01:33:46 +00:00
Nicholas Nethercote
50b49aec36 Temporarily remove nnethercote from the review rotation.
I will be on vacation for the next three weeks. I will re-add myself
when I return.
2024-03-25 10:36:55 +11:00
Matthew Maurer
40f41e7e89 CFI: Support arbitrary receivers
Previously, we only rewrote `&self` and `&mut self` receivers. By
instantiating the method from the trait definition, we can make this
work work with arbitrary legal receivers instead.
2024-03-24 22:46:48 +00:00
bors
0824b300eb Auto merge of #122658 - cuviper:gccjit-archive, r=Mark-Simulacrum
ci: Build gccjit from a git archive

A full `git clone` of GCC includes quite a lot of history, and it's
completely unnecessary for building it in CI. We can use a GitHub
archive URL to get a simple tarball that is much faster to download.

Also, the `gcc-build` directory can be removed after install to reduce
the image size even further.
2024-03-24 18:15:27 +00:00
Matthew Maurer
ea4518522f CFI: Handle dyn with no principal
In user-facing Rust, `dyn` always has at least one predicate following
it. Unfortunately, because we filter out marker traits from receivers at
callsites and `dyn Sync` is, for example, legal, this results in us
having `dyn` types with no predicates on occasion in our alias set
encoding. This patch handles cases where there are no predicates in a
`dyn` type which are relevant to its alias set.

Fixes #122998
2024-03-24 16:58:33 +00:00
bors
d36bdd19f2 Auto merge of #123004 - matthiaskrgr:rollup-s3v4p50, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #122737 (conditionally ignore fatal diagnostic in the SilentEmitter)
 - #122757 (Fixed the `private-dependency` bug)
 - #122886 (add test for #90192)
 - #122937 (Unbox and unwrap the contents of `StatementKind::Coverage`)
 - #122949 (Add a regression test for #117310)
 - #122962 (Track run-make-support lib in common inputs stamp)
 - #122977 (Rename `Arguments::as_const_str` to `as_statically_known_str`)
 - #122983 (Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSD)
 - #122984 (panic-in-panic-hook: formatting a message that's just a string is risk-free)
 - #122992 (std:🧵 refine available_parallelism for solaris/illumos.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-24 16:09:51 +00:00