Commit Graph

221919 Commits

Author SHA1 Message Date
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
Josh Triplett
afd45c2e10 Stabilize IsTerminal
closes: https://github.com/rust-lang/rust/issues/98070
2023-04-10 17:24:23 +09:00
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
Michael Goulet
a047064d6b Revert "Don't recover lifetimes/labels containing emojis as character literals"
Reverts PR #108031
Fixes (doesnt close until beta backported) #109746

This reverts commit e3f9db5fc3.
This reverts commit 98b82aedba.
This reverts commit 380fa26413.
2023-04-10 06:52:41 +00:00
Michael Goulet
b369c8ecbd Do not use ImplDerivedObligationCause for inherent impl method error reporting 2023-04-10 06:06:08 +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
Jakob Degen
d8ed2fb0bb Fix transmute intrinsic mir validation ICE 2023-04-09 18:16:05 -07:00
Tobias Decking
0f96c71792 Improve the floating point parser in dec2flt.
* Remove all remaining traces of unsafe.
* Put `parse_8digits` inside a loop.
* Rework parsing of inf/NaN values.
2023-04-10 00:47:08 +02: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
Joshua Nelson
fb927968cc Separate out a rustc_llvm_env function 2023-04-09 15:19:21 -05: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
bors
015fb8a9e3 Auto merge of #10618 - KisaragiEffective:patch-2, r=llogiq
[missing_const_for_fn] fix #7121

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`missing_const_for_fn`] note about removing const may break compatibility

fix #7121
2023-04-09 18:49:52 +00:00
bors
7de7ca802e Auto merge of #10610 - beetrees:max-line-length, r=Jarcho
Add `max_line_length` to `.editorconfig`, matching `rustfmt.toml`

Add `max_line_length` to `.editorconfig` to match the `max_width` in `rustfmt.toml`.

changelog: none
2023-04-09 18:38:18 +00: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
Kisaragi
ba1f19ee30
apply code review suggestion
Co-authored-by: llogiq <bogusandre@gmail.com>
2023-04-10 01:31:30 +09:00
Kisaragi
5109a8a840
[missing_const_for_fn] fix #7121 2023-04-10 00:55:32 +09: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