Commit graph

250709 commits

Author SHA1 Message Date
Michael Goulet 5fdc7555c1 Require DerefMut if deref pattern has nested ref mut binding 2024-03-25 19:39:45 -04:00
Michael Goulet b56279569b Require DerefPure for patterns 2024-03-25 19:39:45 -04:00
Nadrieril d1d9aa3108 Consistently merge simplifiable or-patterns 2024-03-25 23:52:17 +01:00
Matthew Maurer 70e1d23895 CFI: Pad out associated type resolution with erased lifetimes
`trait_object_ty` assumed that associated types would be fully
determined by the trait. This is *almost* true - const parameters and
type parameters are no longer allowed, but lifetime parameters are.
Since we erase all lifetime parameters anyways, instantiate it with as
many erased regions as it needs.

Fixes: #123053
2024-03-25 22:46:21 +00:00
Nadrieril 08d7379961 Use the correct span for simplifying or-patterns
We have to make sure we set it everywhere that we set `subcandidates`.
2024-03-25 23:46:18 +01:00
Jubilee 56e8f67c87
Rollup merge of #123051 - matthiaskrgr:casetest, r=workingjubilee
did I mention that tests are super cool?

Fixes https://github.com/rust-lang/rust/issues/81974
Fixes https://github.com/rust-lang/rust/issues/84727
Fixes https://github.com/rust-lang/rust/issues/92979
2024-03-25 14:35:38 -07:00
Jubilee 77de550c61
Rollup merge of #123044 - compiler-errors:instance, r=oli-obk
`Instance` is `Copy`

No reason to take it by value; it was confusing ``@rcvalle`` to see it being mutated when it's also being passed by ref in some places.
2024-03-25 14:35:37 -07:00
Jubilee ac0a9c58e8
Rollup merge of #123042 - dpaoliello:prelude, r=Nilstrieb
Import the 2021 prelude in the core crate

The `core` crate currently imports the v1 prelude
b3df0d7e5e/library/core/src/lib.rs (L285-L287)

This recently caused an issue when updating the `portable-simd` subtree since it was using a trait that was added to the 2021 prelude: https://github.com/rust-lang/rust/pull/122905#discussion_r1536228822

To make it easier to have a consistent build environment for subtrees and submodules that get included in `core`, we will now import the 2021 prelude into `core`.

Fixes #122912

r? `@Nilstrieb`
2024-03-25 14:35:37 -07:00
Jubilee 2b13f944fb
Rollup merge of #123039 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/edition-guide

1 commits in e1eead1181a691e56299294d5f1d62fe7a26d317..98b33e9a441457b0a491fe1be90e7de64eafc3e5
2024-03-23 14:17:26 UTC to 2024-03-23 14:17:26 UTC

- remove indication that C string literals don't exist yet (rust-lang/edition-guide#295)

## rust-lang/reference

4 commits in 5afb503a4c1ea3c84370f8f4c08a1cddd1cdf6ad..984b36eca4b9293df04d5ba4eb5c4f77db0f51dc
2024-03-25 14:05:19 UTC to 2024-03-19 20:01:14 UTC

- Fix typo of shebang (rust-lang/reference#1486)
- Document importing `main` (rust-lang/reference#1461)
- add grammar for `associated_type_bounds` in reference (rust-lang/reference#1481)
- Literal expressions: fix mistake in the definition of unicode escapes (rust-lang/reference#1483)

## rust-lang/rust-by-example

1 commits in e093099709456e6fd74fecd2505fdf49a2471c10..7601e0c5ad29d5bd3b518700ea63fddfff5915a7
2024-03-17 21:37:25 UTC to 2024-03-17 21:37:25 UTC

- Update enum_use.md to use a more neutral theme (rust-lang/rust-by-example#1828)

## rust-lang/rustc-dev-guide

12 commits in 8a5d647f19b08998612146b1cb2ca47083db63e0..ffa246b7fd95a96e1cd54883e613aed42c32547d
2024-03-23 07:44:42 UTC to 2024-03-11 18:17:28 UTC

- [MCP 723] Rename AstConv to HIR ty lowering (rust-lang/rustc-dev-guide#1916)
- add chapter to summary (rust-lang/rustc-dev-guide#1947)
- document difference between solvers + new solver normalization (rust-lang/rustc-dev-guide#1945)
- Fix broken link in chapter '1. How to build and run the compiler' (rust-lang/rustc-dev-guide#1946)
- typo (rust-lang/rustc-dev-guide#1944)
- Reflect rustc_codegen_cranelift move (rust-lang/rustc-dev-guide#1941)
- Update rustdoc-internals.md (rust-lang/rustc-dev-guide#1911)
- Update test-implementation.md (rust-lang/rustc-dev-guide#1937)
- Extract Bootstrap into its own section (rust-lang/rustc-dev-guide#1939)
- typos (rust-lang/rustc-dev-guide#1938)
- More updates for recent diagnostics changes. (rust-lang/rustc-dev-guide#1936)
- Update bibliography.md (rust-lang/rustc-dev-guide#1912)
2024-03-25 14:35:36 -07:00
Jubilee 4856f9a42f
Rollup merge of #122950 - ShoyuVanilla:issue-101903, r=compiler-errors
Add regression tests for #101903

Closes #101903

See https://doc.rust-lang.org/1.77.0/nightly-rustc/rustc_lint/opaque_hidden_inferred_bound/static.OPAQUE_HIDDEN_INFERRED_BOUND.html#example
2024-03-25 14:35:36 -07:00
Jubilee 9775296796
Rollup merge of #122923 - kpreid:print-async-def, r=compiler-errors
In `pretty_print_type()`, print `async fn` futures' paths instead of spans.

This makes `-Zprint-type-sizes`'s output easier to read, because the name of an `async fn` is more immediately recognizable than its span. This change will also synergize with my other `-Zprint-type-sizes` PR #122922 which prints the type of child futures being awaited.

I also deleted the comment "FIXME(eddyb) should use `def_span`." because it appears to have already been fixed by commit 67727aa7c3.
2024-03-25 14:35:35 -07:00
Jubilee cf9acea658
Rollup merge of #122896 - dpaoliello:stdarch, r=Amanieu
Update stdarch submodule

r? ```@Amanieu```
2024-03-25 14:35:35 -07:00
Jubilee 01263c45d0
Rollup merge of #122892 - lovesegfault:versioned-vendor, r=onur-ozkan
fix(bootstrap/dist): use versioned dirs when vendoring

Currently, if you attempt to run ui tests in a vendored build, you will
see this failure

```
---- [ui] tests/ui/issues/issue-21763.rs stdout ----
diff of stderr:

8          = note: required because it appears within the type `(Rc<()>, Rc<()>)`
9          = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send`
10      note: required because it appears within the type `hashbrown::map::HashMap<Rc<()>, Rc<()>, RandomState>`
-         --> $HASHBROWN_SRC_LOCATION
+         --> /rust/deps/hashbrown/src/map.rs:190:12
12      note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>`
13        --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
14      note: required by a bound in `foo`
```

This happens because the code that attempts to remap
`HASHBROWN_SRC_LOCATION` expects it to be under `hashbrown-$version`,
which is the case in a normal cargo registry, but not when vendoring, where
by default crates may not have the version in their directory name.

This change passes `--versioned-dirs` to `cargo vendor` to enforce that
every crate includes the version in the subdir name, which fixes the ui
test and brings `--enable-vendor` builds closer to normal ones.
2024-03-25 14:35:35 -07:00
Jubilee 2f8c9bd651
Rollup merge of #122769 - RalfJung:reachable, r=tmiasko
extend comments for reachability set computation

I hope this is right. :) Please review carefully.

r? ``@tmiasko``
Cc ``@oli-obk`` ``@saethlin``
2024-03-25 14:35:34 -07:00
Jubilee c35e971ef7
Rollup merge of #122707 - reedwoodruff:string_docs_typo, r=workingjubilee
Fix a typo in the alloc::string::String docs
2024-03-25 14:35:34 -07:00
bors 5f2c7d2bfd Auto merge of #123040 - weihanglo:update-cargo, r=weihanglo
Update cargo

13 commits in d438c80c45c24be676ef5867edc79d0a14910efe..a510712d05c6c98f987af24dd73cdfafee8922e6
2024-03-19 16:11:22 +0000 to 2024-03-25 03:45:54 +0000
- Remove unnecessary test (rust-lang/cargo#13637)
- Use `gitoxide` for `list_files_git` (rust-lang/cargo#13592)
- fix: Warn on -Zlints (rust-lang/cargo#13632)
- feat: Add a basic linting system (rust-lang/cargo#13621)
- docs: remove untrue TODO for `native_dirs` (rust-lang/cargo#13631)
- refactor(testsuite): Rename lints to lints_table (rust-lang/cargo#13627)
- Fix debuginfo strip when using `--target` (rust-lang/cargo#13618)
- refactor(toml): Push diagnostic complexity on annotate-snippets (rust-lang/cargo#13619)
- Fix publish script due to crates.io CDN change (rust-lang/cargo#13614)
- fix(alias): dont panic when resolving an empty alias (rust-lang/cargo#13613)
- Update annotate snippets (rust-lang/cargo#13609)
- refactor(vendor): tiny not important refactors (rust-lang/cargo#13610)
- feat: Report some dependency changes on any command (rust-lang/cargo#13561)

r? ghost
2024-03-25 21:21:21 +00:00
Daniel Paoliello d261647c93 Import the 2021 prelude in the core crate 2024-03-25 13:12:06 -07:00
Matthias Krüger a3c2d752bd add test for ICE: failed to get layout for [type error] #92979
Fixes https://github.com/rust-lang/rust/issues/92979
2024-03-25 20:35:51 +01:00
Matthias Krüger 6fe555549b add test for ICE Where clause Binder(..) was applicable to Obligation(..) but now is not
Fixes https://github.com/rust-lang/rust/issues/84727
2024-03-25 20:20:01 +01:00
Matthias Krüger 5f95fc1dff add test for Compiler panic using fn_traits #81974
Fixes https://github.com/rust-lang/rust/issues/81974
2024-03-25 20:15:28 +01:00
Ralf Jung d94f6576dd extend doc comment for reachability set computation
also extend the const fn reachability test
2024-03-25 19:57:57 +01:00
clubby789 b500693ad7 Don't emit load metadata in debug mode 2024-03-25 18:32:45 +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
Michael Goulet 99fbc6f8ef Instance is Copy 2024-03-25 13:58:40 -04:00
Weihang Lo 69c2a61e5b
Update cargo 2024-03-25 13:11:42 -04:00
rustbot 95f268efa6 Update books 2024-03-25 13:00:21 -04: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
Kevin Reid 3010fa9afb In pretty_print_type(), print async fn futures' paths instead of spans.
This makes `-Zprint-type-sizes`'s output easier to read, because the
name of an `async fn` is more immediately recognizable than its span.

I also deleted the comment "FIXME(eddyb) should use `def_span`." because
it appears to have already been fixed by commit 67727aa7c3.
2024-03-25 08:01:15 -07: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