Skip to content

Rollup of 11 pull requests #142604

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

Closed
wants to merge 29 commits into from
Closed

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Jun 17, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

bjorn3 and others added 29 commits June 3, 2025 08:55
rustc_std_internal_symbol is meant to call functions from crates where
there is no direct dependency on said crate. As they either have to be
added to symbols.o or rustc has to introduce an implicit dependency on
them to avoid linker errors. The latter is done for some things like the
panic runtime, but adding these symbols to symbols.o allows removing
those implicit dependencies.
This used to be necessary for a correct linker order, but ever since the
introduction of symbols.o adding the symbols in question to symbols.o
would work just as well. We do still add dependencies on the panic runtime
to the local crate, but not for #![needs_panic_runtime] crates.

This also removes the runtime-depends-on-needs-runtime test.
inject_dependency_if used to emit this error, but with symbols.o it is
no longer important that there is no dependency and in fact it may be
nice to have panic_abort and panic_unwind directly depend on libstd in
the future for calling std::process::abort().
You shouldn't ever need to explicitly depend on it. And we weren't
checking that the panic runtime used the correct panic strategy either.
There is already panic-unwind to enable it.
In particular, there should be no additional errors (default field
values for `union` fields are currently erroneously accepted).
more information to Display implementation for BorrowError/BorrowMutError

- The BorrowError/BorrowMutError Debug implementations do not print
anything differently from what the derived implementation does, so we
don't need it.

- This change also adds the location field of
BorrowError/BorrowMutError to the the Display output when it is
present, rewords the error message, and uses the Display trait for
outputting the error message instead of Debug.
It's actually used as a counter so update the name to reflect that.
In a PR to emit warnings on misuse of `--print native-static-libs`,
we did not consider the matter of composing parts of build systems.
If you are not directly invoking rustc, it can be difficult to know
when you will in fact compile a staticlib, so making sure everyone
uses `--print native-static-lib` correctly can be just a nuisance.

This reverts the following commits:
- f66787a
- 72a9219
- 98bb597
- c59b708

Next cycle we can reland a slightly more narrowly focused variant or one
that focuses on `--emit` instead of `--print native-static-libs`.
But in its current state, I am not sure the warning is very useful.
…sleywiser,ibraheemdev

Reduce special casing for the panic runtime

See the individual commits for more info.
Add support for repetition to `proc_macro::quote`

Progress toward: rust-lang#140238
Handle win32 separator for cygwin paths

This PR handles a issue that cygwin actually supports Win32 path, so we need to handle the Win32 prefix and separaters.

r? ``@mati865``

cc ``@jeremyd2019``

~~Not sure if I should handle the prefix like the windows target... Cygwin *does* support win32 paths directly going through the APIs, but I think it's not the recommended way.~~

Here I just use `cygwin_conv_path` because it handles both cygwin and win32 paths correctly and convert them into absolute POSIX paths.

UPDATE: Windows path prefix is handled.
Miscellaneous RefCell cleanups

- Clarify `RefCell` error messages when borrow rules are broken
- Remove `Debug` impl for `BorrowError`/`BorrowMutError` since `#derive(Debug)` provides identical functionality
- Rename `BorrowFlag` to `BorrowCounter`
…lacrum

Windows: Use anonymous pipes in Command

When setting `Stdio::pipe` on `Command` we want to create an anonymous pipe that can be used asynchronously (at least on our end). Usually we'd use [`CreatePipe`](https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe) to open anonymous pipes but unfortunately it opens pipes for synchronous access. The alternative is to use [`CreateNamedPipeW`](https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createnamedpipew) which does allow asynchronous access but that requires giving a file name to the pipe. So we currently have this awful hack where we attempt to emulate anonymous pipes using `CreateNamedPipeW` by attempting to create a unique name and looping until we find one that doesn't already exist.

The better option is to use the lower level [`NtCreateNamedPipeFile`](https://learn.microsoft.com/en-us/windows/win32/devnotes/nt-create-named-pipe-file) (which is used internally by both `CreatePipe` and `CreateNamedPipeW`). This function wasn't documented until a few years ago but now that it is it's ok for us to use it.

try-job: *msvc*
try-job: *mingw*
Reject union default field values

Fixes rust-lang#142555.

The [`default_field_values` RFC][rfc] does not specify that default field values may be used on `union`s, and it's not clear how default field values may be used with `union`s without an design extension to the RFC. So, for now, reject trying to use default field values with `union`s.

### Review notes

- The first commit adds the `union` with default field values test case to `tests/ui/structs/default-field-values/failures.rs`, where `union`s with default field values are currently accepted.
- The second commit rejects trying to supply default field values to `union` definitions.
- When `default_field_values` feature gate is disabled, we show the feature gate error when the user tries to write `union`s with default field values. When the feature gate is enabled, we reject this usage with
   > unions cannot have default field values

`@rustbot` label: +F-default_field_values

[rfc]: https://rust-lang.github.io/rfcs/3681-default-field-values.html
Handle same-crate macro for borrowck semicolon suggestion

Handles rust-lang#142543 (comment)

cc `@m-ou-se`
r? `@fmease`
Update books

## rust-lang/book

1 commits in 634724ea85ebb08a542970bf8871ac8b0f77fd15..4433c9f0cad8460bee05ede040587f8a1fa3f1de
2025-06-03 16:34:00 UTC to 2025-06-03 16:34:00 UTC

- Chapter 11 from tech review (rust-lang/book#4391)

## rust-lang/reference

10 commits in 8e0f593a30f3b56ddb0908fb7ab9249974e08738..d4c66b346f4b72d29e70390a3fa3ea7d4e064db1
2025-06-13 17:05:11 UTC to 2025-06-03 21:28:42 UTC

- Align pattern destructuring with rest of patterns documentation (rust-lang/reference#1853)
- Use extern "system" instead of "stdcall" in example (rust-lang/reference#1854)
- Mention that `thiscall` is a 32-bit calling convention (rust-lang/reference#1855)
- Add doc for keylocker target features (rust-lang/reference#1829)
- Add doc for `sha512`, `sm3` and `sm4` target features (rust-lang/reference#1830)
- Fix(typo): 'though' should be 'through' (rust-lang/reference#1850)
- intro note: make text more simple (rust-lang/reference#1844)
- nit: add missing period (rust-lang/reference#1843)
- add a warning about using `safe` on extern c-variadic functions (rust-lang/reference#1839)
- remove the `safe` keyword from a c-variadic foreign function. (rust-lang/reference#1838)

## rust-lang/rust-by-example

3 commits in 21f4e32b8b40d36453fae16ec07ad4b857c445b6..9baa9e863116cb9524a177d5a5c475baac18928a
2025-06-11 13:00:27 UTC to 2025-06-10 12:43:14 UTC

- introduce new `@media` query to set a higher content width on ultra wide screens (rust-lang/rust-by-example#1937)
- Fix syntax highligting (rust-lang/rust-by-example#1935)
- fix(rust-lang#1656): update doc tests to use `playground` as the crate name (rust-lang/rust-by-example#1934)
…t-field-def, r=fmease

Fold unnecessary `visit_struct_field_def` in AstValidator

We don't need it anymore since we removed the `_: struct { }` syntax experiment.
…39, r=ChrisDenton

Revert overeager warning for misuse of `--print native-static-libs`

In a PR to emit warnings on misuse of `--print native-static-libs`, we did not consider the matter of composing parts of build systems. If you are not directly invoking rustc, it can be difficult to know when you will in fact compile a staticlib, so making sure uses `--print native-static-lib` correctly can be just a nuisance.

Next cycle we can reland a slightly more narrowly focused variant or one that focuses on `--emit` instead of `--print native-static-libs`. But in its current state, I am not sure the warning is very useful.
…workingjubilee

Set elf e_flags on ppc64 targets according to abi

(This PR contains the non user-facing changes of rust-lang#142321)

Fixes rust-lang#85589 by making sure that ld.lld errors out instead of generating a broken binary.

Basically the problem is that ld.lld assumes that all ppc64 object files with e_flags=0 are object files which use the ELFv2 ABI (this here is the check https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/PPC64.cpp#L639).
This pull request sets the correct e_flags to indicate the used ABI so ld.lld errors out when encountering ELFv1 ABI files instead of generating a broken binary.

For example compare code generation for this program (file name ``min.rs``):
```rust
#![feature(no_core, lang_items, repr_simd)]
#![crate_type = "bin"]
#![no_core]
#![no_main]

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}
#[lang = "panic_cannot_unwind"]
pub fn panic() -> ! {
    loop {}
}

pub fn my_rad_unmangled_function() {
    loop {}
}

pub fn my_rad_function() {
    loop {}
}

#[no_mangle]
pub fn _start() {
    my_rad_unmangled_function();
    my_rad_function();
}
```
Compile with ``rustc --target=powerpc64-unknown-linux-gnu -C linker=ld.lld -C relocation-model=static min.rs``

Before change:
```
$ llvm-objdump -d min
Disassembly of section .text:
000000001001030c <.text>:
		...
10010334: 7c 08 02 a6  	mflr 0
10010338: f8 21 ff 91  	stdu 1, -112(1)
1001033c: f8 01 00 80  	std 0, 128(1)
10010340: 48 02 00 39  	bl 0x10030378 <_ZN3min25my_rad_unmangled_function17h7471c49af58039f5E>
10010344: 60 00 00 00  	nop
10010348: 48 02 00 49  	bl 0x10030390 <_ZN3min15my_rad_function17h37112b8fd1008c9bE>
1001034c: 60 00 00 00  	nop
		...
```
The branch instructions ``bl 0x10030378`` and ``bl 0x10030390`` are jumping into the ``.opd`` section which is data. That is a broken binary (because fixing those branches is the task of the linker).

After change:
```
error: linking with `ld.lld` failed: exit status: 1
  |
  = note:  "ld.lld" "/tmp/rustcNYKZCS/symbols.o" "<1 object files omitted>" "--as-needed" "-L" "/tmp/rustcNYKZCS/raw-dylibs" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "<sysroot>/lib/rustlib/powerpc64-unknown-linux-gnu/lib" "-o" "min" "--gc-sections" "-z" "relro" "-z" "now"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: ld.lld: error: /tmp/rustcNYKZCS/symbols.o: ABI version 1 is not supported
```
Which is correct because ld.lld doesn't support ELFv1 ABI.
@rustbot rustbot added the O-windows Operating system: Windows label Jun 17, 2025
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler 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 Jun 17, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Jun 17, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Jun 17, 2025

📌 Commit 5d62529 has been approved by jhpratt

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 Jun 17, 2025
@bors
Copy link
Collaborator

bors commented Jun 17, 2025

⌛ Testing commit 5d62529 with merge 896d9e4...

bors added a commit that referenced this pull request Jun 17, 2025
Rollup of 11 pull requests

Successful merges:

 - #140809 (Reduce special casing for the panic runtime)
 - #141608 (Add support for repetition to `proc_macro::quote`)
 - #141864 (Handle win32 separator for cygwin paths)
 - #142216 (Miscellaneous RefCell cleanups)
 - #142517 (Windows: Use anonymous pipes in Command)
 - #142570 (Reject union default field values)
 - #142584 (Handle same-crate macro for borrowck semicolon suggestion)
 - #142585 (Update books)
 - #142586 (Fold unnecessary `visit_struct_field_def` in AstValidator)
 - #142595 (Revert overeager warning for misuse of `--print native-static-libs`)
 - #142598 (Set elf e_flags on ppc64 targets according to abi)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job dist-apple-various failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[TIMING] core::build_steps::doc::Standalone { compiler: Compiler { stage: 2, host: x86_64-apple-darwin, forced_compiler: false }, target: aarch64-apple-ios-macabi } -- 1.040
##[group]Documenting stage2 standalone (x86_64-apple-darwin -> x86_64-apple-ios-macabi)
##[endgroup]
[TIMING] core::build_steps::doc::Standalone { compiler: Compiler { stage: 2, host: x86_64-apple-darwin, forced_compiler: false }, target: x86_64-apple-ios-macabi } -- 0.801
dyld[34425]: Library not loaded: @rpath/librustc_driver-c19e04a4f35c0fbf.dylib
  Referenced from: <E6619344-823C-3E70-A924-1CE8B9D37B8A> /Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/rustc-main
  Reason: tried: '/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/../lib/librustc_driver-c19e04a4f35c0fbf.dylib' (no such file), '/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage1-rustc/x86_64-apple-darwin/release/../lib/librustc_driver-c19e04a4f35c0fbf.dylib' (no such file)
Command "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "--target" "aarch64-apple-ios" "--print=deployment-target" (failure_mode=Exit) has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 1:21:55
  local time: Tue Jun 17 03:08:12 UTC 2025
  network time: Tue, 17 Jun 2025 03:08:13 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@bors
Copy link
Collaborator

bors commented Jun 17, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 17, 2025
@jhpratt jhpratt closed this Jun 17, 2025
@jhpratt jhpratt deleted the rollup-77fsgte branch June 17, 2025 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler 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.