Commit Graph

229185 Commits

Author SHA1 Message Date
bors
a161ab00db Auto merge of #113637 - Mark-Simulacrum:bootstrap-bump, r=ozkanonur
Bump bootstrap to 1.72 beta
2023-07-13 18:15:14 +00:00
bors
1b3e686925 Auto merge of #113646 - matthiaskrgr:rollup-1q6tmow, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #113353 (Implement selection for `Unsize` for better coercion behavior)
 - #113553 (Make Placeholder, GeneratorWitness*, Infer and Error unreachable on SMIR rustc_ty_to_ty)
 - #113598 (Update cargo)
 - #113603 (Test simd-wide-sum for codegen error)
 - #113613 (Allow to have `-` in rustdoc-json test file name)
 - #113615 (llvm-wrapper: adapt for LLVM API change)
 - #113616 (Fix bootstrap.py uname error)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-13 16:24:28 +00:00
Mark Rousskov
e8b0b1781d Ignore the let-else reformatting in git blame 2023-07-13 08:17:40 -04:00
Matthias Krüger
7ea4387a93
Rollup merge of #113616 - edg-l:fix_bootstrap, r=albertlarsan68
Fix bootstrap.py uname error

The x.py script fails with `ValueError: too many values to unpack (expected 3)` when uname -smp gives more than 3 words

The error I got:
```
❯ ./x check
Traceback (most recent call last):
  File "/data1/edgar/rust/x.py", line 50, in <module>
    bootstrap.main()
  File "/data1/edgar/rust/src/bootstrap/bootstrap.py", line 1113, in main
    bootstrap(args)
  File "/data1/edgar/rust/src/bootstrap/bootstrap.py", line 1070, in bootstrap
    build = RustBuild(config_toml, args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data1/edgar/rust/src/bootstrap/bootstrap.py", line 505, in __init__
    self.build = args.build or self.build_triple()
                               ^^^^^^^^^^^^^^^^^^^
  File "/data1/edgar/rust/src/bootstrap/bootstrap.py", line 976, in build_triple
    return config or default_build_triple(self.verbose)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data1/edgar/rust/src/bootstrap/bootstrap.py", line 259, in default_build_triple
    kernel, cputype, processor = uname.decode(default_encoding).split()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 3)
```

This is because

```
❯ uname -smp
Linux x86_64 AMD Ryzen 7 5800X 8-Core Processor
```
Returns more than 3 space separated words.
2023-07-13 12:19:25 +02:00
Matthias Krüger
b37c916559
Rollup merge of #113615 - krasimirgg:llvm-17-pgo, r=nikic
llvm-wrapper: adapt for LLVM API change

Adapts the wrapper for LLVM commit 546ec641b4.

Found by the experimental rust + LLVM @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/20723#01894922-ed5d-4830-81f6-a27fb82ec8c7/210-645
2023-07-13 12:19:24 +02:00
Matthias Krüger
253a4ca43f
Rollup merge of #113613 - GuillaumeGomez:allow-dash-in-file-name, r=notriddle
Allow to have `-` in rustdoc-json test file name

I extracted this commit from https://github.com/rust-lang/rust/pull/113574.

When I added the test, it kept saying that the JSON file couldn't be found. After investigating for a while, I discovered that we were expecting files to always use `_`, which is quite bad. So I added support for `-` in file names.

r? ``@notriddle``
2023-07-13 12:19:24 +02:00
Matthias Krüger
fc72c0fe8f
Rollup merge of #113603 - workingjubilee:test-for-98016, r=oli-obk
Test simd-wide-sum for codegen error

This adds the necessary test infrastructure to "build-pass" codegen tests, for the purpose of doing that for a single revision of a codegen test. When mir-opts are tested, the output may vary from the usual, and maybe for positive reasons... but we don't necessarily want to output such bad LLVMIR that LLVM starts crashing on it.

Currently when enabling MIR opts at higher levels this LLVMIR is still emitted, but it was previously disabled for getting in mir-opt's way and as this new revision without `// [mir-opt3]build-pass` would make it more likely to, I would like to not see the testing for the actual results regress again just because it was bundled with an ICE check as well.

This fixes https://github.com/rust-lang/rust/issues/98016
2023-07-13 12:19:23 +02:00
Matthias Krüger
a6fed6a0ca
Rollup merge of #113598 - weihanglo:update-cargo, r=weihanglo
Update cargo

10 commits in 45782b6b8afd1da042d45c2daeec9c0744f72cc7..694a579566a9a1482b20aff8a68f0e4edd99bd28
2023-07-05 16:54:51 +0000 to 2023-07-11 22:28:29 +0000
- fix(embedded): Always generate valid package names (rust-lang/cargo#12349)
- fix(embedded): Error on unsupported commands (rust-lang/cargo#12350)
- chore(ci): Automatically test new packages by using `--workspace` (rust-lang/cargo#12342)
- contrib docs: Add some more detail about how publishing works (rust-lang/cargo#12344)
- docs: Put cargo-add change under nightly (rust-lang/cargo#12343)
- Minor: Use "number" instead of "digit" when explaining Cargo's use of semver (rust-lang/cargo#12340)
- Update criterion (rust-lang/cargo#12338)
- Add profile strip to config docs. (rust-lang/cargo#12337)
- update re: multiple versions that differ only in the metadata tag (rust-lang/cargo#12335)
- doc: state `PackageId`/`SourceId` string is opaque (rust-lang/cargo#12313)

r? ``@ghost``
2023-07-13 12:19:23 +02:00
Matthias Krüger
66233fbb32
Rollup merge of #113553 - spastorino:smir-types-2, r=oli-obk
Make Placeholder, GeneratorWitness*, Infer and Error unreachable on SMIR rustc_ty_to_ty

Let's remove these todos to not confuse ``@ericmarkmartin`` if they pick some conversion up.

r? ``@oli-obk``
2023-07-13 12:19:22 +02:00
Matthias Krüger
893a5d2b32
Rollup merge of #113353 - compiler-errors:select-better, r=lcnr
Implement selection for `Unsize` for better coercion behavior

In order for much of coercion to succeed, we need to be able to deal with partial ambiguity of `Unsize` traits during selection. However, I pessimistically implemented selection in the new trait solver to just bail out with ambiguity if it was a built-in impl:
9227ff28af/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs (L126)

This implements a proper "rematch" procedure for dealing with built-in `Unsize` goals, so that even if the goal is ambiguous, we are able to get nested obligations which are used in the coercion selection-like loop:
9227ff28af/compiler/rustc_hir_typeck/src/coercion.rs (L702)

Second commit just moves a `resolve_vars_if_possible` call to fix a bug where we weren't detecting a trait upcasting to occur.

r? ``@lcnr``
2023-07-13 12:19:22 +02:00
Mark Rousskov
cc907f80b9 Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
Mark Rousskov
67b0cfc761 Flip cfg's for bootstrap bump 2023-07-12 21:38:55 -04:00
Mark Rousskov
7559d96be9 Bump bootstrap compiler to latest 2023-07-12 21:26:04 -04:00
Mark Rousskov
0d93d787ba Replace version placeholder to 1.72 2023-07-12 21:24:05 -04:00
bors
33a2c2487a Auto merge of #113621 - ehuss:ignore-clippy-tests, r=Nilstrieb
Ignore flaky clippy tests.

These tests are frequently failing due to an issue in ui_test. ui_test doesn't appear to have a blanket ignore instruction that I could find, so I just approximated it with ignoring both 32 and 64 bit.

Fixes #113585
2023-07-12 15:47:32 +00:00
Eric Huss
fb5efd7008 Ignore flaky clippy tests. 2023-07-12 06:59:57 -07:00
bors
1e6db3486d Auto merge of #113214 - GuillaumeGomez:try-run-fix, r=ozkanonur,jyn514
Don't fail early if `try_run` returns an error

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

Follow-up of #112962.

r? `@jyn514`
2023-07-12 13:58:10 +00:00
bors
da1d099f91 Auto merge of #112945 - compiler-errors:tighten-span-of-adjustment-error, r=oli-obk
(re-)tighten sourceinfo span of adjustments in MIR

Diagnostics rely on the spans of MIR statements being (approximately) correct in order to give suggestions relative to that span (i.e. `shrink_to_hi` and `shrink_to_lo`).

I discovered that we're *intentionally* lowering THIR exprs with their parent expr's span if they come from adjustments that are due to a parent expression. While I understand why that may be desirable to demonstrate the relationship of an adjustment and the expression that requires it, it leads to

1. very verbose borrowck output
2. incorrect spans for suggestions

Some diagnostics get around that by giving suggestions relative to other spans we've collected during MIR lowering, such as the span of the method's identifier (e.g. `name` in `.name()`), but this doesn't work too well when things come from desugaring.

I assume it also has lead to numerous tweaks and complications to diagnostics code down the road, which this PR doesn't necessarily aim to fix but may open the gates to fixing later... The last three commits are simplifications due to the fact that we can assume that the move span actually points to what is being moved (and a test).

This regressed in #89110, which was debated somewhat in #90286. cc `@Aaron1011` who originally made this change.

r? diagnostics

Fixes #113547
Fixes #111016
2023-07-12 12:11:09 +00:00
bors
136dab6614 Auto merge of #113569 - RalfJung:miri, r=oli-obk
miri: protect Move() function arguments during the call

This gives `Move` operands a meaning specific to function calls:
- for the duration of the call, the place the operand comes from is protected, making all read and write accesses insta-UB.
- the contents of that place are reset to `Uninit`, so looking at them again after the function returns, we cannot observe their contents

Turns out we can replace the existing "retag return place" hack with the exact same sort of protection on the return place, which is nicely symmetric.

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

This starts with a Miri rustc-push, since we'd otherwise conflict with a PR that recently landed in Miri.
(The "miri tree borrows" commit is an unrelated cleanup I noticed while doing the PR. I can remove it if you prefer.)
r? `@oli-obk`
2023-07-12 10:19:42 +00:00
Weihang Lo
9f1c760349
Update cargo 2023-07-12 11:19:09 +01:00
Edgar Luque
d68eea61c3
Fix bootstrap.py uname error.
The x.py script fails with `ValueError: too many values to unpack (expected 3)` when uname -smp gives more than 3 words
2023-07-12 11:52:53 +02:00
Krasimir Georgiev
71958da485 llvm-wrapper: adapt for LLVM API change
Adapts the wrapper for LLVM commit
546ec641b4.

Found by the experimental rust + LLVM @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/20723#01894922-ed5d-4830-81f6-a27fb82ec8c7/210-645
2023-07-12 09:30:31 +00:00
Guillaume Gomez
18457ea47d Allow to have - in the rustdoc-json test file name 2023-07-12 10:45:49 +02:00
bors
910be1b3e8 Auto merge of #113573 - lcnr:typeck-results, r=compiler-errors
remove unnecessary `Rc`

the typeck results are already in a `RefCell`, so we don't need to wrap its fields in an `Rc`
2023-07-12 07:50:40 +00:00
bors
6732922ea6 Auto merge of #113608 - workingjubilee:rollup-8763ius, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #113373 (various download-rustc fixes)
 - #113385 (style-guide: Fix chain example to match rustfmt behavior)
 - #113567 (While let suggestion will work for closure body)
 - #113579 (Revert "fix: 🐛 etc/bash_complettion -> src/etc/... to avoid copy …)
 - #113595 (Use constants from object crate)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-12 06:03:53 +00:00
Jubilee
f05e6e6331
Rollup merge of #113595 - cchiw:object_consts, r=workingjubilee
Use constants from object crate

Replace hard-coded values with  `GNU_PROPERTY_{X86|AARCH64}_FEATURE_1_AND` from the object crate.

When working on  [issue](https://github.com/rust-lang/rust/issues/103001) it was suggested that we moved these constants to the object crate .  [PR](https://github.com/gimli-rs/object/pull/537). Now that that the object crate has been updated  [PR](https://github.com/rust-lang/rust/pull/111413) we can make this change.
2023-07-11 21:00:29 -07:00
Jubilee
dc78cedd66
Rollup merge of #113579 - ekusiadadus:master, r=albertlarsan68
Revert "fix: 🐛 etc/bash_complettion -> src/etc/... to avoid copy …

## why

- [x] revert my broken PR

https://github.com/rust-lang/rust/pull/110906

This reverts commit 08ce68b6a6.
2023-07-11 21:00:29 -07:00
Jubilee
f7a34f9518
Rollup merge of #113567 - chenyukang:yukang-fix-113354-while-let, r=cjgillot
While let suggestion will work for closure body

Fixes #113354
2023-07-11 21:00:28 -07:00
Jubilee
3518041a84
Rollup merge of #113385 - joshtriplett:style-guide-cleanup-chains, r=calebcartwright
style-guide: Fix chain example to match rustfmt behavior

The style guide gave an example of breaking a multi-line chain element
and all subsequent elements to a new line, but that same example and the
accompanying text also had several chain items stacked on the first
line. rustfmt doesn't do this, except when the rule saying to combine

```
shrt
    .y()
```

into

```
shrt.y()
```

applies.

This is a bugfix to match rustfmt behavior, so it's not a breaking change, and
it just needs a ``@rust-lang/style`` reviewer to r+.
2023-07-11 21:00:28 -07:00
Jubilee
dff07259d0
Rollup merge of #113373 - jyn514:download-rustc-fixes, r=albertlarsan68
various download-rustc fixes

separated out from https://github.com/rust-lang/rust/pull/112143 because it keeps getting stuck in limbo.

best reviewed commit-by-commit
2023-07-11 21:00:27 -07:00
jyn
67b5990472 Revert "Fix x test lint-docs when download-rustc is enabled"
This was not the correct fix. The problem was two-fold:
- `download-rustc` didn't respect `llvm.assertions`
- `rust-dev` was missing a bump to `download-ci-llvm-stamp`

The first is fixed in this PR and the latter was fixed a while ago. Revert this change to avoid breaking `rpath = false`.
2023-07-11 22:30:28 -05:00
jyn
30e34f3857 Don't depend on crate names in tests/ui-fulldeps/missing-rustc-driver-error.rs
Not only are they a pain to update, but they differ depending on whether `parallel-rustc` is enabled or not
2023-07-11 22:30:28 -05:00
jyn
934e7e6c26 Move ci_rustc_dir to Config and use it consistently 2023-07-11 22:30:28 -05:00
Jubilee Young
7dc049c378 Reenable all cases of simd-wide-sum 2023-07-11 20:21:32 -07:00
Jubilee Young
81dc91efbd Support build-pass in codegen tests 2023-07-11 20:21:15 -07:00
Jubilee Young
571aac9fba Add mir-opt3 rev to simd-wide-sum test 2023-07-11 19:07:39 -07:00
Charisee
650243977b Use constants from object crate
Replace hard-coded values with  GNU_PROPERTY_{X86|AARCH64}_FEATURE_1_AND from the object crate.
2023-07-11 23:48:18 +00:00
bors
993deaa0bf Auto merge of #112984 - BoxyUwU:debug_with_infcx, r=compiler-errors
Introduce `trait DebugWithInfcx` to debug format types with universe info

Seeing universes of infer vars is valuable for debugging but currently we have no way of easily debug formatting a type with the universes of all the infer vars shown. In the future I hope to augment the new solver's proof tree output with a `DebugWithInfcx` impl so that it can show universes but I left that out of this PR as it would be non trivial and this is already large and complex enough.

The goal here is to make the various abstractions taking `T: Debug` able to use the codepath for printing out universes, that way we can do `debug!("{:?}", my_x)` and have `my_x` have universes shown, same for the `write!` macro. It's not possible to put the `Infcx: InferCtxtLike<I>` into the formatter argument to `Debug::fmt` so it has to go into the self ty. For this we introduce the type `OptWithInfcx<I: Interner, Infcx: InferCtxtLike<I>, T>` which has the data `T` optionally coupled with the infcx (more on why it's optional later).

Because of coherence/orphan rules it's not possible to write the impl `Debug for OptWithInfcx<..., MyType>` when `OptWithInfcx` is in a upstream crate. This necessitates a blanket impl in the crate defining `OptWithInfcx` like so: `impl<T: DebugWithInfcx> Debug for OptWithInfcx<..., T>`. It is not intended for people to manually call `DebugWithInfcx::fmt`, the `Debug` impl for `OptWithInfcx` should be preferred.

The infcx has to be optional in `OptWithInfcx` as otherwise we would end up with a large amount of code duplication. Almost all types that want to be used with `OptWithInfcx` do not themselves need access to the infcx so if we were to not optional we would end up with large `Debug` and `DebugWithInfcx` impls that were practically identical other than that when formatting their fields we wrap the field in `OptWithInfcx` instead of formatting it alone.

The only types that need access to the infcx themselves are ty/const/region infer vars, everything else is implemented by having the `Debug` impl defer to `OptWithInfcx` with no infcx available. The `DebugWithInfcx` impl is pretty much just the standard `Debug` impl except that instead of recursively formatting fields with `write!(f, "{x:?}")` we must do `write!(f, "{:?}", opt_infcx.wrap(x))`. This is some pretty rough boilerplate but I could not think of an alternative unfortunately.

`OptWithInfcx::wrap` is an eager `Option::map` because 99% of callsites were discarding the existing data in `OptWithInfcx` and did not need lazy evaluation.

A trait `InferCtxtLike` was added instead of using `InferCtxt<'tcx>` as we need to implement `DebugWithInfcx` for types living in `rustc_type_ir` which are generic over an interner and do not have access to `InferCtxt` since it lives in `rustc_infer`. Additionally I suspect that adding universe info to new solver proof tree output will require an implementation of `InferCtxtLike` for something that is not an `InferCtxt` although this is not the primary motivaton.

---

To summarize:
- There is a type `OptWithInfcx` which bundles some data optionally with an infcx with allows us to pass an infcx into a `Debug` impl. It's optional instead of being there unconditionally so that we can share code for `Debug` and `DebugWithInfcx` impls that don't care about whether there is an infcx available but have fields that might care.
- There is a trait `DebugWithInfcx` which allows downstream crates to add impls of the form `Debug for OptWithInfcx<...>` which would normally be forbidden by orphan rules/coherence.
- There is a trait `InferCtxtLike` to allow us to implement `DebugWithInfcx` for types that live in `rustc_type_ir`

This allows debug formatting various `ty::*` structures with universes shown by using the `Debug` impl for `OptWithInfcx::new(ty, infcx)`

---

This PR does not add `DebugWithInfcx` impls to absolutely _everything_ that should realistically have them, for example you cannot use `OptWithInfcx<Obligation<Predicate>>`. I am leaving this to a future PR to do so as it would likely be a lot more work to do.
2023-07-11 20:54:00 +00:00
Ralf Jung
e7c6db7d44 fix handling of alignment for dyn-sized places 2023-07-11 21:59:01 +02:00
Ralf Jung
124fb1490a update Operand::Move docs 2023-07-11 21:59:01 +02:00
Ralf Jung
95392ef0c9 miri tree borrows: skip retag_reference early if there is no NewPermission 2023-07-11 21:59:01 +02:00
Ralf Jung
dd453a6a99 miri: protect Move() function arguments during the call 2023-07-11 21:59:01 +02:00
bors
48a814deab Auto merge of #103754 - SUPERCILEX:filled-mut, r=m-ou-se
Add back BorrowedBuf::filled_mut

This is useful if you want to do some processing on the bytes while still using the BorrowedBuf.

The API was removed in https://github.com/rust-lang/rust/pull/97015 with no explanation. The RFC also has it as part of its API, so this just seems like a mistake: [RFC](https://rust-lang.github.io/rfcs/2930-read-buf.html#:~:text=inline%5D%0A%20%20%20%20pub%20fn-,filled_mut,-(%26mut%20self))

ACP: https://github.com/rust-lang/libs-team/issues/139
2023-07-11 19:07:11 +00:00
bors
e571544f44 Auto merge of #113577 - matthiaskrgr:rollup-vaa83ip, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #112717 (Implement a few more rvalue translation to smir)
 - #113310 (Don't suggest `impl Trait` in path position)
 - #113497 (Support explicit 32-bit MIPS ABI for the synthetic object)
 - #113560 (Lint against misplaced where-clauses on associated types in traits)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-11 17:19:10 +00:00
Santiago Pastorino
715cd99450
Make Placeholder, GeneratorWitness*, Infer and Error unreachable on SMIR rustc_ty_to_ty 2023-07-11 12:59:38 -03:00
ekusiadadus
05bc71cfaf Revert "fix: 🐛 etc/bash_complettion -> src/etc/... to avoid copy error"
This reverts commit 08ce68b6a6.
2023-07-12 00:54:27 +09:00
Matthias Krüger
4f5ef52c37
Rollup merge of #113560 - fmease:assoc-tys-in-traits-depr-wc-loc, r=compiler-errors
Lint against misplaced where-clauses on associated types in traits

Extends the scope of the lint `deprecated_where_clause_location` (#89122) from associated types in impls to associated types in any location (impl or trait). This is only relevant for `#![feature(associated_type_defaults)]`. Previously we didn't warn on the following code for example:

```rs
#![feature(associated_type_defaults)]
trait Trait { type Assoc where u32: Copy = (); }
```

Personally I would've preferred to emit a *hard* error here instead of a lint warning since the feature is unstable but unfortunately we are constrained by back compat as associated type defaults won't necessarily trigger the feature-gate error if they are inside of a macro call (since they use a post-expansion feature-gate due to historical reasons, see also #66004).

I've renamed and moved related preexisting tests: 1. They test AST validation passes not the parser & thus shouldn't live in `parser/` (historical reasons?). 2. One test file was named after type aliases even though it tests assoc tys.

`@rustbot` label A-lint
2023-07-11 17:46:20 +02:00
Matthias Krüger
685ba08693
Rollup merge of #113497 - xSetech:mips_32_abi, r=davidtwco
Support explicit 32-bit MIPS ABI for the synthetic object

PR #95604 introduced a "synthetic object file to ensure all exported and used symbols participate in the linking". One constraint on this file is that for MIPS-based targets, its architecture-specific ELF flags must be the same as all other object files passed to the linker. That's enforced by LLD, here:
https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/lld/ELF/Arch/MipsArchTree.cpp#L77

The current approach to determining e_flags for 32-bit was implemented in PR #96930, which links to this issue that summarizes the problem well: https://github.com/ayrtonm/psx-sdk-rs/issues/9

> ... the temporary object file is created with an e_flags which is
> invalid for 32-bit MIPS targets. The main issue is that it omits the ABI
> bits (EF_MIPS_ABI_O32) which implies it uses the N64 ABI.

To enable the N32 MIPS ABI (which succeeded O32), this patch enables setting the synthetic object's ABI based on the target "llvm-abiname" field, if it's given; otherwise, the O32 ABI is assumed for 32-bit MIPS targets.

More information about the N32 ABI can be found here: https://web.archive.org/web/20160121005457/http://techpubs.sgi.com/library/manuals/2000/007-2816-005/pdf/007-2816-005.pdf
2023-07-11 17:46:19 +02:00
Matthias Krüger
c6df564b8c
Rollup merge of #113310 - jieyouxu:dont-suggest-impl-trait-in-paths, r=lcnr
Don't suggest `impl Trait` in path position

Fixes #113264.
2023-07-11 17:46:18 +02:00
Matthias Krüger
3f73a7dba3
Rollup merge of #112717 - celinval:stable-mir-rvalue-1, r=oli-obk
Implement a few more rvalue translation to smir

Add the implementation for a few more RValue variants. For now, I simplified the stable version of `RValue::Ref` by removing the notion of Region.

r? `@oli-obk`
2023-07-11 17:46:18 +02:00