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

Rustup #3414

Merged
merged 18 commits into from
Mar 25, 2024
Merged

Rustup #3414

merged 18 commits into from
Mar 25, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Mar 25, 2024

Fixes #3404

RoboSchmied and others added 18 commits March 20, 2024 17:07
…kingjubilee

Expand sys/os for UEFI

- Implement current_exe() and getcwd()
Mention Register Size in `#[warn(asm_sub_register)]`

Fixes #121593

Displays the register size information obtained from `suggest_modifier()` and `default_modifier()`.
fix typo of endianness

fix typo
endianess -> endianness
…ulacrum

Fix compile of wasm64-unknown-unknown target

This target is a Tier 3 target so it's not tested on CI, and it's broken since last used so this commit fixes a small unwind-related issue that cropped up in the meantime.
…ngjubilee

CFI: Support self_cell-like recursion

Current `transform_ty` attempts to avoid cycles when normalizing `#[repr(transparent)]` types to their interior, but runs afoul of this pattern used in `self_cell`:

```
struct X<T> {
  x: u8,
  p: PhantomData<T>,
}

 #[repr(transparent)]
struct Y(X<Y>);
```

When attempting to normalize Y, it will still cycle indefinitely. By using a types-visited list, this will instead get expanded exactly one layer deep to X<Y>, and then stop, not attempting to normalize `Y` any further.

This PR was split off from #121962 as part of fixing the larger vtable compatibility issues.

r? ``````@workingjubilee``````
CFI: Strip auto traits off Virtual calls

We already use `Instance` at declaration sites when available to glean additional information about possible abstractions of the type in use. This does the same when possible at callsites as well.

The primary purpose of this change is to allow CFI to alter how it generates type information for indirect calls through `Virtual` instances.

This is needed for the "separate machinery" version of my approach to the vtable issues (#122573), because we need to respond differently to a `Virtual` call to the same type as a non-virtual call, specifically [stripping auto traits off the receiver's `Self`](rust-lang/rust@54b15b0) because there isn't a separate vtable for `Foo` vs `Foo + Send`.

This would also make a more general underlying mechanism that could be used by rcvalle's [proposed drop detection / encoding](rust-lang/rust@edcd1e2) if we end up using his approach, as we could condition out on the `def_id` in the CFI code rather than requiring the generating code to explicitly note whether it was calling drop.
Simplify an iterator search in borrowck diag

Rather than `.into_iter().rev().find_position(...)`, this case can
simply call `.iter().rposition(...)`.
Rollup of 7 pull requests

Successful merges:

 - #120419 (Expand sys/os for UEFI)
 - #121940 (Mention Register Size in `#[warn(asm_sub_register)]`)
 - #122762 (fix typo of endianness)
 - #122797 (Fix compile of wasm64-unknown-unknown target)
 - #122875 (CFI: Support self_cell-like recursion)
 - #122879 (CFI: Strip auto traits off Virtual calls)
 - #122969 (Simplify an iterator search in borrowck diag)

r? `@ghost`
`@rustbot` modify labels: rollup
…ays, r=oli-obk

Encode implied predicates for traits

In #112629, we decided to make associated type bounds in the "supertrait" AST position *implied* even though they're not supertraits themselves.

This means that the `super_predicates` and `implied_predicates` queries now differ for regular traits. The assumption that they didn't differ was hard-coded in #107614, so in cross-crate positions this means that we forget the implied predicates from associated type bounds.

This isn't unsound, just kind of annoying. This should be backported since associated type bounds are slated to stabilize for 1.78 -- either that, or associated type bounds can be reverted on beta and re-shipped in 1.79 with this patch.

Fixes #122859
ci: Build gccjit from a git archive

A full `git clone` of GCC includes quite a lot of history, and it's
completely unnecessary for building it in CI. We can use a GitHub
archive URL to get a simple tarball that is much faster to download.

Also, the `gcc-build` directory can be removed after install to reduce
the image size even further.
Replace `mir_built` query with a hook and use mir_const everywhere instead

A small perf improvement due to less dep graph handling.

Mostly just a cleanup to get rid of one of our many mir queries
Update upload-artifact to v4

This contains a breaking change around artifact merging no longer being done. This was not relied on, so it's fine.
…eril

Provide structured suggestion for unconstrained generic constant

```
error: unconstrained generic constant
  --> $DIR/const-argument-if-length.rs:18:10
   |
LL |     pad: [u8; is_zst::<T>()],
   |          ^^^^^^^^^^^^^^^^^^^
   |
help: try adding a `where` bound
   |
LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: {
   |                                   ++++++++++++++++++++++++++
```

Detect when the constant expression isn't `usize` and suggest casting:

```
error: unconstrained generic constant
 --> f300.rs:6:10
  |
6 |     bb::<{!N}>();
  |          ^^^^
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36
  |
help: try adding a `where` bound
  |
5 | fn b<const N: bool>() where [(); {!N} as usize]: {
  |                       ++++++++++++++++++++++++++
```

Fix #122395.
@RalfJung
Copy link
Member Author

The last commit is needed for #3404.

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 25, 2024

📌 Commit dee88d7 has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Mar 25, 2024

⌛ Testing commit dee88d7 with merge c941fcd...

@bors
Copy link
Collaborator

bors commented Mar 25, 2024

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing c941fcd to master...

@bors bors merged commit c941fcd into rust-lang:master Mar 25, 2024
8 checks passed
@RalfJung RalfJung deleted the rustup branch March 25, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cargo miri test is broken for doctests (Option 'sysroot' given more than once)
4 participants