Commit graph

221501 commits

Author SHA1 Message Date
Michael Goulet 24cbf81b85 Remove .. from return type notation 2023-04-10 22:19:46 +00:00
bors 2a198c7f62 Auto merge of #110078 - fee1-dead-contrib:bump-serde, r=Mark-Simulacrum
Bump serde to use syn 2.0

cc #109302
2023-04-10 11:53:26 +00:00
bors d4be8efc62 Auto merge of #110137 - Dylan-DPC:rollup-fdruvwp, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #109724 (prioritize param env candidates if they don't guide type inference)
 - #110021 (Fix a couple ICEs in the new `CastKind::Transmute` code)
 - #110044 (Avoid some manual slice length calculation)
 - #110115 (compiletest: Use remap-path-prefix only in CI)
 - #110121 (Fix `x check --stage 1` when download-rustc is enabled)
 - #110124 (Some clippy fixes in the compiler)

Failed merges:

 - #109752 (Stall auto trait assembly in new solver for int/float vars)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-10 09:07:02 +00:00
Dylan DPC 97921abc06
Rollup merge of #110124 - Nilstrieb:📎-told-me-so, r=compiler-errors
Some clippy fixes in the compiler

Best reviewed commit-by-commit 📎.
2023-04-10 14:13:16 +05:30
Dylan DPC 6f2fd3e6a2
Rollup merge of #110121 - jyn514:check-stage1, r=ozkanonur
Fix `x check --stage 1` when download-rustc is enabled

Helps with https://github.com/rust-lang/rust/issues/81930
2023-04-10 14:13:15 +05:30
Dylan DPC e327487bd8
Rollup merge of #110115 - jyn514:remap-path-prefix-ci, r=compiler-errors
compiletest: Use remap-path-prefix only in CI

This makes jump-to-definition work in most IDEs, as well as being easier to understand for contributors.

Fixes https://github.com/rust-lang/rust/issues/109725. cc `@TimNN`
2023-04-10 14:13:15 +05:30
Dylan DPC b6633ffaf7
Rollup merge of #110044 - scottmcm:more-size-of-val, r=ChrisDenton
Avoid some manual slice length calculation

No need for us to write the multiplication when `size_of_val` does exactly what we need.

(https://github.com/rust-lang/rust-clippy/pull/10601)
2023-04-10 14:13:14 +05:30
Dylan DPC b8725520af
Rollup merge of #110021 - scottmcm:fix-110005, r=compiler-errors
Fix a couple ICEs in the new `CastKind::Transmute` code

Check the sizes of the immediates, rather than the overall types, when deciding whether we can convert types without going through memory.

Fixes #110005
Fixes #109992
Fixes #110032
cc `@matthiaskrgr`
2023-04-10 14:13:14 +05:30
Dylan DPC c30d7e97a8
Rollup merge of #109724 - lcnr:prioritize-env, r=compiler-errors
prioritize param env candidates if they don't guide type inference

intended to supersede #109579. We disable the prioritization during coherence to maintain completeness.

Long term we can hopefully replace this hack with adding OR to external constraints at which point the only relevant part when merging responses is whether they guide type inference in the same way.

Reuses `try_merge_responses` for assembly and the cleanest way to impl that was to actually split that so that `try_merge_responses` returns `None` if we fail to merge them and then add `flounder` which is used afterwards which is allowed to lower the certainty of our responses.

If, in the future, we add the ability to merge candidates `YES: ?0 = Vec<u32>` and `YES: ?0 = Vec<i32>` to `AMBIG: ?0 = Vec<?1>`, this should happen in `flounder`.

r? `@compiler-errors` `@BoxyUwU`
2023-04-10 14:13:13 +05:30
lcnr 3fab7f7c13 review + some small stuff 2023-04-10 09:21:21 +02:00
lcnr 2186847f28 move structural_traits into assembly 2023-04-10 09:18:47 +02:00
lcnr 2b0f5721c1 prioritize param-env candidates 2023-04-10 09:16:33 +02:00
bors 7f7e8fbc99 Auto merge of #110008 - klensy:deps-up-apr-06, r=Mark-Simulacrum
bump few deps

Update few deps to fix security vulns, future incompatibilities, duplicates.

`jemalloc-sys` v0.5.0+5.3.0 -> v0.5.3+5.3.0-patched: fixes future-incompatibilities by dropping fs_extra (https://github.com/rust-lang-ci/rust/actions/runs/4626595610/jobs/8183514150#step:26:19499, https://github.com/tikv/jemallocator/blob/tikv-jemalloc-sys-0.5.3/CHANGELOG.md)

`openssl-src` v111.22.0+1.1.1q -> v111.25.0+1.1.1t: fixes few vulns:
https://www.openssl.org/news/vulnerabilities-1.1.1.html
https://www.cve.org/CVERecord?id=CVE-2022-4304
https://www.cve.org/CVERecord?id=CVE-2022-4450
https://www.cve.org/CVERecord?id=CVE-2023-0215
https://www.cve.org/CVERecord?id=CVE-2023-0286
There exist newer openssl version 1.1.1u with low severity vulns, but no crate update yet

`openssl` crate with deps 0.10.38 ->0.10.49 fixes vulns (https://github.com/sfackler/rust-openssl/blob/openssl-v0.10.49/openssl/CHANGELOG.md)
https://rustsec.org/advisories/RUSTSEC-2023-0022
https://rustsec.org/advisories/RUSTSEC-2023-0023
https://rustsec.org/advisories/RUSTSEC-2023-0024

update `env_logger` for `rustbook` and `cargo_metadata` for `tidy` to newer versions (still used by `rustfmt`, `miri`)
2023-04-10 06:53:15 +00:00
bors 749b487be4 Auto merge of #109880 - ehuss:fix-macos-installer-rust-docs, r=Mark-Simulacrum
Fix macOS and Windows installers when rust-docs is not available.

This fixes the macOS `.pkg` and Windows `.msi` installers to work when rust-docs is not available. If the rust-docs component is not built, then the installer would fail. This adds the rust-docs component to the filtering mechanism so that the rust-docs line of the distribution definition aren't included.

I tested installing and uninstalling both with and without the rust-docs component available.

This happens on the aarch64-apple-darwin distribution provided by rust-lang since we currently disable the rust-docs component due to long build times. An alternate solution would be to just enable the rust-docs component on aarch64-apple-darwin since there are faster build systems.

Fixes #109877
2023-04-10 04:36:38 +00:00
bors 3c2e2dd5c5 Auto merge of #110127 - matthiaskrgr:rollup-6ui12x5, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #108843 (Instantiate instead of erasing binder when probing param methods)
 - #109985 (Add little `is_test_crate` function)
 - #110028 (Migrate `rustc_hir_analysis` to session diagnostic [Part 3])
 - #110095 (Migrate remainder of rustc_ty_utils to `SessionDiagnostic`)
 - #110108 (Add renaming of ignore-git to changelog)
 - #110114 (compiletest: Give a better error message if `node` isn't installed)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-10 01:57:51 +00:00
Matthias Krüger dd5942d77c
Rollup merge of #110114 - jyn514:wasm-errors, r=compiler-errors
compiletest: Give a better error message if `node` isn't installed
2023-04-09 23:40:06 +02:00
Matthias Krüger 7822064550
Rollup merge of #110108 - duckymirror:rename-ignore-git-changelog, r=ozkanonur
Add renaming of ignore-git to changelog

`bootstrap`'s `ignore-git` option has been renamed to `omit-git-hash` in #110059. This PR adds this change to the `CHANGELOG.md`. See also https://github.com/rust-lang/rust/issues/110020#issuecomment-1499599252.
2023-04-09 23:40:05 +02:00
Matthias Krüger f4827459f8
Rollup merge of #110095 - matthewjasper:ty-utils-diagnostics, r=compiler-errors
Migrate remainder of rustc_ty_utils to `SessionDiagnostic`

This moves the remaining errors in `rust_ty_utils` to `SessionsDiagnostic`.

r? ``@davidtwco``
2023-04-09 23:40:05 +02:00
Matthias Krüger 164d70dc7a
Rollup merge of #110028 - obeis:hir-analysis-migrate-diagnostics-3, r=compiler-errors
Migrate `rustc_hir_analysis` to session diagnostic [Part 3]

Part 3: Finishing `collect.rs` file

r? ``@compiler-errors``
2023-04-09 23:40:04 +02:00
Matthias Krüger 3dfda2c72f
Rollup merge of #109985 - blyxyas:is_test_crate, r=compiler-errors
Add little `is_test_crate` function

Ok, this is quite a story.
I'm mainly a Clippy contributor, so I was fixing [this Clippy issue](https://github.com/rust-lang/rust-clippy/pull/10584) about a lint having to ignore test modules but that wasn't ignoring test files (integration test, `test/` dirs and such).

As test **files** don't tend to have an inner `#[cfg(test)]` module inside them, I tried everything, looking for filenames, looking for item's parents in the HIR Map, doing black magic...

I even asked [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.E2.9C.94.20Checking.20if.20file.20is.20integration.20test), and jyn answered something about `--cfg test`. Aha! That's something that I might be looking for, so I started looking at `rustc_driver_impl` flag parsing and configuration and all that.

Then, I stumbled on [this function right here](2e486be8d2/compiler/rustc_driver_impl/src/lib.rs (L174-L181)), and noticed the argument `config: Config`. That's a hint.

So [Config](https://doc.rust-lang.org/beta/nightly-rustc/rustc_interface/interface/struct.Config.html) has the field `opts: Options`, and [`Options`](https://doc.rust-lang.org/beta/nightly-rustc/rustc_session/options/struct.Options.html) has the field `test`.

This journey has been ~7 or 8 hours in 3 days, it's a very hard thing to find, so this PR adds a mini-function to check if the current crate is a testing one. So that no one has to travel through the same as me, and can just search for `is_test_crate` in the documentation.
2023-04-09 23:40:04 +02:00
Matthias Krüger 4e165c1c99
Rollup merge of #108843 - compiler-errors:non_lifetime_binders-method-probe, r=jackh726
Instantiate instead of erasing binder when probing param methods

Fixes #108836

There is a really old comment saying that a `WhereClauseCandidate` probe candidate "should not contain any inference variables", but I'm not really confident that that comment applies anymore. In contrast, other candidates that we assemble during method probe contain inference variables in their substitutions (e.g. `InherentImplCandidate`)...

Since this change is made only to support a nightly feature, I'm happy to gate the new behavior behind this feature flag or discuss it further.

r? types
2023-04-09 23:40:03 +02:00
Nilstrieb 9fc1555f74 Remove turbofish 2023-04-09 23:32:04 +02:00
Nilstrieb 73417b1e15
Inline format_args
Co-authored-by: Michael Goulet <michael@errs.io>
2023-04-09 23:29:39 +02:00
Nilstrieb cab94d29ff fixup! Improve `Allocation::hash 2023-04-09 23:23:33 +02:00
Nilstrieb 5853c28a7f Simply Abi::fmt 2023-04-09 23:22:14 +02:00
Nilstrieb e5defd0102 Convert manual loop into while let 2023-04-09 23:22:14 +02:00
Nilstrieb 4b4948c2e3 Remove identity casts 2023-04-09 23:22:14 +02:00
Nilstrieb 81c320ea77 Fix some clippy::complexity 2023-04-09 23:22:14 +02:00
Nilstrieb 6fceb0f645 Improve `Allocation::hash
Exhaustively destructure and ignore `()`
2023-04-09 23:22:14 +02:00
Nilstrieb 5a90de8f5e Delete useless loop 2023-04-09 23:22:14 +02:00
Nilstrieb 1c75724752 Properly compare previously shadowed values
The shadowing lead to an incorrect comparison. Rename it and compare it
properly. compiler-errors told me that I should just include the fix
here without a test.
2023-04-09 23:22:14 +02:00
bors 696aaad58c Auto merge of #109760 - MaciejWas:struct-tuple-field-names-suggestion, r=jackh726
Better diagnostic when pattern matching tuple structs

Fixes #108284

When trying to pattern match a tuple struct we might get a flawed error message if there are missing fields. E.g.

```
let x = Foo(100, 200);
if let Foo { 0: bar } = x { ... }
```

Produces this error:

```
error[E0769]: tuple variant `Foo` written as struct variant
 --> hello.rs:5:12
  |
5 |     if let Foo { 0: foo } = x {
  |            ^^^^^^^^^^^^^^
  |
help: use the tuple variant pattern syntax instead
  |
5 |     if let Foo(_, _) = x {
  |               ~~~~~~
```

Which doesn't highlight that we can still use the struct syntax but we need to fill missing fields. This pr changes this error to:

```
error[E0027]: pattern does not mention field `1`
 --> hello.rs:5:12
  |
5 |     if let Foo { 0: foo } = x {
  |            ^^^^^^^^^^^^^^ missing field `1`
  |
help: include the missing field in the pattern
  |
5 |     if let Foo { 0: foo, 1: _ } = x {
  |                        ~~~~~~~~
help: if you don't care about this missing field, you can explicitly ignore it
  |
5 |     if let Foo { 0: foo, .. } = x {
  |                        ~~~~~~
```
2023-04-09 20:57:06 +00:00
Nilstrieb 07cd3826e0 Small clippy::correctness fixes
Nothing was really incorrect before, but it did get nicer.
2023-04-09 22:39:23 +02:00
Nilstrieb 0a0968b207 Allow modulo_one on function using cfg consts 2023-04-09 22:30:24 +02:00
Nilstrieb 968be98756 Allow clippy::from_mut_ref
This pattern is fine for arena allocators.
2023-04-09 22:29:56 +02:00
Nilstrieb f00366d191 Box large enum variants 2023-04-09 21:59:28 +02:00
Nilstrieb 54e1309c65 Use HashMap entry APIs more 2023-04-09 21:59:28 +02:00
Nilstrieb f058d05fc2 Some simple clippy::perf fixes 2023-04-09 21:59:28 +02:00
blyxyas 2c976765b8
Migrate sess.opts.tests uses to sess.is_test_crate() 2023-04-09 21:37:31 +02:00
Joshua Nelson 2b43f25e42 Fix x check --stage 1 when download-rustc is enabled 2023-04-09 14:28:06 -05:00
Scott McMurray d757c4b904 Handle not all immediates having abi::Scalars 2023-04-09 11:16:50 -07:00
bors 39bf7777aa Auto merge of #109751 - bzEq:aix-gmake, r=Mark-Simulacrum
AIX uses gmake for GNU style Makefile

AIX's `make` is SystemV style, should use `gmake` for GNU style Makefile.
2023-04-09 18:11:59 +00:00
Joshua Nelson 464a24e68d compiletest: Use remap-path-prefix only in CI
This makes jump-to-definition work in most IDEs, as well as being easier
to understand for contributors.
2023-04-09 12:38:03 -05:00
Joshua Nelson 7ca7c8fbf3 compiletest: Give a better error message if node isn't installed 2023-04-09 12:36:30 -05:00
bors 1c39afb375 Auto merge of #109684 - fee1-dead-contrib:rv_const_range, r=Mark-Simulacrum
Revert #104100, Allow using `Range` as an `Iterator` in const contexts.

This fixes #109632.
2023-04-09 15:42:27 +00:00
bors 7201301df6 Auto merge of #109500 - petrochenkov:modchainld, r=oli-obk
resolve: Preserve reexport chains in `ModChild`ren

This may be potentially useful for
- avoiding uses of `hir::ItemKind::Use` (which usually lead to correctness issues)
- preserving documentation comments on all reexports, including those from other crates
- preserving and checking stability/deprecation info on reexports
- all kinds of diagnostics

The second commit then migrates some hacky logic from rustdoc to `module_reexports` to make it simpler and more correct.
Ideally rustdoc should use `module_reexports` immediately at the top level, so `hir::ItemKind::Use`s are never used.
The second commit also fixes issues with https://github.com/rust-lang/rust/pull/109330 and therefore
Fixes https://github.com/rust-lang/rust/issues/109631
Fixes https://github.com/rust-lang/rust/issues/109614
Fixes https://github.com/rust-lang/rust/issues/109424
2023-04-09 13:05:56 +00:00
blyxyas 28e19f19aa
Add little is_test_crate function 2023-04-09 13:04:59 +02:00
bors 56e0626836 Auto merge of #110041 - fmease:diag-sugg-adding-const-param, r=compiler-errors
Suggest defining const parameter when appropriate

Helps a bit with #91119.
Following #105523's lead, I use placeholder `/* Type */` instead of `_` in the suggestion.
It should be easier for newcomers to parse.

`@rustbot` label A-diagnostics
r? diagnostics
2023-04-09 10:54:04 +00:00
Erik Hofmayer 3fcc007f96 Add PR link to changelog entry for renaming of ignore-git 2023-04-09 12:36:15 +02:00
Erik Hofmayer 5c75dcdefa Add renaming of ignore-git to changelog 2023-04-09 12:31:13 +02:00