Commit Graph

254398 Commits

Author SHA1 Message Date
Jubilee Young
e404e7a8bd We do not coerce &mut &mut T -> *mut mut T 2024-05-03 20:19:20 -07:00
Alex Crichton
400e75494a rustc: Don't pass -fuse-ld=lld on wasm targets
This argument isn't necessary for WebAssembly targets since `wasm-ld` is
the only linker for the targets. Passing it otherwise interferes with
Clang's linker selection on `wasm32-wasip2` so avoid it altogether.
2024-05-03 19:47:15 -07:00
Deadbeef
921e74fa57 Make Bounds.clauses private 2024-05-04 10:20:39 +08:00
Zalathar
6968123c3f coverage: Rename BcbBranchPair to mappings::BranchPair
This makes it consistent with the other mapping structs introduced by this PR.
2024-05-04 11:26:05 +10:00
Zalathar
76d8d01604 coverage: Flatten BcbMappingKind into mappings::CodeMapping
Now that branch and MC/DC mappings have been split out into separate types and
vectors, this enum is no longer needed, since it only represents ordinary
"code" regions.

(We can revisit this decision if we ever add support for other region kinds,
such as skipped regions or expansion regions. But at that point, we might just
add new structs/vectors for those kinds as well.)
2024-05-04 11:26:05 +10:00
Zalathar
cf2d741d40 coverage: Extract helper region_for_span 2024-05-04 11:26:05 +10:00
Zalathar
23b6508181 coverage: Split out MC/DC branches from BcbMappingKind 2024-05-04 11:26:05 +10:00
Zalathar
af33fc85de coverage: Split out MC/DC decisions from BcbMappingKind 2024-05-04 11:26:02 +10:00
bors
09cd00fea4 Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillot
Some hir cleanups

It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field.

r? compiler
2024-05-04 00:32:27 +00:00
Scott Schafer
8644cf9ccc
Update cargo 2024-05-03 17:05:30 -06:00
Alex Crichton
7a77108809 rustc: Change LLVM target for the wasm32-wasip2 Rust target
This commit changes the LLVM target of for the Rust `wasm32-wasip2`
target to `wasm32-wasip2` as well. LLVM does a bit of detection on the
target string to know when to call `wasm-component-ld` vs `wasm-ld` so
otherwise clang is invoking the wrong linker.
2024-05-03 15:57:31 -07:00
Esteban Küber
4847f2249f Do not ICE on foreign malformed diagnostic::on_unimplemented
Fix #124651.
2024-05-03 21:53:19 +00:00
bors
d2d24e395a Auto merge of #123602 - cjgillot:gvn-borrowed, r=oli-obk
Account for immutably borrowed locals in MIR copy-prop and GVN

For the most part, we consider that immutably borrowed `Freeze` locals still fulfill SSA conditions. As the borrow is immutable, any use of the local will have the value given by the single assignment, and there can be no surprise.

This allows copy-prop to merge a non-borrowed local with a borrowed local. We chose to keep copy-classes heads unborrowed, as those may be easier to optimize in later passes.

This also allows to GVN the value behind an immutable borrow. If a SSA local is borrowed, dereferencing that borrow is equivalent to copying the local's value: re-executing the assignment between the borrow and the dereference would be UB.

r? `@ghost` for perf
2024-05-03 21:50:13 +00:00
Erik Kaneda
dde17cf3ee
zkvm: fix run_tests
zkvm is single-threaded, similar to emscripten and wasm.
2024-05-03 14:34:51 -07:00
bors
74701dcef2 Auto merge of #3547 - RalfJung:ci, r=RalfJung
CI: no need to surround if: condition in expansion braces

That seems to be implicit for `if:` (but interestingly, redundant braces are tolerated).
2024-05-03 20:57:06 +00:00
bors
befabbc9e5 Auto merge of #124675 - matthiaskrgr:rollup-x6n79ua, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #122492 (Implement ptr_as_ref_unchecked)
 - #123815 (Fix cannot usage in time.rs)
 - #124059 (default_alloc_error_hook: explain difference to default __rdl_oom in alloc)
 - #124510 (Add raw identifier in a typo suggestion)
 - #124555 (coverage: Clean up creation of MC/DC condition bitmaps)
 - #124593 (Describe and use CStr literals in CStr and CString docs)
 - #124630 (CI: remove `env-x86_64-apple-tests` YAML anchor)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-03 19:46:04 +00:00
Ralf Jung
aa71f9b033 CI: no need to surround if: condition in expansion braces 2024-05-03 21:45:03 +02:00
Guillaume Gomez
5ea65c8ccb Migrate run-make/doctests-keep-binaries to new rmake.rs format 2024-05-03 21:27:52 +02:00
Guillaume Gomez
cc29dfa785 Add Rustdoc::current_dir method to run-make-support 2024-05-03 21:27:13 +02:00
UserIsntAvailable
4c286c7f9a feat: stabilize split_at_checked 2024-05-03 15:02:02 -04:00
David Koloski
063770972a Set non-leaf frame pointers on Fuchsia targets 2024-05-03 19:01:44 +00:00
bors
692b769d61 Auto merge of #3545 - RalfJung:miri-run, r=RalfJung
./miri run: support -v flag to print what it is doing
2024-05-03 18:50:28 +00:00
Matthias Krüger
56b2989d67
Rollup merge of #124630 - Kobzol:yaml-anchor, r=pietroalbini
CI: remove `env-x86_64-apple-tests` YAML anchor

This PR removes the only remaining anchor in the definition of CI jobs. This anchor made it annoying to copy-paste the job e.g. to PR CI.

Fixes: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/How.20do.20you.20edit.20PR.20CI.20to.20test.20PR.20now.3F

r? ``@pietroalbini``
2024-05-03 20:33:47 +02:00
Matthias Krüger
1ff247c404
Rollup merge of #124593 - GKFX:cstr-literals-in-api-docs, r=workingjubilee
Describe and use CStr literals in CStr and CString docs

Mention CStr literals in the description of both types, and use them in some of the code samples for CStr. This is intended to make C string literals more discoverable.

Additionally, I don't think the orange "This example is not tested" warnings are very encouraging, so I have made the examples on `CStr` build.
2024-05-03 20:33:46 +02:00
Matthias Krüger
613bccc4ca
Rollup merge of #124555 - Zalathar:init-coverage, r=nnethercote
coverage: Clean up creation of MC/DC condition bitmaps

This PR improves the code for creating and initializing [MC/DC](https://en.wikipedia.org/wiki/Modified_condition/decision_coverage) condition bitmap variables, as introduced by #123409 and modified by #124255.

- The condition bitmap variables are now created eagerly at the start of per-function codegen, via a new `init_coverage` method in `CoverageInfoBuilderMethods`. This avoids having to retroactively create the bitmaps while doing codegen for an individual coverage statement.
- As a result, we can now create and initialize those bitmaps using existing safe APIs, instead of having to perform our own unsafe call to `llvm::LLVMBuildAlloca`.
- This PR also tweaks the way we count the number of condition bitmaps needed, by tracking the total number of bitmaps needed (max depth + 1), instead of only tracking the maximum depth. This reduces the potential for subtle off-by-one confusion.
2024-05-03 20:33:46 +02:00
Matthias Krüger
bd305e10c2
Rollup merge of #124510 - linyihai:raw-ident-in-typo-suggestion, r=fmease
Add raw identifier in a typo suggestion

Fixes #68962
2024-05-03 20:33:45 +02:00
Matthias Krüger
8e3f61b9f9
Rollup merge of #124059 - RalfJung:default_alloc_error_hook, r=workingjubilee
default_alloc_error_hook: explain difference to default __rdl_oom in alloc

Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.
2024-05-03 20:33:45 +02:00
Matthias Krüger
4b913a2330
Rollup merge of #123815 - trueb2:patch-1, r=workingjubilee
Fix cannot usage in time.rs

Fix a small grammar error in usage of cannot in time.rs errors
2024-05-03 20:33:44 +02:00
Matthias Krüger
a296693376
Rollup merge of #122492 - GrigorenkoPV:ptr_as_ref_unchecked, r=workingjubilee
Implement ptr_as_ref_unchecked

Implementation of #122034.

Prefixed the feature name with `ptr_` for clarity.

Linked const-unstability to #91822, so the post there should probably be updated to mentions the 3 new methods when/if this PR is merged.
2024-05-03 20:33:44 +02:00
Ralf Jung
eaf30cee7e ./miri run: support -v flag to print what it is doing 2024-05-03 20:31:27 +02:00
bors
dcf956c365 Auto merge of #3544 - RalfJung:rustup, r=RalfJung
Preparing for merge from rustc

Unblocks https://github.com/rust-lang/miri/pull/3526.
2024-05-03 18:18:27 +00:00
Ralf Jung
0de07d80ff Preparing for merge from rustc 2024-05-03 19:52:08 +02:00
bors
8a31014b9f Auto merge of #3542 - RalfJung:clippy-win, r=RalfJung
run clippy on a Windows host

Fixes https://github.com/rust-lang/miri/issues/3324
2024-05-03 17:45:09 +00:00
bors
0d7b2fb797 Auto merge of #123441 - saethlin:fixed-len-file-names, r=oli-obk
Stabilize the size of incr comp object file names

The current implementation does not produce stable-length paths, and we create the paths in a way that makes our allocation behavior is nondeterministic. I think `@eddyb` fixed a number of other cases like this in the past, and this PR fixes another one. Whether that actually matters I have no idea, but we still have bimodal behavior in rustc-perf and the non-uniformity in `find` and `ls` was bothering me.

I've also removed the truncation of the mangled CGU names. Before this PR incr comp paths look like this:
```
target/debug/incremental/scratch-38izrrq90cex7/s-gux6gz0ow8-1ph76gg-ewe1xj434l26w9up5bedsojpd/261xgo1oqnd90ry5.o
```
And after, they look like this:
```
target/debug/incremental/scratch-035omutqbfkbw/s-gux6borni0-16r3v1j-6n64tmwqzchtgqzwwim5amuga/55v2re42sztc8je9bva6g8ft3.o
```

On the one hand, I'm sure this will break some people's builds because they're on Windows and only a few bytes from the path length limit. But if we're that seriously worried about the length of our file names, I have some other ideas on how to make them smaller. And last time I deleted some hash truncations from the compiler, there was a huge drop in the number if incremental compilation ICEs that were reported: https://github.com/rust-lang/rust/pull/110367https://github.com/rust-lang/rust/pull/110367

---

Upon further reading, this PR actually fixes a bug. This comment says the CGU names are supposed to be a fixed-length hash, and before this PR they aren't: ca7d34efa9/compiler/rustc_monomorphize/src/partitioning.rs (L445-L448)
2024-05-03 17:41:48 +00:00
Ralf Jung
03589bfe98 run clippy on a Windows host 2024-05-03 19:36:33 +02:00
Ralf Jung
3f6703bbd8 default_alloc_error_hook: explain difference to default __rdl_oom in alloc 2024-05-03 19:12:33 +02:00
bors
d6d3b342e8 Auto merge of #124660 - matthiaskrgr:rollup-j8bfzfn, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #124461 (handle the targets that are missing in stage0)
 - #124492 (Generalize `adjust_from_tcx` for `Allocation`)
 - #124588 (Use `ObligationCtxt` in favor of `TraitEngine` in many more places)
 - #124612 (Add support for inputing via stdin with run-make-support)
 - #124613 (Allow fmt to run on rmake.rs test files)
 - #124649 (Fix HorizonOS build broken by #124210)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-03 15:37:22 +00:00
12101111
f13edeb451
Fix bootstrap panic when build from tarball 2024-05-03 22:53:53 +08:00
Jakub Beránek
02f4ef7cde
Allow reusing CI Docker cache when running CI images locally 2024-05-03 15:52:00 +02:00
Jakub Beránek
0372065097
Calculate the Docker hash key also locally 2024-05-03 15:50:02 +02:00
Jakub Beránek
27d1d0a6a4
Do not include Docker version in caching key
We are now using Docker caching directly rather than downloading archives from S3, so it should not be needed.

This should unblock reusing the cache locally.
2024-05-03 15:49:15 +02:00
Matthias Krüger
a7f4a2edc6
Rollup merge of #124649 - Meziu:master, r=ChrisDenton
Fix HorizonOS build broken by #124210

HorizonOS (for the Tier-3 target `armv6k-nintendo-3ds`) does not support `dirfd()`, as many other similar targets.
2024-05-03 15:26:11 +02:00
Matthias Krüger
82030f2dd4
Rollup merge of #124613 - GuillaumeGomez:fmt-run-make, r=onur-ozkan
Allow fmt to run on rmake.rs test files

As discussed with `@jieyouxu,` `rmake.rs` from the `run-make` testsuite would benefit from being formatted as well.

Only thing needed to be done for it to work: allow support for `!` in our `rustfmt.toml` file parsing.

r? `@onur-ozkan`
2024-05-03 15:26:11 +02:00
Matthias Krüger
c27d3d5d2a
Rollup merge of #124612 - Urgau:run-make-stdin, r=jieyouxu
Add support for inputing via stdin with run-make-support

This PR adds the facility to set a input bytes that will be passed via the standard input.

This is useful for testing `rustc -` (and soon `rustdoc -`).

In #124611 took the approach of having a dedicated `run` method but it is not very convenient to use and would necessitate many functions, one for success, one for fail, ...

Instead this PR takes a different approach and allows setting the input bytes as if it were a parameter and when calling the (now custom) `output` function, we write the input bytes into stdin. I think this gives us maximum flexibility in the implementation and a simple interface for users.

To test this new logic I ported `tests/run-make/stdin-non-utf8/` to an `rmake.rs` one.

r? `@jieyouxu`
2024-05-03 15:26:10 +02:00
Matthias Krüger
08d9992812
Rollup merge of #124588 - compiler-errors:ocx, r=lcnr
Use `ObligationCtxt` in favor of `TraitEngine` in many more places

r? lcnr
2024-05-03 15:26:10 +02:00
Matthias Krüger
eaca729e0b
Rollup merge of #124492 - Strophox:adjust-allocbytes, r=RalfJung
Generalize `adjust_from_tcx` for `Allocation`

Previously, `adjust_from_tcx` would take an `Allocation` and "adjust allocation from the ones in `tcx` to a custom Machine instance [...]".
This PR generalizes this so the Machine instance can also determine the `Bytes` type of the output `Allocation`.

r? `@RalfJung`
2024-05-03 15:26:09 +02:00
Matthias Krüger
819a5f0546
Rollup merge of #124461 - onur-ozkan:followup-123546, r=pietroalbini
handle the targets that are missing in stage0

During sanity checks, we search for target names to determine if they exist in the compiler's built-in target list (`rustc --print target-list`). While a target name may be present in the stage2 compiler, it might not yet be included in stage0. This PR handles that difference.

Follow-up of https://github.com/rust-lang/rust/pull/123546
2024-05-03 15:26:08 +02:00
Strophox
38181cba79 remove trait bounds on AllocBytes 2024-05-03 15:00:37 +02:00
Ralf Jung
27353d4ccc release notes 1.78: add link to interior-mut breaking change 2024-05-03 14:56:05 +02:00
Strophox
235770c851 Cow::from(&*...) changed to Cow::Owned(Vec::from(...)) 2024-05-03 13:47:16 +02:00