Commit Graph

269947 Commits

Author SHA1 Message Date
Josh Triplett
d7e6074083 style-guide: Only use the new binop heuristic for assignments
This avoids pathological cases where chains of binops get progressively
deeper.
2024-10-30 13:16:43 -07:00
Michael Howell
ac7de1a0d9 Ignore Windows due to its differing path syntax 2024-10-30 12:39:05 -07:00
Michael Goulet
c62f0977a0 Remove do_not_const_check from Iterator methods 2024-10-30 19:24:34 +00:00
Ralf Jung
4ca9c07ef2
Merge pull request #4000 from noahmbright/futex
Change futex_wait errno from Scalar to IoError
2024-10-30 18:50:54 +00:00
Noah Bright
042f762200 Change futex_wait errno from Scalar to IoError
To shift more Scalars to IoErrors, implement this change, allowing
for a few other changes in the Linux and Windows shims. This also
requires introducing a WindowsError variant in the IoError enum
and implementing the VisitProvenance trait for IoErrors.
2024-10-30 14:26:19 -04:00
Michael Goulet
ec033e5bf1 Do not enforce ~const constness effects in typeck if rustc_do_mot_const_check 2024-10-30 17:41:09 +00:00
bors
759e07f063 Auto merge of #132361 - jieyouxu:rollup-zburkwr, r=jieyouxu
Rollup of 6 pull requests

Successful merges:

 - #130098 (Reject generic self types.)
 - #131096 (rustdoc: Remove usage of `allow(unused)` attribute on `no_run` merged doctests)
 - #132315 (compiletest: improve robustness of LLVM version handling)
 - #132346 (Some graphviz tweaks)
 - #132359 (Fix AIX libc call char type from i8 to u8)
 - #132360 (Un-vacation myself)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-30 17:14:47 +00:00
Michael Goulet
802f3a78a6 Merge HostPolarity and BoundConstness 2024-10-30 16:23:16 +00:00
Camille GILLOT
2d74d8f333 Actually capture all in-scope lifetimes. 2024-10-30 16:22:23 +00:00
Camille GILLOT
8f6e0a6a4b Promote test. 2024-10-30 16:22:14 +00:00
Camille GILLOT
27c958fb44 Review comments. 2024-10-30 16:20:49 +00:00
Camille GILLOT
d804ef8be8 Adapt comments. 2024-10-30 16:20:02 +00:00
Camille GILLOT
d693e19268 Promote crashes tests to ui. 2024-10-30 16:19:53 +00:00
Camille GILLOT
b6e1214ac0 Remap impl-trait lifetimes on HIR instead of AST lowering. 2024-10-30 16:18:50 +00:00
Arthur Carcano
df8c20d7a5 Add intra-doc link in str::xxx_prefix 2024-10-30 16:45:54 +01:00
DianQK
ebeaaadcea
Update LLVM to 19.1.3 2024-10-30 22:34:45 +08:00
DianQK
416017d2de
Add a regression test for #131031
The failure output is:
```
SplitVectorOperand Op #1: t51: i32 = llvm.wasm.alltrue TargetConstant:i32<12408>, t50

rustc-LLVM ERROR: Do not know how to split this operator's operand!
```
2024-10-30 22:34:45 +08:00
许杰友 Jieyou Xu (Joe)
5209757e29
Rollup merge of #132360 - BoxyUwU:hellorustc, r=BoxyUwU
Un-vacation myself

beep boop
2024-10-30 22:22:06 +08:00
许杰友 Jieyou Xu (Joe)
426f2fbbe2
Rollup merge of #132359 - mustartt:henry/match-libc-char-type, r=jieyouxu
Fix AIX libc call char type from i8 to u8

There was an update to AIX `libc` default char type from `i8 -> u8`, we should reflect that on the call site to satisfy the type checker.

81f0cd3d97/src/unix/aix/mod.rs (L1)
2024-10-30 22:22:06 +08:00
许杰友 Jieyou Xu (Joe)
18e44f89bf
Rollup merge of #132346 - nnethercote:some-graphviz-tweaks, r=cjgillot
Some graphviz tweaks

r? `@cjgillot`
2024-10-30 22:22:05 +08:00
许杰友 Jieyou Xu (Joe)
c22832fdbe
Rollup merge of #132315 - jieyouxu:extract-llvm-version, r=onur-ozkan
compiletest: improve robustness of LLVM version handling

Previously, `extract_llvm_versions` did some gymnastics for llvm versions by combining `(major, minor, patch)` into a combined version integer, but that is not very robust and made it difficult to add `max-llvm-major-version`. This PR tries to:

- Improve llvm version handling robustness by parsing and representing the version as a semver. We intentionally deviate from strict semver standards by allowing omission of minor and patch versions. They default to `0` when absent. This is for convenience to allow the user to write e.g. `//@ min-llvm-version: 18` instead of having to spell out the full `major.minor.patch` semver string `//@ min-llvm-verison: 18.0.0`.
- Adjust some panic messages to include a bit more context about *why* the version string was rejected.

Prerequisite for #132310.

r? bootstrap (or compiler)
2024-10-30 22:22:04 +08:00
许杰友 Jieyou Xu (Joe)
a864e30269
Rollup merge of #131096 - GuillaumeGomez:rm-no_unused, r=notriddle
rustdoc: Remove usage of `allow(unused)` attribute on `no_run` merged doctests

Fixes [#130681](https://github.com/rust-lang/rust/issues/130681).

It fixes the behaviour difference with the current doctests.

r? ``@notriddle``
2024-10-30 22:22:04 +08:00
许杰友 Jieyou Xu (Joe)
8d9686efc2
Rollup merge of #130098 - adetaylor:arbitrary-self-types-block-generics, r=wesleywiser
Reject generic self types.

The RFC for arbitrary self types v2 declares that we should reject "generic" self types. This commit does so.

The definition of "generic" was unclear in the RFC, but has been explored in
https://github.com/rust-lang/rust/issues/129147
and the conclusion is that "generic" means any `self` type which is a type parameter defined on the method itself, or references to such a type.

This approach was chosen because other definitions of "generic" don't work. Specifically,
* we can't filter out generic type _arguments_, because that would filter out Rc<Self> and all the other types of smart pointer we want to support;
* we can't filter out all type params, because Self itself is a type param, and because existing Rust code depends on other type params declared on the type (as opposed to the method).

This PR decides to make a new error code for this case, instead of reusing the existing E0307 error. This makes the code a bit more complex, but it seems we have an opportunity to provide specific diagnostics for this case so we should do so.

This PR filters out generic self types whether or not the 'arbitrary self types' feature is enabled. However, it's believed that it can't have any effect on code which uses stable Rust, since there are no stable traits which can be used to indicate a valid generic receiver type, and thus it would have been impossible to write code which could trigger this new error case. It is however possible that this could break existing code which uses either of the unstable `arbitrary_self_types` or `receiver_trait` features. This breakage is intentional; as we move arbitrary self types towards stabilization we don't want to continue to support generic such types.

This PR adds lots of extra tests to arbitrary-self-from-method-substs. Most of these are ways to trigger a "type mismatch" error which 9b82580c73/compiler/rustc_hir_typeck/src/method/confirm.rs (L519) hopes can be minimized by filtering out generics in this way. We remove a FIXME from confirm.rs suggesting that we make this change. It's still possible to cause type mismatch errors, and a subsequent PR may be able to improve diagnostics in this area, but it's harder to cause these errors without contrived uses of the turbofish.

This is a part of the arbitrary self types v2 project, https://github.com/rust-lang/rfcs/pull/3519
https://github.com/rust-lang/rust/issues/44874

r? `@wesleywiser`
2024-10-30 22:22:02 +08:00
Boxy
0900a1bd80 the unvacationer 2024-10-30 13:29:05 +00:00
Henry Jiang
a43a37c706 fix libc call from i8 to u8 2024-10-30 09:17:44 -04:00
Jan Bujak
167350d3e9 Add lp64e RISC-V ABI 2024-10-30 20:28:37 +09:00
Adrian Taylor
86af0f9b7e Switch to comparing indices instead of names. 2024-10-30 10:48:10 +00:00
Adrian Taylor
6d8d79595e Reject generic self types.
The RFC for arbitrary self types v2 declares that we should reject
"generic" self types. This commit does so.

The definition of "generic" was unclear in the RFC, but has been
explored in
https://github.com/rust-lang/rust/issues/129147
and the conclusion is that "generic" means any `self` type which
is a type parameter defined on the method itself, or references
to such a type.

This approach was chosen because other definitions of "generic"
don't work. Specifically,
* we can't filter out generic type _arguments_, because that would
  filter out Rc<Self> and all the other types of smart pointer
  we want to support;
* we can't filter out all type params, because Self itself is a
  type param, and because existing Rust code depends on other
  type params declared on the type (as opposed to the method).

This PR decides to make a new error code for this case, instead of
reusing the existing E0307 error. This makes the code a
bit more complex, but it seems we have an opportunity to provide
specific diagnostics for this case so we should do so.

This PR filters out generic self types whether or not the
'arbitrary self types' feature is enabled. However, it's believed
that it can't have any effect on code which uses stable Rust, since
there are no stable traits which can be used to indicate a valid
generic receiver type, and thus it would have been impossible to
write code which could trigger this new error case.
It is however possible that this could break existing code which
uses either of the unstable `arbitrary_self_types` or
`receiver_trait` features. This breakage is intentional; as
we move arbitrary self types towards stabilization we don't want
to continue to support generic such types.

This PR adds lots of extra tests to arbitrary-self-from-method-substs.
Most of these are ways to trigger a "type mismatch" error which
9b82580c73/compiler/rustc_hir_typeck/src/method/confirm.rs (L519)
hopes can be minimized by filtering out generics in this way.
We remove a FIXME from confirm.rs suggesting that we make this change.
It's still possible to cause type mismatch errors, and a subsequent
PR may be able to improve diagnostics in this area, but it's harder
to cause these errors without contrived uses of the turbofish.

This is a part of the arbitrary self types v2 project,
https://github.com/rust-lang/rfcs/pull/3519
https://github.com/rust-lang/rust/issues/44874

r? @wesleywiser
2024-10-30 10:48:08 +00:00
bors
298c7462c3 Auto merge of #130860 - tmandry:fix-directives, r=jieyouxu
Fix directives for lint-non-snake-case-crate

This test fails on targets without unwinding or with `--target-rustcflags=-Cpanic=abort` because the proc macro was compiled as the target, not the host. Some targets were explicitly disabled to pass CI, but these directives are more general.

* `needs-dynamic-linking` is self explanatory
* `force-host` for proc macros
* `no-prefer-dynamic` is apparently also used for proc macros

Note that `needs-unwind` can also be useful for situations other than proc macros where unwinding is necessary.

r? `@jieyouxu`

try-job: test-various
2024-10-30 10:28:56 +00:00
Jubilee Young
083a362dd1 tests: Bless rustc_abi::Abi::Aggregate => ::Memory 2024-10-30 01:41:31 -07:00
Jubilee Young
0b9d1eb889 tests: cross-compile multi-platform ZST ABI tests
This allows them to be blessed, regardless of platform.
2024-10-30 01:41:27 -07:00
Ralf Jung
8a5f34a61a
Merge pull request #4001 from rust-lang/rustup-2024-10-30
Automatic Rustup
2024-10-30 08:34:51 +00:00
bors
8b9f0f9c1c Auto merge of #132349 - matthiaskrgr:rollup-9g6s4p2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #129394 (Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains)
 - #131856 (TypingMode: merge intercrate, reveal, and defining_opaque_types)
 - #132322 (powerpc64-ibm-aix: update maintainters)
 - #132327 (Point to Fuchsia team in platform support docs)
 - #132332 (Use `token_descr` more in error messages)
 - #132338 (Remove `Engine`)
 - #132340 (cg_llvm: Consistently use safe wrapper function `set_section`)
 - #132342 (cg_llvm: Clean up FFI calls for operand bundles)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-30 07:49:46 +00:00
Matthias Krüger
879c4d5ccc
Rollup merge of #132342 - Zalathar:operand-bundle, r=workingjubilee
cg_llvm: Clean up FFI calls for operand bundles

All of these FFI functions have equivalents in the stable LLVM-C API, though `LLVMBuildCallBr` requires a temporary polyfill on LLVM 18.

This PR also creates a clear split between `OperandBundleOwned` and `OperandBundle`, and updates the internals of the owner to be a little less terrifying.
2024-10-30 06:40:38 +01:00
Matthias Krüger
cf2cc010a3
Rollup merge of #132340 - Zalathar:set-section, r=compiler-errors
cg_llvm: Consistently use safe wrapper function `set_section`

Follow-up to #131962 and https://github.com/rust-lang/rust/pull/132260#discussion_r1821626260.

To avoid too much scope creep, I've deliberately kept the changes to `LLVMRustGetSliceFromObjectDataByName` as minimal as possible.
2024-10-30 06:40:37 +01:00
Matthias Krüger
2055237e8f
Rollup merge of #132338 - nnethercote:rm-Engine, r=nnethercote
Remove `Engine`

It's just unnecessary plumbing. Removing it results in less code, and simpler code.

r? ``@cjgillot``
2024-10-30 06:40:37 +01:00
Matthias Krüger
2480e3bbc5
Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebank
Use `token_descr` more in error messages

This is the first two commits from #124141, put into their own PR to get things rolling. Commit messages have the details.

r? ``@estebank``
cc ``@petrochenkov``
2024-10-30 06:40:36 +01:00
Matthias Krüger
af33bc3ec0
Rollup merge of #132327 - djkoloski:redirect_fuchsia_maintainers, r=compiler-errors
Point to Fuchsia team in platform support docs

This consolidates our docs into a single source of truth for the current Fuchsia maintainers.

r? ```@tmandry```
2024-10-30 06:40:36 +01:00
Matthias Krüger
864837b084
Rollup merge of #132322 - daltenty:daltenty/update-aix-maintainters, r=workingjubilee
powerpc64-ibm-aix: update maintainters

Chaofan (`@ecnelises)` and Kai (`@bzEq)` will be passing over maintainership for the target over to David Tenty (`@daltenty)` and Chris Cambly (`@gilamn5tr)`
2024-10-30 06:40:35 +01:00
Matthias Krüger
305508f969
Rollup merge of #131856 - lcnr:typing-mode, r=compiler-errors
TypingMode: merge intercrate, reveal, and defining_opaque_types

This adds `TypingMode` and uses it in most places. We do not yet remove `Reveal` from `param_env`s. This and other future work as tracked in #132279 and via `FIXME`s.

Fetching the `TypingMode` of the `InferCtxt` asserts that the `TypingMode` agrees with `ParamEnv::reveal` to make sure we don't introduce any subtle bugs here. This will be unnecessary once `ParamEnv::reveal` no longer exists.

As the `TypingMode` is now a part of the query input, I've merged the coherence and non-coherence caches for the new solver. I've also enabled the local `infcx` cache during coherence by clearing the cache when forking it with a different `TypingMode`.

#### `TypingMode::from_param_env`

I am using this even in cases where I know that the `param_env` will always be `Reveal::UserFacing`. This is to make it easier to correctly refactor this code in the future, any time we use `Reveal::UserFacing` in a body while not defining its opaque types is incorrect and should use a `TypingMode` which only reveals opaques defined by that body instead, cc #124598

r? ``@compiler-errors``
2024-10-30 06:40:34 +01:00
Matthias Krüger
87d348b333
Rollup merge of #129394 - Jarcho:irrefutable_let_patterns, r=Nadrieril
Don't lint `irrefutable_let_patterns` on leading patterns if `else if` let-chains

fixes #128661

Is there any preference where the test goes? There looks to be several places it could fit.
2024-10-30 06:40:34 +01:00
The Miri Cronjob Bot
7d12e50f73 Merge from rustc 2024-10-30 05:12:55 +00:00
Michal Piotrowski
7591eb60ad
Fix compiler panic with a large number of threads 2024-11-01 14:52:41 +01:00
The Miri Cronjob Bot
ff6e703bf1 Preparing for merge from rustc 2024-10-30 05:05:05 +00:00
许杰友 Jieyou Xu (Joe)
e419b3d1ec compiletest: improve robustness of LLVM version handling 2024-10-30 12:54:44 +08:00
Zalathar
c3071590ab Clean up FFI calls for operand bundles 2024-10-30 13:26:24 +11:00
bors
16422dbd89 Auto merge of #132238 - Urgau:midpoint-i64-hackers-impl, r=joboet
Use Hacker's Delight impl in `i64::midpoint` instead of wide `i128` impl

This PR switches `i64::midpoint` and (`isize::midpoint` where `isize == i64`) to using our Hacker's Delight impl instead of wide `i128` implementation.

As LLVM seems to be outperformed by the complexity of signed 128-bits number compared to our Hacker's Delight implementation.[^1]

It doesn't seems like it's an improvement for the other sizes[^2], so we let them with the wide implementation.

[^1]: https://rust.godbolt.org/z/ravE75EYj
[^2]: https://rust.godbolt.org/z/fzr171zKh

r? libs
2024-10-30 02:26:18 +00:00
Nicholas Nethercote
d921be92a4 Return label from write_node_label.
Instead of appending an empty label. Because it's conceptually simpler.
2024-10-30 13:21:32 +11:00
Nicholas Nethercote
a8ce44f7d9 Simplify graphviz::Formatter.
`Formatter` currently has a `RefCell<Option<Results>>` field. This is so
the `Results` can be temporarily taken and put into a `ResultsCursor`
that is used by `BlockFormatter`, and then put back, which is messy.

This commit changes `Formatter` to have a `RefCell<ResultsCursor>` and
`BlockFormatter` to have a `&mut ResultsCursor`, which greatly
simplifies the code at the `Formatter`/`BlockFormatter` interaction
point in `Formatter::node_label`. It also means we construct a
`ResultsCursor` once per `Formatter`, instead of once per `node_label`
call.

The commit also:
- documents the reason for the `RefCell`;
- adds a `Formatter::body` method, replacing the `Formatter::body`
  field.
2024-10-30 13:19:29 +11:00
Nicholas Nethercote
744eb2f937 Rename BlockFormatter::results as BlockFormatter::cursor.
Because it's a `ResultsCursor`, not a `Results`. I find this easier to
read and understand.
2024-10-30 13:12:03 +11:00