Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: Sync from downstream #18183

Merged
merged 135 commits into from
Sep 25, 2024
Merged

internal: Sync from downstream #18183

merged 135 commits into from
Sep 25, 2024

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Sep 25, 2024

No description provided.

The Miri Cronjob Bot and others added 30 commits July 16, 2024 05:22
TB: Reserved + Protected + IM + lazy is a horrible combination that should not exist

As discovered by `@JoJoDeveloping,` the result of having both Protector exceptions on lazy locations (protectors only protect initialized bytes) and interior mutability exceptions for protected tags (Reserved IM does not accept foreign writes when protected) leads to some very undesirable results, namely that we cannot do spurious writes even on protected activated locations.

We propose that Protected Reserved IM should no longer exist and instead when a type is retagged as part of a `FnEntry` it is assumed to lose interior mutability.

In fact, this was already being done implicitly because relevant transitions were guarded by an `if protected`, but the difference is that now it also applies to transitions that occur after the end of the protector.
Add `miri_start` support

This PR uses a function with the exported symbol `miri_start` as a drop-in alternative to `#[start]`. So the signature stays the same as suggested in [this comment](rust-lang/miri#3498 (comment)). <del>I’ve also removed Miri’s restriction  to only work on bin crates as I don’t think this is necessary anymore.</del>

Closes rust-lang#3758
…, r=saethlin

miri-script: use --remap-path-prefix to print errors relative to the right root

Inspired by rust-lang/rust-clippy#13232, this makes it so that when cargo-miri fails to build, `./miri check` will print errors with paths like `cargo-miri/src/setup.rs`. That means we can get rid of the miri-symlink-hacks and instead tell RA to just always invoke the `./miri clippy` script just once, in the root.

This means that we can no longer share a target dir between cargo-miri and miri as the RUSTFLAGS are different to crates that are shared in the dependency tree need to be built twice with two different flags. `miri-script` hence now has to set the MIRI environment variable to tell the `cargo miri setup` invocation where to find Miri.

I also made it so that errors in miri-script itself are properly shown in RA, for which the `./miri` shell wrapper needs to set the right flags.
Implement epoll shim

This PR:
- implemented non-blocking ``epoll`` for rust-lang#3448 . The design for this PR is documented in https://hackmd.io/`@tiif/SJatftrH0` .
- renamed FileDescriptor to FileDescriptionRef
- assigned an ID to every file description
Make unused states of Reserved unrepresentable

In the [previous TB update](rust-lang/miri#3742) we discovered that the existence of `Reserved + !ty_is_freeze + protected` is undesirable.

This has the side effect of making `Reserved { conflicted: true, ty_is_freeze: false }` unreachable.
As such it is desirable that this state would also be unrepresentable.

This PR eliminates the unused configuration by changing
```rs
enum PermissionPriv {
    Reserved { ty_is_freeze: bool, conflicted: bool },
    ...
}
```
into
```rs
enum PermissionPriv {
    ReservedFrz { conflicted: bool },
    ReservedIM,
    ...
}
```
but this is not the only solution and `Reserved(Activable | Conflicted | InteriorMut)` could be discussed.
In addition to making the unreachable state not representable anymore, this change has the nice side effect of enabling `foreign_read` to no longer depend explicitly on the `protected` flag.

Currently waiting for
- `@JoJoDeveloping` to confirm that this is the same representation of `Reserved` as what is being implemented in simuliris,
- `@RalfJung` to approve that this does not introduce too much overhead in the trusted codebase.
epoll test: further clean up check_epoll_wait

Given that `check_epoll_wait` compared the length of the two slices, I don't think it was possible for it to ever return `false`. It's also strange to have some requirements checked inside the function and some checked by the caller, so let's just move it all inside the function.

Cc `@tiif` -- did I miss anything?
Implement SHA256 SIMD intrinsics on x86

Disclaimer: this is my first contribution to `miri`'s code. It's quite possible I'm missing something. This code works but may not be the cleanest/best possible.

It'd be useful to be able to verify code implementing SHA256 using SIMD since such code is a bit more complicated and at some points requires use of pointers. Until now `miri` didn't support x86 SHA256 intrinsics. This commit implements them.
Subtree update of `rust-analyzer`

r? ````@ghost````
llvm-wrapper: adapt for LLVM API changes

No functional changes intended.

Updates the wrapper for 5c4lar/llvm-project@21eddfa.

````@rustbot```` label: +llvm-main
r? ````@nikic````
Add a test for trait solver overflow in MIR inliner cycle detection

This test is a combination of the reproducer posted here: rust-lang/rust#128887 (comment) and the existing test for polymorphic recursion: https://github.com/rust-lang/rust/blob/784d444733d65c3d305ce5edcbb41e3d0d0aee2e/tests/mir-opt/inline/polymorphic_recursion.rs

r? ```@compiler-errors```
Make the "detect-old-time" UI test more representative

The test code did have an inference failure, but that would have failed
on Rust 1.79 and earlier too. Now it is rewritten to be specifically
affected by 1.80's `impl FromIterator<_> for Box<str>`.
…eyouxu

Remove `#[macro_use] extern crate tracing`, round 4

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from #124511, #124914, and #125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately.

r? ```@jieyouxu```
…er, r=GuillaumeGomez

Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt

A follow-up to #129767 and earlier PRs doing this for `rustc_*` crates.

r? ```@GuillaumeGomez```
bors and others added 14 commits September 22, 2024 00:31
Fix anon const def-creation when macros are involved take 2

Fixes #130321

There were two cases that #129137 did not handle correctly:

- Given a const argument `Foo<{ bar!() }>` in which `bar!()` expands to `N`, we would visit the anon const and then visit the `{ bar() }` expression instead of visiting the macro call. This meant that we would build a def for the anon const as `{ bar!() }` is not a trivial const argument as `bar!()` is not a path.
- Given a const argument `Foo<{ bar!() }>` is which `bar!()` expands to `{ qux!() }` in which `qux!()` expands to `N`, it should not be considered a trivial const argument as `{{ N }}` has two pairs of braces.  If we only looked at `qux`'s expansion it would *look* like a trivial const argument even though it is not. We have to track whether we have "unwrapped" a brace already when recursing into the expansions of `bar`/`qux`/any macro

r? `@camelid`
rustc_expand: remember module `#[path]`s during expansion

During invocation collection, if a module item parsed from a `#[path]` attribute needed a second pass after parsing, its path wouldn't get added to the file path stack, so cycle detection broke. This checks the `#[path]` in such cases, so that it gets added appropriately. I think it should work identically to the case for external modules that don't need a second pass, but I'm not 100% sure.

Fixes #97589
…gjubilee

rustc_llvm: adapt to flattened CLI args in LLVM

This changed in
llvm/llvm-project@e190d07. I decided to stick with more duplication between the ifdef blocks to make the code easier to read for the next two years before we can plausibly drop LLVM 19.

`@rustbot` label: +llvm-main

try-job: x86_64-msvc
…d, r=jieyouxu

fix rustc_nonnull_optimization_guaranteed docs

As far as I can tell, even back when this was [added](rust-lang/rust#60300) it never *enabled* any optimizations. It just indicates that the FFI compat lint should accept those types for NPO.
Mark `char::make_ascii_uppercase` and `char::make_ascii_lowercase` as const.

Relevant tracking issue: #130698

The `make_ascii_uppercase` and `make_ascii_lowercase` methods in `char` should be marked "const."

With the stabilisation of [`const_mut_refs`](rust-lang/rust#57349), this simply requires adding the `const` specifier to the function signatures.
Call module_name_to_str instead of just unwrapping

This makes the ICE message in rust-lang/rust#130678 more clear. It looks like not calling this function was just an oversight in rust-lang/rust#76859, but clearly not a major one because it's taken us 4 years to notice.

try-job: i686-msvc
Apply `EarlyOtherwiseBranch` to scalar value

In the future, I'm thinking of hoisting discriminant via GVN so that we only need to write very little code here.

r? `@cjgillot`
Update to LLVM 19.1.0

This is a branch rebase of the submodule, now that LLVM 19.1.0 is final.
Our *only* extra patch right now is the one we're carrying for SGX unwind.
remove workaround for make prepare and use dry-run build instead

Removes an annoying hard-coded logic.

try-job: x86_64-msvc
llvm: replace some deprecated functions

`LLVMMDStringInContext` and `LLVMMDNodeInContext` are deprecated, replace them with `LLVMMDStringInContext2` and `LLVMMDNodeInContext2`.
Also replace `Value` with `Metadata` in some function signatures for better consistency.
…s, r=cuviper

Add `optimize_for_size` variants for stable and unstable sort as well as select_nth_unstable

- Stable sort uses a simple merge-sort that re-uses the existing - rather gnarly - merge function.
- Unstable sort jumps directly to the branchless heapsort fallback.
- select_nth_unstable jumps directly to the median_of_medians fallback, which is augmented with a custom tiny smallsort and partition impl.

Some code is duplicated but de-duplication would bring it's own problems. For example `swap_if_less` is critical for performance, if the sorting networks don't inline it perf drops drastically, however `#[inline(always)]` is also a poor fit, if the provided comparison function is huge, it gives the compiler an out to only instantiate `swap_if_less` once and call it. Another aspect that would suffer when making `swap_if_less` pub, is having to cfg out dozens of functions in in smallsort module.

Part of rust-lang/rust#125612

r​? `@Kobzol`
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 25, 2024
@lnicola
Copy link
Member Author

lnicola commented Sep 25, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 25, 2024

📌 Commit 6c24765 has been approved by lnicola

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 25, 2024

⌛ Testing commit 6c24765 with merge a160487...

bors added a commit that referenced this pull request Sep 25, 2024
@lnicola
Copy link
Member Author

lnicola commented Sep 25, 2024

@bors retry

@lnicola
Copy link
Member Author

lnicola commented Sep 25, 2024

@bors r-

@lnicola
Copy link
Member Author

lnicola commented Sep 25, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 25, 2024

📌 Commit f4bcae3 has been approved by lnicola

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 25, 2024

⌛ Testing commit f4bcae3 with merge 7ab2c17...

@bors
Copy link
Contributor

bors commented Sep 25, 2024

☀️ Test successful - checks-actions
Approved by: lnicola
Pushing 7ab2c17 to master...

@bors bors merged commit 7ab2c17 into rust-lang:master Sep 25, 2024
11 checks passed
@lnicola lnicola deleted the sync-from-rust branch September 25, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants