Commit Graph

39337 Commits

Author SHA1 Message Date
Michael Goulet
5cf117ed05 Don't call closure_by_move_body_def_id on FnOnce async closures in MIR validation 2024-09-10 10:55:05 -04:00
bors
26b2b8d162 Auto merge of #130179 - workingjubilee:rollup-l78cv44, r=workingjubilee
Rollup of 11 pull requests

Successful merges:

 - #128316 (Stabilize most of `io_error_more`)
 - #129473 (use  `download-ci-llvm=true` in the default compiler config)
 - #129529 (Add test to build crates used by r-a on stable)
 - #129981 (Remove `serialized_bitcode` from `LtoModuleCodegen`.)
 - #130094 (Inform the solver if evaluation is concurrent)
 - #130132 ([illumos] enable SIGSEGV handler to detect stack overflows)
 - #130146 (bootstrap `naked_asm!` for `compiler-builtins`)
 - #130149 (Helper function for formatting with `LifetimeSuggestionPosition`)
 - #130152 (adapt a test for llvm 20)
 - #130162 (bump download-ci-llvm-stamp)
 - #130164 (move some const fn out of the const_ptr_as_ref feature)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-10 07:26:27 +00:00
Jubilee
68ae3b27f5
Rollup merge of #130149 - GrigorenkoPV:lifetime-suggestion, r=cjgillot
Helper function for formatting with `LifetimeSuggestionPosition`
2024-09-09 19:20:38 -07:00
Jubilee
57273d82a8
Rollup merge of #130146 - folkertdev:bootstrap-naked-asm, r=Amanieu
bootstrap `naked_asm!` for `compiler-builtins`

tracking issue: https://github.com/rust-lang/rust/issues/90957
parent PR: https://github.com/rust-lang/rust/pull/128651

in this PR, `naked_asm!` is added as an alias for `asm!` with one difference: `options(noreturn)` is always enabled by `naked_asm!`. That makes it future-compatible for when `naked_asm!` starts disallowing `options(noreturn)` later.

The `naked_asm!` macro must be introduced first so that we can upgrade `compiler-builtins` to use it, and can then change the implementation of `naked_asm!` in https://github.com/rust-lang/rust/pull/128651

I've added some usages for `naked_asm!` in the tests, so we can be confident that it works, but I've left upgrading the whole test suite to the parent PR.

r? ``@Amanieu``
2024-09-09 19:20:38 -07:00
Jubilee
2859c24e64
Rollup merge of #130094 - workingjubilee:concurrency-is-real, r=lcnr
Inform the solver if evaluation is concurrent

Parallel compilation of a program can cause unexpected event sequencing. Inform the solver when this is true so it can skip invalid asserts.
2024-09-09 19:20:37 -07:00
Jubilee
88a2c62652
Rollup merge of #129981 - nnethercote:rm-serialize_bitcode, r=antoyo,tmiasko
Remove `serialized_bitcode` from `LtoModuleCodegen`.

It's unused.

r? ``@bjorn3``
2024-09-09 19:20:36 -07:00
Jubilee
a4c61048d8
Rollup merge of #129529 - lqd:stable-new-solver, r=Kobzol
Add test to build crates used by r-a on stable

r? ````````@Kobzol````````

I've opened other PRs for this one to work and they've landed already. I cherry-picked your commit, and added the last remaining pieces we needed I think.
2024-09-09 19:20:36 -07:00
bors
304b7f801b Auto merge of #129778 - RalfJung:interp-lossy-typed-copy, r=saethlin
interpret: make typed copies lossy wrt provenance and padding

A "typed copy" in Rust can be a lossy process: when copying at type `usize` (or any other non-pointer type), if the original memory had any provenance, that provenance is lost. When copying at pointer type, if the original memory had partial provenance (i.e., not the same provenance for all bytes), that provenance is lost. When copying any type with padding, the contents of padding are lost.

This PR equips our validity-checking pass with the ability to reset provenance and padding according to those rules. Can be reviewed commit-by-commit. The first three commits are just preparation without any functional change.

Fixes https://github.com/rust-lang/miri/issues/845
Fixes https://github.com/rust-lang/miri/issues/2182
2024-09-10 02:18:51 +00:00
Jubilee Young
d243c8fbc4 compiler: Inform the solver of concurrency
Parallel compilation of a program can cause unexpected event sequencing.
Inform the solver when this is true so it can skip invalid asserts, then
assert replaced solutions are equal if Some
2024-09-09 13:07:48 -07:00
bors
c2f74c3f92 Auto merge of #130165 - matthiaskrgr:rollup-fsnmz3t, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #129929 (`rustc_mir_transform` cleanups, round 2)
 - #130022 (Dataflow/borrowck lifetime cleanups)
 - #130064 (fix ICE in CMSE type validation)
 - #130067 (Remove redundant check in `symlink_hard_link` test)
 - #130131 (Print a helpful message if any tests were skipped for being up-to-date)
 - #130137 (Fix ICE caused by missing span in a region error)
 - #130153 (use verbose flag as a default value for `rust.verbose-tests`)
 - #130154 (Stabilize `char::MIN`)
 - #130158 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-09 18:53:06 +00:00
Matthias Krüger
3b0221bf63
Rollup merge of #130137 - gurry:master, r=cjgillot
Fix ICE caused by missing span in a region error

Fixes #130012

The ICE occurs on line 634 in this error handling code: 085744b7ad/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs (L617-L637) It is caused by the span being a dummy span and `!span.is_dummy()` on line 628 evaluating to `false`.

A dummy span, however, is expected here thanks to the `Self: Trait` predicate from `predicates_of` (see line 61): 085744b7ad/compiler/rustc_hir_analysis/src/collect/predicates_of.rs (L61-L69)

This PR changes the error handling code to omit the note which needed the span instead of ICE'ing in the presence of a dummy span.
2024-09-09 20:20:20 +02:00
Matthias Krüger
1490fe6d16
Rollup merge of #130064 - folkertdev:fix-issue-129983, r=compiler-errors
fix ICE in CMSE type validation

fixes #129983

tracking issue: https://github.com/rust-lang/rust/issues/81391

r? ``@compiler-errors``
2024-09-09 20:20:18 +02:00
Matthias Krüger
ee8fd33f60
Rollup merge of #130022 - nnethercote:dataflow-borrowck-lifetimes, r=oli-obk
Dataflow/borrowck lifetime cleanups

These commits remove a bunch of unnecessary lifetimes from structs involved in dataflow/borrowck.

r? ``@lqd``
2024-09-09 20:20:17 +02:00
Matthias Krüger
3e3b14845d
Rollup merge of #129929 - nnethercote:rustc_mir_transform-cleanups-2, r=cjgillot
`rustc_mir_transform` cleanups, round 2

More cleanups in the style of #129738.

r? ``@cjgillot``
2024-09-09 20:20:17 +02:00
bors
d7522d8726 Auto merge of #128939 - bjorn3:windows_cg_clif_component, r=albertlarsan68
Distribute rustc_codegen_cranelift for Windows

With support for raw-dylib recently added to cg_clif, and inline assembly support working on Windows for quite a while now, all blockers for distributing cg_clif on Windows that I mentioned in https://github.com/rust-lang/rust/pull/81746#issuecomment-1774099637 are fixed now.
2024-09-09 16:09:06 +00:00
Ralf Jung
65c70900ce union padding computation: add fast-path for ZST
Also avoid even tracking empty ranges, and add fast-path for arrays of scalars
2024-09-09 14:46:26 +02:00
Pavel Grigorenko
db6361184e Helper function for formatting with LifetimeSuggestionPosition 2024-09-09 14:39:04 +03:00
Folkert de Vries
02378997ea bootstrap naked_asm! for compiler-builtins
in this commit, `naked_asm!` is an alias for `asm!` with one difference: `options(noreturn)` is always enabled by `naked_asm!`. That makes it future-compatible for when `naked_asm!` starts disallowing `options(noreturn)` later.
2024-09-09 12:47:40 +02:00
Folkert de Vries
e186cc6df8 do PolyFnSig -> FnSig conversion later 2024-09-09 11:09:22 +02:00
Jubilee
a7c5797c90
Rollup merge of #130092 - zslayton:master, r=jieyouxu
Fixes typo in wasm32-wasip2 doc comment
2024-09-09 00:17:51 -07:00
Jubilee
09373b997d
Rollup merge of #130070 - gurry:rename-regionkind-addof-to-ref, r=compiler-errors
Rename variant `AddrOfRegion` of `RegionVariableOrigin` to `BorrowRegion`

because "Borrow" is the more idiomatic Rust term than "AddrOf".
2024-09-09 00:17:49 -07:00
Jubilee
15c7d2715a
Rollup merge of #129876 - nnethercote:more-sysroot-rustc_codegen_gcc, r=Mark-Simulacrum
Use sysroot crates maximally in `rustc_codegen_gcc`.

This shrinks `compiler/rustc_codegen_gcc/Cargo.lock` quite a bit. The only remaining dependencies in `compiler/rustc_codegen_gcc/Cargo.lock` are `gccjit`, `lang_tester`, and `boml`, all of which aren't used in any other compiler crates.

The commit also reorders and adds comments to the `extern crate` items so they match those in miri.

r? ```@Mark-Simulacrum```
2024-09-09 00:17:47 -07:00
Jubilee
2cce01ee62
Rollup merge of #128345 - sthibaul:hurd-amd64, r=Urgau
added support for GNU/Hurd on x86_64
2024-09-09 00:17:46 -07:00
Gurinder Singh
0f8efb3b5c Fix ICE caused by missing span in a region error 2024-09-09 12:27:36 +05:30
Nicholas Nethercote
5c3502772a Remove unnecessary lifetime from StorageConflictVisitor. 2024-09-09 16:44:01 +10:00
Nicholas Nethercote
0b032f8f83 Remove Elaborator.
It's a trivial wrapper around `ElaborateDropsCtxt` that serves no
apparent purpose.
2024-09-09 16:33:29 +10:00
Nicholas Nethercote
dc62f07458 Remove Gatherer.
It's a very thin wrapper that pairs `MoveDataBuilder` with a `Location`,
and it has four lifetime arguments. This commit removes it by just
adding a `Location` to `MoveDataBuilder`.
2024-09-09 16:33:27 +10:00
Nicholas Nethercote
28a6dc4d1e Rename some lifetimes.
Give them the names used in most places.
2024-09-09 16:25:44 +10:00
Nicholas Nethercote
1aafeb2d5a Remove unnecessary lifetime from OperandCollector.
Also put the remaining lifetimes into the usual order.
2024-09-09 16:24:08 +10:00
Nicholas Nethercote
bed91f5065 Remove unnecessary lifetime in PlaceCollector. 2024-09-09 16:24:06 +10:00
Nicholas Nethercote
3fe7dd6893 Remove unnecessary lifetimes in dataflow structs.
There are four related dataflow structs: `MaybeInitializedPlaces`,
`MaybeUninitializedPlaces`, and `EverInitializedPlaces`,
`DefinitelyInitializedPlaces`. They all have a `&Body` and a
`&MoveData<'tcx>` field. The first three use different lifetimes for the
two fields, but the last one uses the same lifetime for both.

This commit changes the first three to use the same lifetime, removing
the need for one of the lifetimes. Other structs that also lose a
lifetime as a result of this are `LivenessContext`, `LivenessResults`,
`InitializationData`.

It then does similar things in various other structs.
2024-09-09 16:14:18 +10:00
Nicholas Nethercote
5445953659 Improve consistency in LowerIntrinsics.
In some cases `target` and `arg` are obtained fallibly, and in some
cases they are obtained infallibly. This commit changes them all to
infallible.
2024-09-09 15:15:44 +10:00
Nicholas Nethercote
751c8b481b Use LocalDecls in a couple of places.
It's nicer than the `IndexVec` type.
2024-09-09 15:15:44 +10:00
Nicholas Nethercote
7adde3f074 Make CallSite non-Copy.
It doesn't need to be, and it's 72 bytes on 64-bit platforms, which is
fairly large.
2024-09-09 15:15:43 +10:00
Nicholas Nethercote
9cf90b9fc9 Remove some unnecessary dereferences. 2024-09-09 15:15:43 +10:00
Nicholas Nethercote
4f2588f23a Remove an unnecessary continue.
Nothing comes after it within the loop.
2024-09-09 15:15:43 +10:00
Nicholas Nethercote
181fbd5ce8 Use let/else to de-indent ElaborateBoxDerefs::run_pass. 2024-09-09 15:15:43 +10:00
Nicholas Nethercote
cc09ab3c75 Simplify verify_candidate_branch.
Let chains are perfect for this kind of function.
2024-09-09 15:15:43 +10:00
Nicholas Nethercote
ec6fe4e198 Streamline AbortUnwindingCalls.
Currently it constructs two vectors `calls_to_terminated` and
`cleanups_to_remove` in the main loop, and then processes them after the
main loop. But the processing can be done in the main loop, avoiding the
need for the vectors.
2024-09-09 15:15:42 +10:00
bors
085744b7ad Auto merge of #130036 - weiznich:diagnostic_unstable_tracking, r=compiler-errors
Correctly handle stability of `#[diagnostic]` attributes

This commit changes the way we treat the stability of attributes in the
`#[diagnostic]` namespace. Instead of relaying on ad-hoc checks to
ensure at call side that a certain attribute is really usable at that
location it centralises the logic to one place. For diagnostic
attributes comming from other crates it just skips serializing
attributes that are not stable and that do not have the corresponding
feature enabled. For attributes from the current crate we can just use
the feature information provided by `TyCtx`.

r​? `@compiler-errors`
2024-09-08 23:39:00 +00:00
Nicholas Nethercote
bbe28cf1d9 Remove serialized_bitcode from LtoModuleCodegen.
It's unused.
2024-09-09 09:00:50 +10:00
Nicholas Nethercote
cd9fd274d1 Factor out some more repetitive code. 2024-09-09 08:48:09 +10:00
Nicholas Nethercote
6af470e360 Reduce visibilities, and add warn(unreachable_pub).
Lots of unnecessary `pub`s in this crate. Most are downgraded to
`pub(super)`, though some don't need any visibility.
2024-09-09 08:48:09 +10:00
Samuel Thibault
7626015848 added support for GNU/Hurd on x86_64 2024-09-08 23:37:07 +02:00
Ralf Jung
11bd99de8c IntervalSet: add comment about representation 2024-09-08 16:54:28 +02:00
Ralf Jung
a2410425b3 clarify comments and names in check_validity_requirement 2024-09-08 16:53:23 +02:00
Ralf Jung
8cd982caa1 interpret: reset padding during validation 2024-09-08 16:53:23 +02:00
Ralf Jung
cbdcbf0d6a interpret: reset provenance on typed copies 2024-09-08 16:53:23 +02:00
Ralf Jung
85dc22f2cf interpret: factor out common code for place mutation 2024-09-08 16:53:23 +02:00
Ralf Jung
8ad808db7e interpret: make Writeable trait about a to_place operation 2024-09-08 16:53:23 +02:00