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

Rollup of 9 pull requests #122979

Closed
wants to merge 22 commits into from

Conversation

workingjubilee
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

veera-sivarajan and others added 22 commits March 3, 2024 09:24
- Implement current_exe()
- Cache device_path_to_text protocol

Signed-off-by: Ayush Singh <[email protected]>
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.
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.
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.
Additional trait bounds beyond the principal trait and its implications
are not possible in the vtable. This means that if a receiver is
`&dyn Foo + Send`, the function will only be expecting `&dyn Foo`.

This strips those auto traits off before CFI encoding.
…spans.

This makes `-Zprint-type-sizes`'s output easier to read, because the
name of an `async fn` is more immediately recognizable than its span.

I also deleted the comment "FIXME(eddyb) should use `def_span`." because
it appears to have already been fixed by commit 67727aa.
Rather than `.into_iter().rev().find_position(...)`, this case can
simply call `.iter().rposition(...)`.
…ishop,workingjubilee

Expand sys/os for UEFI

- Implement current_exe() and getcwd()
…onur-ozkan

Introduce infrastructure for generating target docs

See rust-lang#120745

It's highly unlikely that the format is optimal, but it's okay at least and can always be improved. Mostly posting this to get something working so we can continue.

Use `TARGET_CHECK_ONLY=0` to actually build the book instead of just checking the new docs.

r? `@davidtwco`
…mease

Mention Register Size in `#[warn(asm_sub_register)]`

Fixes rust-lang#121593

Displays the register size information obtained from `suggest_modifier()` and `default_modifier()`.
…rkingjubilee

fix typo of endianness

fix typo
endianess -> endianness
…=Mark-Simulacrum

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.
…, r=workingjubilee

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 rust-lang#121962 as part of fixing the larger vtable compatibility issues.

r? `````@workingjubilee`````
…ngjubilee

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 (rust-lang#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@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@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.
…-errors

In `pretty_print_type()`, print `async fn` futures' paths instead of spans.

This makes `-Zprint-type-sizes`'s output easier to read, because the name of an `async fn` is more immediately recognizable than its span. This change will also synergize with my other `-Zprint-type-sizes` PR rust-lang#122922 which prints the type of child futures being awaited.

I also deleted the comment "FIXME(eddyb) should use `def_span`." because it appears to have already been fixed by commit 67727aa.
…hewjasper

Simplify an iterator search in borrowck diag

Rather than `.into_iter().rev().find_position(...)`, this case can
simply call `.iter().rposition(...)`.
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 24, 2024
@workingjubilee
Copy link
Member Author

@bors r+ rollup=never p=9

@bors
Copy link
Contributor

bors commented Mar 24, 2024

📌 Commit cf6b7d0 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 24, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
# be missing.
ENV IS_NOT_LATEST_LLVM 1


# Ubuntu LLVM 17 does not have support for experimental targets like csky.
ENV TARGET_DOCS_SKIP_TARGETS "csky-unknown-linux-gnuabiv2,csky-unknown-linux-gnuabiv2hf"
# Using llvm-link-shared due to libffi issues -- see #34486
ENV RUST_CONFIGURE_ARGS \
      --build=x86_64-unknown-linux-gnu \
      --llvm-root=/usr/lib/llvm-17 \
---
------
 > importing cache manifest from ghcr.io/rust-lang-ci/rust-ci-cache:5b46927a3885737885686505e0660999bdbafacd668051531298dab59f6b072d8570e0be7cef7aae7a0e3395e36f49e20d9f15983edf5893e70e63b991c8e055:
------
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-17]
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-17', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
.......................

failures:

---- [mir-opt] tests/mir-opt/inline_coroutine_body.rs stdout ----
5       debug permit => (_1.0: ActionPermit<'_, T>);
6       debug ctx => (*(_1.1: &mut std::task::Context<'_>));
7       let mut _0: ();
-       let mut _2: {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
+       let mut _2: {async fn body of ActionPermit<'_, T>::perform()};
9       let mut _3: ActionPermit<'_, T>;
-       let mut _5: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
+       let mut _5: &mut {async fn body of ActionPermit<'_, T>::perform()};
11       let _6: ();
12       let mut _7: std::task::Poll<()>;
-       let mut _8: std::pin::Pin<&mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6}>;
+       let mut _8: std::pin::Pin<&mut {async fn body of ActionPermit<'_, T>::perform()}>;
14       let mut _9: &mut std::task::Context<'_>;
15       let mut _10: &mut std::task::Context<'_>;
16       scope 1 {

17           debug fut => _2;
-           let _4: std::pin::Pin<&mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6}>;
+           let _4: std::pin::Pin<&mut {async fn body of ActionPermit<'_, T>::perform()}>;
19           scope 2 {
20               debug fut => _4;
21               scope 4 {
22               }
22               }
23 +             scope 7 (inlined ActionPermit::<'_, T>::perform::{closure#0}) {
24 +                 debug _task_context => _31;
- +                 debug self => ((*(_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6})).0: ActionPermit<'_, T>);
+ +                 debug self => ((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})).0: ActionPermit<'_, T>);
26 +                 let _11: ActionPermit<'_, T>;
27 +                 let mut _12: std::future::Ready<()>;
28 +                 let mut _13: std::future::Ready<()>;
Build completed unsuccessfully in 0:14:26
43 +                 let mut _30: ();
44 +                 let mut _31: &mut std::task::Context<'_>;
45 +                 let mut _32: u32;
45 +                 let mut _32: u32;
- +                 let mut _33: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _34: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _35: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _36: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _37: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _38: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _39: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _40: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _41: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
- +                 let mut _42: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6};
+ +                 let mut _33: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _34: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _35: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _36: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _37: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _38: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _39: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _40: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _41: &mut {async fn body of ActionPermit<'_, T>::perform()};
+ +                 let mut _42: &mut {async fn body of ActionPermit<'_, T>::perform()};
56 +                 scope 8 {
- +                     debug self => (((*(_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6})) as variant#3).0: ActionPermit<'_, T>);
+ +                     debug self => (((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})) as variant#3).0: ActionPermit<'_, T>);
58 +                     let mut _15: std::future::Ready<()>;
59 +                     scope 9 {
- +                         debug __awaitee => (((*(_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6})) as variant#3).1: std::future::Ready<()>);
+ +                         debug __awaitee => (((*(_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()})) as variant#3).1: std::future::Ready<()>);
61 +                         let _26: ();
62 +                         scope 10 {

73 +             }
74           }
75           scope 3 {
75           scope 3 {
- +             scope 6 (inlined Pin::<&mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6}>::new_unchecked) {
+ +             scope 6 (inlined Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}>::new_unchecked) {
77 +                 debug pointer => _5;
79           }

95           StorageLive(_4);
96           StorageLive(_5);
96           StorageLive(_5);
97           _5 = &mut _2;
- -         _4 = Pin::<&mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6}>::new_unchecked(move _5) -> [return: bb2, unwind: bb5];
+ -         _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}>::new_unchecked(move _5) -> [return: bb2, unwind: bb5];
100 - 
101 -     bb2: {


- +         _4 = Pin::<&mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6}> { __pointer: _5 };
+ +         _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { __pointer: _5 };
103           StorageDead(_5);
104           StorageLive(_6);
105           StorageLive(_7);
108           StorageLive(_9);
108           StorageLive(_9);
109           _10 = deref_copy (_1.1: &mut std::task::Context<'_>);
110           _9 = &mut (*_10);
- -         _7 = <{async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6} as Future>::poll(move _8, move _9) -> [return: bb3, unwind: bb5];
+ -         _7 = <{async fn body of ActionPermit<'_, T>::perform()} as Future>::poll(move _8, move _9) -> [return: bb3, unwind: bb5];
112 +         StorageLive(_11);
113 +         StorageLive(_15);
114 +         StorageLive(_16);
127 +         StorageLive(_40);
128 +         StorageLive(_41);
129 +         StorageLive(_42);
129 +         StorageLive(_42);
- +         _33 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _33 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
131 +         _32 = discriminant((*_33));
132 +         switchInt(move _32) -> [0: bb5, 1: bb22, 2: bb21, 3: bb20, otherwise: bb10];

181 -         return;
182 +     bb5: {
183 +         _31 = move _9;
183 +         _31 = move _9;
- +         _34 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
- +         _35 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _34 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
+ +         _35 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
186 +         (((*_34) as variant#3).0: ActionPermit<'_, T>) = move ((*_35).0: ActionPermit<'_, T>);
187 +         StorageLive(_12);
188 +         StorageLive(_13);

200 -         drop(_2) -> [return: bb6, unwind terminate(cleanup)];
201 +     bb6: {
202 +         StorageDead(_13);
- +         _36 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _36 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
204 +         (((*_36) as variant#3).1: std::future::Ready<()>) = move _12;
205 +         goto -> bb7;

213 +         StorageLive(_19);
214 +         StorageLive(_20);
215 +         StorageLive(_21);
215 +         StorageLive(_21);
- +         _37 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _37 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
217 +         _21 = &mut (((*_37) as variant#3).1: std::future::Ready<()>);
218 +         _20 = &mut (*_21);
219 +         _19 = Pin::<&mut std::future::Ready<()>>::new_unchecked(move _20) -> [return: bb8, unwind: bb15];
255 +         StorageDead(_12);
256 +         StorageDead(_28);
257 +         StorageDead(_29);
257 +         StorageDead(_29);
- +         _38 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _38 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
259 +         discriminant((*_38)) = 3;
260 +         goto -> bb4;

270 +         StorageDead(_18);
271 +         StorageDead(_17);
272 +         StorageDead(_12);
272 +         StorageDead(_12);
- +         _39 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _39 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
274 +         drop((((*_39) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb13, unwind: bb19];
276 + 

277 +     bb13: {
277 +     bb13: {
278 +         _7 = Poll::<()>::Ready(move _30);
- +         _40 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _40 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
280 +         discriminant((*_40)) = 1;
281 +         goto -> bb4;

308 + 
308 + 
309 +     bb18 (cleanup): {
310 +         StorageDead(_12);
- +         _41 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _41 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
312 +         drop((((*_41) as variant#3).0: ActionPermit<'_, T>)) -> [return: bb19, unwind terminate(cleanup)];
314 + 


315 +     bb19 (cleanup): {
- +         _42 = deref_copy (_8.0: &mut {async fn body@$DIR/inline_coroutine_body.rs:25:28: 27:6});
+ +         _42 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
317 +         discriminant((*_42)) = 2;
318 +         goto -> bb2;

thread '[mir-opt] tests/mir-opt/inline_coroutine_body.rs' panicked at src/tools/compiletest/src/runtest.rs:4351:21:
thread '[mir-opt] tests/mir-opt/inline_coroutine_body.rs' panicked at src/tools/compiletest/src/runtest.rs:4351:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff


failures:
    [mir-opt] tests/mir-opt/inline_coroutine_body.rs

@workingjubilee workingjubilee deleted the rollup-8dq1e4i branch March 24, 2024 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.