Commit Graph

266226 Commits

Author SHA1 Message Date
Josh Stone
8bab397835 Revert "Add a hack to prevent proc_macro misopt in CI"
This reverts commit da8ac73d91.
2024-09-18 13:53:33 -07:00
Josh Stone
6fd8a50680 Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
Michael Goulet
12f2bcde63 Check params for unsafety in THIR 2024-09-18 16:45:48 -04:00
Jubilee Young
51718e8eca tests: Move wasm32 to transparent-opaque-ptr.rs test 2024-09-18 12:31:51 -07:00
Jubilee Young
b75711df12 tests: Remove test for wrong wasm codegen 2024-09-18 12:28:55 -07:00
Jubilee Young
a800d1cf37 compiler: s/make_indirect_byval/pass_by_stack_offset/
The previous name is just an LLVMism, which conveys almost nothing about
what is actually meant by the function relative to the ABI.

In doing so, remove an already-addressed FIXME.
2024-09-18 12:28:55 -07:00
Jubilee Young
0cf89b5336 compiler: Use make_indirect for the wasm ABI
This is ignored by LLVM, but is still incorrect.
2024-09-18 12:28:55 -07:00
Jubilee Young
f22797d3db library: Call it really_init_mut to avoid name collisions 2024-09-18 11:39:24 -07:00
Jubilee Young
d9cdb71497 library: Destabilize Lazy{Cell,Lock}::{force,deref}_mut 2024-09-18 11:39:21 -07:00
Lieselotte
db09345ef6
Add suggestions for expressions in patterns 2024-09-18 20:38:43 +02:00
Lieselotte
c2047219b5
Recover more expressions in patterns 2024-09-18 20:37:56 +02:00
bors
f79a912d9e Auto merge of #130519 - matthiaskrgr:rollup-l1hok4x, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #130457 (Cleanup codegen traits)
 - #130471 (Add zlib to musl dist image so rust-lld will support zlib compression for debug info there.)
 - #130507 (Improve handling of raw-idents in check-cfg)
 - #130509 (llvm-wrapper: adapt for LLVM API changes, second try)
 - #130510 (doc: the source of `LetStmt` can also be `AssignDesugar`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-18 17:51:26 +00:00
León Orell Valerian Liehr
682c5f485b
Explicitly mark a hack as a HACK and elaborate its comment 2024-09-18 19:36:44 +02:00
Esteban Küber
bd8e88fd7b
Do not ICE with incorrect empty suggestion
When we have two types with the same name, one without type parameters and the other with type parameters and a derive macro, we were before incorrectly suggesting to remove type parameters from the former, which ICEd because we were suggesting to remove nothing. We now gate against this.

The output is still not perfect. E0107 should explicitly detect this case and provide better context, but for now let's avoid the ICE.
2024-09-18 19:21:07 +02:00
GnomedDev
a18564c198
[Clippy] Swap manual_retain to use diagnostic items instead of paths 2024-09-18 17:20:44 +01:00
Matthias Krüger
c0951bbce2
Rollup merge of #130510 - samueltardieu:doc-letstmt-assign-desugar, r=compiler-errors
doc: the source of `LetStmt` can also be `AssignDesugar`

For example, the two following statements are desugared into a block whose `LetStmt` source is `AssignDesugar`:

```rust
_ = ignoring_some_result();
(a, b) = (b, a);
```
2024-09-18 17:49:45 +02:00
Matthias Krüger
48b90aaed3
Rollup merge of #130509 - krasimirgg:llvm-20-2, r=nikic
llvm-wrapper: adapt for LLVM API changes, second try

This is a re-work of https://github.com/rust-lang/rust/pull/129749 after LLVM brought back the APIs used by rust.

No functional changes intended.

`@rustbot` label: +llvm-main
r? `@nikic`
cc: `@tmandry`
2024-09-18 17:49:45 +02:00
Matthias Krüger
00c4be3df8
Rollup merge of #130507 - Urgau:check-cfg-raw-keywords, r=jieyouxu
Improve handling of raw-idents in check-cfg

This PR improves the handling of raw-idents in the check-cfg diagnostics.

In particular the list of expected names and the suggestion now correctly take into account the "keyword-ness" of the ident, and correctly prefix the ident with `r#` when necessary.

`@rustbot` labels +F-check-cfg
2024-09-18 17:49:44 +02:00
Matthias Krüger
3443795606
Rollup merge of #130471 - khuey:zlib-musl, r=Kobzol
Add zlib to musl dist image so rust-lld will support zlib compression for debug info there.

Fixes #130063.

r? `@Kobzol`
2024-09-18 17:49:44 +02:00
Matthias Krüger
21313d7947
Rollup merge of #130457 - nnethercote:cleanup-codegen-traits, r=bjorn3
Cleanup codegen traits

The traits governing codegen are quite complicated and hard to follow. This PR cleans them up a bit.

r? `@bjorn3`
2024-09-18 17:49:43 +02:00
Artyom Tetyukhin
ed2e0abc51
Bump cc dependency 2024-09-18 19:34:36 +04:00
bors
7fc70f870a Auto merge of #130497 - saethlin:alloc-zeroed-is-unstable, r=bjorn3
read_volatile __rust_no_alloc_shim_is_unstable in alloc_zeroed

It was pointed out in https://github.com/rust-lang/rust/issues/128854#issuecomment-2278919897 that the magic volatile read was probably missing from `alloc_zeroed`. I can't find any mention of `alloc_zeroed` on https://github.com/rust-lang/rust/pull/86844, so it looks like this was just missed initially.
2024-09-18 14:48:50 +00:00
Alexey Shekhirin
96a3b48197
Clarify docs for std::fs::File::write 2024-09-18 15:15:54 +01:00
Samuel Tardieu
a47e9b6c54 doc: the source of LetStmt can also be AssignDesugar
For example, the two following statements are desugared into a block
whose `LetStmt` source is `AssignDesugar`:

```rust
_ = ignoring_some_result();
(a, b) = (b, a);
```
2024-09-18 15:27:04 +02:00
Krasimir Georgiev
3a352884f8 llvm-wrapper: adapt for LLVM API changes, second try 2024-09-18 13:23:42 +00:00
bors
aaed38b2a6 Auto merge of #129491 - StackOverflowExcept1on:master, r=m-ou-se
Pass `fmt::Arguments` by reference to `PanicInfo` and `PanicMessage`

Resolves #129330

For some reason after #115974 and #126732 optimizations applied to panic handler became worse and compiler stopped removing panic locations if they are not used in the panic message. This PR fixes that and maybe we can merge it into beta before rust 1.81 is released.

Note: optimization only works with `lto = "fat"`.

r? libs-api
2024-09-18 11:57:31 +00:00
Adwin White
9ac23dde37 Get rid of niche selection's dependence on fields's order 2024-09-18 17:31:56 +08:00
bors
82d17a4db3 Auto merge of #130500 - matthiaskrgr:rollup-lfx3bb4, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #130466 (tests: add repr/transparent test for aarch64)
 - #130468 (Make sure that def id <=> lang item map is bidirectional)
 - #130499 (Add myself to the libs review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-18 09:25:01 +00:00
Urgau
89f04c2521 Improve handling of raw-idents in check-cfg 2024-09-18 11:07:32 +02:00
bors
f68c28b6ce Auto merge of #129845 - scottmcm:redo-layout, r=Noratrieb
Take more advantage of the `isize::MAX` limit in `Layout`

Things like `padding_needed_for` are current implemented being super careful to handle things like `Layout::size` potentially being `usize::MAX`.

But now that #95295 has happened, that's no longer a concern.  It's possible to add two `Layout::size`s together without risking overflow now.

So take advantage of that to remove a bunch of checked math that's not actually needed.  For example, the round-up-and-add-next-size in `extend` doesn't need any overflow checks at all, just the final check for compatibility with the alignment.

(And while I was doing that I made it all unstably const, because there's nothing in `Layout` that's fundamentally runtime-only.)
2024-09-18 07:05:14 +00:00
Matthias Krüger
d20649e79d
Rollup merge of #130499 - ibraheemdev:libs-review, r=Noratrieb
Add myself to the libs review rotation
2024-09-18 09:03:53 +02:00
Matthias Krüger
7e67d90213
Rollup merge of #130468 - compiler-errors:bidi, r=Nadrieril
Make sure that def id <=> lang item map is bidirectional

Self-explanatory from assertion. Just makes sure of an invariant that I forgot to enforce when I added `LanguageItems::from_def_id`.
2024-09-18 09:03:53 +02:00
Matthias Krüger
b21581d1cb
Rollup merge of #130466 - davidtwco:aarch64-transparent-test, r=jieyouxu
tests: add repr/transparent test for aarch64

Fixes #74396.

Moves `transparent-struct-ptr.rs` to `transparent-byval-struct-ptr.rs` and then adds a new `transparent-opaque-ptr.rs` for aarch64.
2024-09-18 09:03:52 +02:00
Ibraheem Ahmed
f5223276bd
format 2024-09-18 01:10:16 -04:00
Ibraheem Ahmed
99ea16af1a
add myself to the libs review rotation 2024-09-18 01:07:30 -04:00
bors
f6bcd094ab Auto merge of #130498 - matthiaskrgr:rollup-tg4d0zi, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #130116 (Implement a Method to Seal `DiagInner`'s Suggestions)
 - #130489 (Ensure that `keyword_ident` lint doesn't trigger on `'r#kw` lifetime)
 - #130491 (more crash tests)
 - #130496 (Fix circular fn_sig queries to correct number of args for methods)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-18 04:01:51 +00:00
Yacin Tmimi
31e799f17f Document changes for the next release 2024-09-17 23:42:59 -04:00
Scott McMurray
18ca8bf8ee Take more advantage of the isize::MAX limit in Layout
Things like `padding_needed_for` are current implemented being super careful to handle things like `Layout::size` potentially being `usize::MAX`.

But now that 95295 has happened, that's no longer a concern.  It's possible to add two `Layout::size`s together without risking overflow now.

So take advantage of that to remove a bunch of checked math that's not actually needed.  For example, the round-up-and-add-next-size in `extend` doesn't need any overflow checks at all, just the final check for compatibility with the alignment.

(And while I was doing that I made it all unstably const, because there's nothing in `Layout` that's fundamentally runtime-only.)
2024-09-17 20:05:57 -07:00
Matthias Krüger
c52d58dce1
Rollup merge of #130496 - jder:issue-130400, r=compiler-errors
Fix circular fn_sig queries to correct number of args for methods

Fixes #130400. This was a [debug assert](28e8f01c2a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs (L2557)) added to some argument error reporting code in #129320 which verified that the number of params (from the HIR) matched the `matched_inputs` which ultimately come from ty::FnSig. In the reduced test case:

```
fn foo(&mut self) -> _ {
    foo()
}
```

There is a circular dependency computing the ty::FnSig -- when trying to compute it, we try to figure out the return value, which again depends on this ty::FnSig. In #105162, this was supported by short-circuiting the cycle by synthesizing a FnSig with error types for parameters. The [code in question](https://github.com/rust-lang/rust/pull/105162/files#diff-a65feec6bfffb19fbdc60a80becd1030c82a56c16b177182cd277478fdb04592R44) computes the number of parameters by taking the number of parameters from the hir::FnDecl and adding 1 if there is an implicit self parameter.

I might be missing a subtlety here, but AFAICT the adjustment for implicit self args is unnecessary and results in one too many args. For example, for this non-errorful code:

```
trait Foo {
    fn bar(&self) {}
}
```

The resulting hir::FnDecl and ty::FnSig both have the same number of inputs -- 1. So, this PR removes that adjustment and adds a test for the debug ICE.

r? `@compiler-errors`
2024-09-18 04:42:32 +02:00
Matthias Krüger
862f3e7685
Rollup merge of #130491 - matthiaskrgr:sehsarc, r=compiler-errors
more crash tests

r? `@compiler-errors`
2024-09-18 04:42:32 +02:00
Matthias Krüger
32c4d4112c
Rollup merge of #130489 - compiler-errors:raw-lt-lint, r=jieyouxu
Ensure that `keyword_ident` lint doesn't trigger on `'r#kw` lifetime

Fixes #130486
2024-09-18 04:42:31 +02:00
Matthias Krüger
09b255d3d4
Rollup merge of #130116 - veera-sivarajan:freeze-suggestions, r=chenyukang
Implement a Method to Seal `DiagInner`'s Suggestions

This PR adds a method on `DiagInner` called `.seal_suggestions()` to prevent new suggestions from being added while preserving existing suggestions.

This is useful because currently there is no way to prevent new suggestions from being added to a diagnostic. `.disable_suggestions()` is the closest but it gets rid of all suggestions before and after the call.

Therefore, `.seal_suggestions()` can be used when, for example, misspelled keyword is detected and reported. In such cases, we may want to prevent other suggestions from being added to the diagnostic, as they would likely be meaningless once the misspelled keyword is identified. For context: https://github.com/rust-lang/rust/pull/129899#discussion_r1741307132

To store an additional state, the type of the `suggestions` field in `DiagInner` was changed into a three variant enum. While this change affects files across different crates, care was taken to preserve the existing code's semantics. This is validated by the fact that all UI tests pass without any modifications.

r? chenyukang
2024-09-18 04:42:31 +02:00
Ben Kimock
46761442b0 read_volatile __rust_no_alloc_shim_is_unstable in alloc_zeroed 2024-09-17 22:26:21 -04:00
bors
60c3673456 Auto merge of #130454 - durin42:llvm-20-notrunc, r=workingjubilee
tests: allow trunc/select instructions to be missing

On LLVM 20, these instructions already get eliminated, which at least partially satisfies a TODO. I'm not talented enough at using FileCheck to try and constrain this further, but if we really want to we could copy an LLVM 20 specific version of this test that would restore it to being CHECK-NEXT: insertvalue ...

`@rustbot` label: +llvm-main
r? `@DianQK`
2024-09-18 01:27:26 +00:00
Jesse Rusak
3cb1f334b8 Fix circular fn_sig queries to return the correct number of arguments for methods 2024-09-17 20:54:04 -04:00
bors
f7b4c72c8f Auto merge of #130492 - matthiaskrgr:rollup-9pxkd8i, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #130481 (Remove uneeded PartialOrd bound in cmp::Ord::clamp)
 - #130482 (Remove redundant test typeid equality by subtyping)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-17 23:05:43 +00:00
Ibraheem Ahmed
0fa92b4159 add Thread::{into_raw, from_raw} 2024-09-17 18:50:06 -04:00
Michael Goulet
87bc2f77ea Do not expect infer/bound/placeholder/error in v0 symbol mangling 2024-09-17 18:20:18 -04:00
Matthias Krüger
7e8eb7aa93
Rollup merge of #130482 - spastorino:remove-known-bug-97156, r=jackh726
Remove redundant test typeid equality by subtyping

This known-bug label was a left over on #118247

r? `@jackh726`

This doesn't address #110395, I didn't investigate about it yet.
2024-09-18 00:12:19 +02:00
Matthias Krüger
0a35418d34
Rollup merge of #130481 - krtab:clamp_partial_ord, r=cuviper
Remove uneeded PartialOrd bound in cmp::Ord::clamp

There is a `Self: PartialOrd` bound in `Ord::clamp`, but it is already required by the trait itself. Likely a left-over from the const trait deletion in 76dbe29104.

Reported-by: `@noeensarguet`
2024-09-18 00:12:19 +02:00