Skip to content

Add terminal integration via ANSI OSC 9;4 sequences #14615

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

Gordon01
Copy link
Contributor

@Gordon01 Gordon01 commented Sep 29, 2024

What does this PR try to resolve?

A few terminal emulators support progress output to Windows taskbar. winget uses this to show install progress.

Notably, Windows Terminal recently (2020) added support for ANSI codes specified in ConEmu (another terminal emulator for Windows) documentation. Also, in "Learn Windows".

I've found the previous attempt to add this feature: #11436

As per @weihanglo's request, I've added the config option to enable/disable this feature. It's enabled on supported terminal emulators.

Fixes #11432

FCP: #14615 (comment)

How should we test and review this PR?

Run cargo build in Windows Terminal with configuration option term.progress.taskbar set to true.

Not sure

  • Should all the code be #[cfg(windows)]? Probably no, because the feature is also usable in WSL.

Solved by introducing heuristic based on environment variable set by terminal

  • If Ctrl+C is pressed, a progressbar will stay in a last state forever (shown in the ConEmu video). winget is also behaves like alike. I've experimented with ctrl_c handler and it's totally fixable.
  • Enabled is a sensible default for WSL because it works on linux builds in Windows Terminal too

Solved by introducing heuristic based on environment variable set by terminal

  • Downloading stage may produce unpleasant blinking due to a rapid 0-100 changes

Solved by not displaying bar when downloading and using indeterminate state in other cases so amination don't reset

TLDR

  • An term.progress.taskbar option with bool type is added
  • On Windows Terminal and ConEmu is enabled by default
  • If enabled reports build progress to taskbar icon and/or tab header

Videos

Windows.PowerShell.2024-09-29.23-21-21.mp4
cmd.2024-09-29.23-36-25.mp4

@rustbot
Copy link
Collaborator

rustbot commented Sep 29, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-configuration Area: cargo config files and env vars A-console-output Area: Terminal output, colors, progress bar, etc. A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 29, 2024
@epage epage added the T-cargo Team: Cargo label Sep 30, 2024
@weihanglo
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 15, 2024
@Gordon01
Copy link
Contributor Author

Hello, Ed, thank you for the review and sorry for the late feedback. It's been a lot of work lately.

@epage
Copy link
Contributor

epage commented Nov 18, 2024

Hello, Ed, thank you for the review and sorry for the late feedback. It's been a lot of work lately.

Understandable!

@Gordon01 Gordon01 force-pushed the taskbar_progress branch 4 times, most recently from 5ff7484 to 584ee00 Compare November 21, 2024 19:28
@rustbot rustbot added the A-build-execution Area: anything dealing with executing the compiler label Nov 21, 2024
@epage
Copy link
Contributor

epage commented Nov 21, 2024

This is looking really great and making me jealous that my terminal doesn't support it!

@Gordon01 Gordon01 force-pushed the taskbar_progress branch 2 times, most recently from 10e457d to c6d0d63 Compare November 23, 2024 08:45
@Gordon01 Gordon01 changed the title Taskbar progress reporting via ANSI codes Add terminal integration via ANSI OSC 9;4 sequences Mar 9, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 10, 2025
### What does this PR try to resolve?

The config section `term.progress` contains a collection of options
(currently only `when` and `width`). If only `width` is set, Cargo fails
with the error: "missing field `when`." This behavior may be surprising
and inconvenient for users who want to set the
`CARGO_TERM_PROGRESS_WIDTH` environment variable.

### How should we test and review this PR?

The relevant test, `bad_progress_config_missing_when`, has been replaced
with `default_progress_is_auto`.

#14615

From
#14615 (comment)

> I don't recall any particular decisions made regarding
bad_progress_config_missing_when. I personally would not object to
changing that to allow it to pass. I can't think of a reason it would be
required to specify when with width.
@kovidgoyal
Copy link

Thank you for driving this!

I use Kitty so may gain nothing, but still a great feature!

kitty displays OSC 9 progress percentage in tab titles as of version 0.39, see https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.tab_title_template

@Gordon01
Copy link
Contributor Author

Thank you for driving this!
I use Kitty so may gain nothing, but still a great feature!

kitty displays OSC 9 progress percentage in tab titles as of version 0.39, see https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.tab_title_template

Can you please advice on how is the best to detect kitty?

@kovidgoyal
Copy link

Thank you for driving this!
I use Kitty so may gain nothing, but still a great feature!

kitty displays OSC 9 progress percentage in tab titles as of version 0.39, see https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.tab_title_template

Can you please advice on how is the best to detect kitty?

Depends on how robust you want to be. The simplest is checking the TERM env var, the most robust is using the XTVERSION escape code combined with a DA1 escape code to avoid timeouts.

@epage
Copy link
Contributor

epage commented Mar 10, 2025

So TERM=xterm-kitty detects kitty. However, we should use version detection with kitty because of kovidgoyal/kitty#8011

I'm not seeing any way to do version detection for kitty besides XTVERSION and, due to my lack of experience with those call/response escape codes, I'm a bit cautious about what all gotchas there might be.

@epage
Copy link
Contributor

epage commented Mar 10, 2025

@rfcbot resolved config-name-part-2

@rfcbot rfcbot added final-comment-period FCP — a period for last comments before action is taken and removed proposed-final-comment-period An FCP proposal has started, but not yet signed off. labels Mar 10, 2025
@rfcbot
Copy link
Collaborator

rfcbot commented Mar 10, 2025

🔔 This is now entering its final comment period, as per the review above. 🔔

@epage
Copy link
Contributor

epage commented Mar 10, 2025

With the cargo team having had several months to give input, this has been discussed multiple times in meetings, and all check boxes are marked, I figure we don't need to wait for the full 10 day waiting period. That can help with getting wider input which is more important for more wide impacting changes than things like this which is more niche.

We also don't have to wait until every terminal is supported but future PRs can handle those.

@epage epage added this pull request to the merge queue Mar 10, 2025
Merged via the queue into rust-lang:master with commit 340d123 Mar 10, 2025
21 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 14, 2025
Update cargo

15 commits in ab1463d632528e39daf35f263e10c14cbe590ce8..6cf8267012570f63d6b86e85a2ae5627de52df9e
2025-03-08 01:45:05 +0000 to 2025-03-14 15:25:36 +0000
- feat(package): add --exclude-lockfile flag (rust-lang/cargo#15234)
- Redox OS is part of the unix family (rust-lang/cargo#15307)
- docs(ref): Mention `x.y.*` as a kind of version requirement to avoid. (rust-lang/cargo#15310)
- fix(run): Disambiguate bins from different packages that share a name (rust-lang/cargo#15298)
- cargo vendor: Add context which workspace failed to resolve (rust-lang/cargo#15297)
- docs(ref): Note that target-edition is deprecated (rust-lang/cargo#15292)
- refactor(toml): Centralize target descriptions (rust-lang/cargo#15291)
- docs(refs): Add `unsafe` to `extern` while using build scripts in Cargo Book (rust-lang/cargo#15294)
- Replace unmaintained humantime crate with jiff (rust-lang/cargo#15290)
- Add terminal integration via ANSI OSC 9;4 sequences (rust-lang/cargo#14615)
- feat: add completions for add --path (rust-lang/cargo#15288)
- Allow `term.progress.when` to default (rust-lang/cargo#15287)
- docs: spelling and grammar fixes (rust-lang/cargo#15284)
- chore(deps): update cargo-semver-checks to v0.40.0 (rust-lang/cargo#15282)
- Typo fixes (rust-lang/cargo#15280)

r? ghost
@rustbot rustbot added this to the 1.87.0 milestone Mar 15, 2025
@rfcbot rfcbot added finished-final-comment-period FCP complete to-announce and removed final-comment-period FCP — a period for last comments before action is taken labels Mar 20, 2025
@Gordon01
Copy link
Contributor Author

Hello, Сargo team!
It looks like we're not encountering any issues with this feature.
Thank you so much for your support and help - I learned a lot while working on this PR, and I'm really impressed by your passion for high-quality software. No wonder you're the ones making Rust!

@epage on Dec 9, 2024

Ideally I see us breaking this out into a crate as some point

I would also love to break this feature out into a separate crate for reusability in other projects.
Can I create a new crate within Cargo’s workspace, following these contribution guidelines?

@epage
Copy link
Contributor

epage commented Apr 28, 2025

I would also love to break this feature out into a separate crate for reusability in other projects.
Can I create a new crate within Cargo’s workspace, following these contribution guidelines?

There is a high bar for crates to be opened by Cargo. I'd be fine having such a crate in the rust-cli org. I've been trying to decide whether it'd be appropriate to have in anstyle repo or not (along with hyperlink helpers)

@Gordon01
Copy link
Contributor Author

I've been trying to decide whether it'd be appropriate to have in anstyle repo or not (along with hyperlink helpers)

anstyle looks great! The existing anstyle-query crate would be perfect for supports_term_integration() and supports_hyperlinks().

For Progress and Hyperlink and their Display impls:

  • The main anstyle crate (which already handles styles)
  • A new dedicated crate like anstyle-osc

Would you like me to open an issue in the anstyle repo?

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 19, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://github.com/rust-lang/rust) | minor | `1.86.0` -> `1.87.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.87.0`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1870-2025-05-15)

[Compare Source](rust-lang/rust@1.86.0...1.87.0)

\==========================

<a id="1.87.0-Language"></a>

## Language

-   [Stabilize `asm_goto` feature](rust-lang/rust#133870)
-   [Allow parsing open beginning ranges (`..EXPR`) after unary operators `!`, `-`, and `*`](rust-lang/rust#134900).
-   [Don't require method impls for methods with `Self: Sized` bounds in `impl`s for unsized types](rust-lang/rust#135480)
-   [Stabilize `feature(precise_capturing_in_traits)` allowing `use<...>` bounds on return position `impl Trait` in `trait`s](rust-lang/rust#138128)

<a id="1.87.0-Compiler"></a>

## Compiler

-   [x86: make SSE2 required for i686 targets and use it to pass SIMD types](rust-lang/rust#135408)

<a id="1.87.0-Platform-Support"></a>

## Platform Support

-   [Remove `i586-pc-windows-msvc` target](rust-lang/rust#137957)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html

<a id="1.87.0-Libraries"></a>

## Libraries

-   [Stabilize the anonymous pipe API](rust-lang/rust#127154)
-   [Add support for unbounded left/right shift operations](rust-lang/rust#129375)
-   [Print pointer metadata in `Debug` impl of raw pointers](rust-lang/rust#135080)
-   [`Vec::with_capacity` guarantees it allocates with the amount requested, even if `Vec::capacity` returns a different number.](rust-lang/rust#135933)
-   Most `std::arch` intrinsics which don't take pointer arguments can now be called from safe code if the caller has the appropriate target features already enabled (rust-lang/stdarch#1714, rust-lang/stdarch#1716, rust-lang/stdarch#1717)
-   [Undeprecate `env::home_dir`](rust-lang/rust#137327)
-   [Denote `ControlFlow` as `#[must_use]`](rust-lang/rust#137449)
-   [Macros such as `assert_eq!` and `vec!` now support `const {...}` expressions](rust-lang/rust#138162)

<a id="1.87.0-Stabilized-APIs"></a>

## Stabilized APIs

-   [`Vec::extract_if`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.extract_if)
-   [`vec::ExtractIf`](https://doc.rust-lang.org/stable/std/vec/struct.ExtractIf.html)
-   [`LinkedList::extract_if`](https://doc.rust-lang.org/stable/std/collections/struct.LinkedList.html#method.extract_if)
-   [`linked_list::ExtractIf`](https://doc.rust-lang.org/stable/std/collections/linked_list/struct.ExtractIf.html)
-   [`<[T]>::split_off`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off)
-   [`<[T]>::split_off_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_mut)
-   [`<[T]>::split_off_first`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_first)
-   [`<[T]>::split_off_first_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_first_mut)
-   [`<[T]>::split_off_last`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_last)
-   [`<[T]>::split_off_last_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_last_mut)
-   [`String::extend_from_within`](https://doc.rust-lang.org/stable/alloc/string/struct.String.html#method.extend_from_within)
-   [`os_str::Display`](https://doc.rust-lang.org/stable/std/ffi/os_str/struct.Display.html)
-   [`OsString::display`](https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.display)
-   [`OsStr::display`](https://doc.rust-lang.org/stable/std/ffi/struct.OsStr.html#method.display)
-   [`io::pipe`](https://doc.rust-lang.org/stable/std/io/fn.pipe.html)
-   [`io::PipeReader`](https://doc.rust-lang.org/stable/std/io/struct.PipeReader.html)
-   [`io::PipeWriter`](https://doc.rust-lang.org/stable/std/io/struct.PipeWriter.html)
-   [`impl From<PipeReader> for OwnedHandle`](https://doc.rust-lang.org/stable/std/os/windows/io/struct.OwnedHandle.html#impl-From%3CPipeReader%3E-for-OwnedHandle)
-   [`impl From<PipeWriter> for OwnedHandle`](https://doc.rust-lang.org/stable/std/os/windows/io/struct.OwnedHandle.html#impl-From%3CPipeWriter%3E-for-OwnedHandle)
-   [`impl From<PipeReader> for Stdio`](https://doc.rust-lang.org/stable/std/process/struct.Stdio.html)
-   [`impl From<PipeWriter> for Stdio`](https://doc.rust-lang.org/stable/std/process/struct.Stdio.html#impl-From%3CPipeWriter%3E-for-Stdio)
-   [`impl From<PipeReader> for OwnedFd`](https://doc.rust-lang.org/stable/std/os/fd/struct.OwnedFd.html#impl-From%3CPipeReader%3E-for-OwnedFd)
-   [`impl From<PipeWriter> for OwnedFd`](https://doc.rust-lang.org/stable/std/os/fd/struct.OwnedFd.html#impl-From%3CPipeWriter%3E-for-OwnedFd)
-   [`Box<MaybeUninit<T>>::write`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.write)
-   [`impl TryFrom<Vec<u8>> for String`](https://doc.rust-lang.org/stable/std/string/struct.String.html#impl-TryFrom%3CVec%3Cu8%3E%3E-for-String)
-   [`<*const T>::offset_from_unsigned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.offset_from_unsigned)
-   [`<*const T>::byte_offset_from_unsigned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.byte_offset_from_unsigned)
-   [`<*mut T>::offset_from_unsigned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.offset_from_unsigned-1)
-   [`<*mut T>::byte_offset_from_unsigned`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.byte_offset_from_unsigned-1)
-   [`NonNull::offset_from_unsigned`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.offset_from_unsigned)
-   [`NonNull::byte_offset_from_unsigned`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.byte_offset_from_unsigned)
-   [`<uN>::cast_signed`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.cast_signed)
-   [`NonZero::<uN>::cast_signed`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.cast_signed-5).
-   [`<iN>::cast_unsigned`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.cast_unsigned).
-   [`NonZero::<iN>::cast_unsigned`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.cast_unsigned-5).
-   [`<uN>::is_multiple_of`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.is_multiple_of)
-   [`<uN>::unbounded_shl`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unbounded_shl)
-   [`<uN>::unbounded_shr`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unbounded_shr)
-   [`<iN>::unbounded_shl`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unbounded_shl)
-   [`<iN>::unbounded_shr`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unbounded_shr)
-   [`<iN>::midpoint`](https://doc.rust-lang.org/stable/std/primitive.isize.html#method.midpoint)
-   [`<str>::from_utf8`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8)
-   [`<str>::from_utf8_mut`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8\_mut)
-   [`<str>::from_utf8_unchecked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8\_unchecked)
-   [`<str>::from_utf8_unchecked_mut`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8\_unchecked_mut)

These previously stable APIs are now stable in const contexts:

-   [`core::str::from_utf8_mut`](https://doc.rust-lang.org/stable/std/str/fn.from_utf8\_mut.html)
-   [`<[T]>::copy_from_slice`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.copy_from_slice)
-   [`SocketAddr::set_ip`](https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.set_ip)
-   [`SocketAddr::set_port`](https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.set_port),
-   [`SocketAddrV4::set_ip`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV4.html#method.set_ip)
-   [`SocketAddrV4::set_port`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV4.html#method.set_port),
-   [`SocketAddrV6::set_ip`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_ip)
-   [`SocketAddrV6::set_port`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_port)
-   [`SocketAddrV6::set_flowinfo`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_flowinfo)
-   [`SocketAddrV6::set_scope_id`](https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_scope_id)
-   [`char::is_digit`](https://doc.rust-lang.org/stable/std/primitive.char.html#method.is_digit)
-   [`char::is_whitespace`](https://doc.rust-lang.org/stable/std/primitive.char.html#method.is_whitespace)
-   [`<[[T; N]]>::as_flattened`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_flattened)
-   [`<[[T; N]]>::as_flattened_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_flattened_mut)
-   [`String::into_bytes`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.into_bytes)
-   [`String::as_str`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_str)
-   [`String::capacity`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.capacity)
-   [`String::as_bytes`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_bytes)
-   [`String::len`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.len)
-   [`String::is_empty`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.is_empty)
-   [`String::as_mut_str`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_mut_str)
-   [`String::as_mut_vec`](https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_mut_vec)
-   [`Vec::as_ptr`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_ptr)
-   [`Vec::as_slice`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_slice)
-   [`Vec::capacity`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.capacity)
-   [`Vec::len`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.len)
-   [`Vec::is_empty`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.is_empty)
-   [`Vec::as_mut_slice`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_mut_slice)
-   [`Vec::as_mut_ptr`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_mut_ptr)

<a id="1.87.0-Cargo"></a>

## Cargo

-   [Add terminal integration via ANSI OSC 9;4 sequences](rust-lang/cargo#14615)
-   [chore: bump openssl to v3](rust-lang/cargo#15232)
-   [feat(package): add --exclude-lockfile flag](rust-lang/cargo#15234)

<a id="1.87.0-Compatibility-Notes"></a>

## Compatibility Notes

-   [Rust now raises an error for macro invocations inside the `#![crate_name]` attribute](rust-lang/rust#127581)
-   [Unstable fields are now always considered to be inhabited](rust-lang/rust#133889)
-   [Macro arguments of unary operators followed by open beginning ranges may now be matched differently](rust-lang/rust#134900)
-   [Make `Debug` impl of raw pointers print metadata if present](rust-lang/rust#135080)
-   [Warn against function pointers using unsupported ABI strings in dependencies](rust-lang/rust#135767)
-   [Associated types on `dyn` types are no longer deduplicated](rust-lang/rust#136458)
-   [Forbid attributes on `..` inside of struct patterns (`let Struct { #[attribute] .. }) =`](rust-lang/rust#136490)
-   [Make `ptr_cast_add_auto_to_object` lint into hard error](rust-lang/rust#136764)
-   Many `std::arch` intrinsics are now safe to call in some contexts, there may now be new `unused_unsafe` warnings in existing codebases.
-   [Limit `width` and `precision` formatting options to 16 bits on all targets](rust-lang/rust#136932)
-   [Turn order dependent trait objects future incompat warning into a hard error](rust-lang/rust#136968)
-   [Denote `ControlFlow` as `#[must_use]`](rust-lang/rust#137449)
-   [Windows: The standard library no longer links `advapi32`, except on win7.](rust-lang/rust#138233) Code such as C libraries that were relying on this assumption may need to explicitly link advapi32.
-   [Proc macros can no longer observe expanded `cfg(true)` attributes.](rust-lang/rust#138844)
-   [Start changing the internal representation of pasted tokens](rust-lang/rust#124141). Certain invalid declarative macros that were previously accepted in obscure circumstances are now correctly rejected by the compiler. Use of a `tt` fragment specifier can often fix these macros.
-   [Don't allow flattened format_args in const.](rust-lang/rust#139624)

<a id="1.87.0-Internal-Changes"></a>

## Internal Changes

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

-   [Update to LLVM 20](rust-lang/rust#135763)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC4xMS4xOSIsInVwZGF0ZWRJblZlciI6IjQwLjExLjE5IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request May 20, 2025
Pkgsrc changes:
 * patches adjustments to adapt to upstream changes & new versions
   of included crates
 * associated checksums++

Upstream changes relative to 1.86.0:

Version 1.87.0 (2025-05-15)
==========================

Language
--------
- [Stabilize `asm_goto` feature]
  (rust-lang/rust#133870)
- [Allow parsing open beginning ranges (`..EXPR`) after unary
  operators `!`, `~`, `-`, and `*`}]
  (rust-lang/rust#134900).
- [Don't require method impls for methods with `Self: Sized` bounds
  in `impl`s for unsized types]
  (rust-lang/rust#135480)
- [Stabilize `feature(precise_capturing_in_traits)` allowing
  `use<...>` bounds on return position `impl Trait` in `trait`s]
  (rust-lang/rust#138128)

Compiler
--------
- [x86: make SSE2 required for i686 targets and use it to pass SIMD types]
  (rust-lang/rust#135408)

Platform Support
----------------
- [Remove `i586-pc-windows-msvc` target]
  (rust-lang/rust#137957)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html

Libraries
---------
- [Stabilize the anonymous pipe API]
  (rust-lang/rust#127154)
- [Add support for unbounded left/right shift operations]
  (rust-lang/rust#129375)
- [Print pointer metadata in `Debug` impl of raw pointers]
  (rust-lang/rust#135080)
- [`Vec::with_capacity` guarantees it allocates with the amount
  requested, even if `Vec::capacity` returns a different number.]
  (rust-lang/rust#135933)
- Most `std::arch` intrinsics which don't take pointer arguments
  can now be called from safe code if the caller has the appropriate
  target features already enabled
  (rust-lang/stdarch#1714,
  rust-lang/stdarch#1716,
  rust-lang/stdarch#1717)
- [Undeprecate `env::home_dir`]
  (rust-lang/rust#137327)
- [Denote `ControlFlow` as `#[must_use]`]
  (rust-lang/rust#137449)
- [Macros such as `assert_eq!` and `vec!` now support `const {...}` expressions]
  (rust-lang/rust#138162)

Stabilized APIs
---------------

- [`Vec::extract_if`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.extract_if)
- [`vec::ExtractIf`]
  (https://doc.rust-lang.org/stable/std/vec/struct.ExtractIf.html)
- [`LinkedList::extract_if`]
  (https://doc.rust-lang.org/stable/std/collections/struct.LinkedList.html#method.extract_if)
- [`linked_list::ExtractIf`]
  (https://doc.rust-lang.org/stable/std/collections/linked_list/struct.ExtractIf.html)
- [`<[T]>::split_off`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off)
- [`<[T]>::split_off_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_mut)
- [`<[T]>::split_off_first`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_first)
- [`<[T]>::split_off_first_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_first_mut)
- [`<[T]>::split_off_last`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_last)
- [`<[T]>::split_off_last_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_off_last_mut)
- [`String::extend_from_within`]
  (https://doc.rust-lang.org/stable/alloc/string/struct.String.html#method.extend_from_within)
- [`os_str::Display`]
  (https://doc.rust-lang.org/stable/std/ffi/os_str/struct.Display.html)
- [`OsString::display`]
  (https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.display)
- [`OsStr::display`]
  (https://doc.rust-lang.org/stable/std/ffi/struct.OsStr.html#method.display)
- [`io::pipe`]
  (https://doc.rust-lang.org/stable/std/io/fn.pipe.html)
- [`io::PipeReader`]
  (https://doc.rust-lang.org/stable/std/io/struct.PipeReader.html)
- [`io::PipeWriter`]
  (https://doc.rust-lang.org/stable/std/io/struct.PipeWriter.html)
- [`impl From<PipeReader> for OwnedHandle`]
  (https://doc.rust-lang.org/stable/std/os/windows/io/struct.OwnedHandle.html#impl-From%3CPipeReader%3E-for-OwnedHandle)
- [`impl From<PipeWriter> for OwnedHandle`]
  (https://doc.rust-lang.org/stable/std/os/windows/io/struct.OwnedHandle.html#impl-From%3CPipeWriter%3E-for-OwnedHandle)
- [`impl From<PipeReader> for Stdio`]
  (https://doc.rust-lang.org/stable/std/process/struct.Stdio.html)
- [`impl From<PipeWriter> for Stdio`]
  (https://doc.rust-lang.org/stable/std/process/struct.Stdio.html#impl-From%3CPipeWriter%3E-for-Stdio)
- [`impl From<PipeReader> for OwnedFd`]
  (https://doc.rust-lang.org/stable/std/os/fd/struct.OwnedFd.html#impl-From%3CPipeReader%3E-for-OwnedFd)
- [`impl From<PipeWriter> for OwnedFd`]
  (https://doc.rust-lang.org/stable/std/os/fd/struct.OwnedFd.html#impl-From%3CPipeWriter%3E-for-OwnedFd)
- [`Box<MaybeUninit<T>>::write`]
  (https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.write)
- [`impl TryFrom<Vec<u8>> for String`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#impl-TryFrom%3CVec%3Cu8%3E%3E-for-String)
- [`<*const T>::offset_from_unsigned`]
  (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.offset_from_unsigned)
- [`<*const T>::byte_offset_from_unsigned`]
  (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.byte_offset_from_unsigned)
- [`<*mut T>::offset_from_unsigned`]
  (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.offset_from_unsigned-1)
- [`<*mut T>::byte_offset_from_unsigned`]
  (https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.byte_offset_from_unsigned-1)
- [`NonNull::offset_from_unsigned`]
  (https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.offset_from_unsigned)
- [`NonNull::byte_offset_from_unsigned`]
  (https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.byte_offset_from_unsigned)
- [`<uN>::cast_signed`]
  (https://doc.rust-lang.org/stable/std/primitive.usize.html#method.cast_signed)
- [`NonZero::<uN>::cast_signed`]
  (https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.cast_signed-5).
- [`<iN>::cast_unsigned`]
  (https://doc.rust-lang.org/stable/std/primitive.isize.html#method.cast_unsigned).
- [`NonZero::<iN>::cast_unsigned`]
  (https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.cast_unsigned-5).
- [`<uN>::is_multiple_of`]
  (https://doc.rust-lang.org/stable/std/primitive.usize.html#method.is_multiple_of)
- [`<uN>::unbounded_shl`]
  (https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unbounded_shl)
- [`<uN>::unbounded_shr`]
  (https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unbounded_shr)
- [`<iN>::unbounded_shl`]
  (https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unbounded_shl)
- [`<iN>::unbounded_shr`]
  (https://doc.rust-lang.org/stable/std/primitive.isize.html#method.unbounded_shr)
- [`<iN>::midpoint`]
  (https://doc.rust-lang.org/stable/std/primitive.isize.html#method.midpoint)
- [`<str>::from_utf8`]
  (https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8)
- [`<str>::from_utf8_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8_mut)
- [`<str>::from_utf8_unchecked`]
  (https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8_unchecked)
- [`<str>::from_utf8_unchecked_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.str.html#method.from_utf8_unchecked_mut)

These previously stable APIs are now stable in const contexts:

- [`core::str::from_utf8_mut`]
  (https://doc.rust-lang.org/stable/std/str/fn.from_utf8_mut.html)
- [`<[T]>::copy_from_slice`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.copy_from_slice)
- [`SocketAddr::set_ip`]
  (https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.set_ip)
- [`SocketAddr::set_port`]
  (https://doc.rust-lang.org/stable/std/net/enum.SocketAddr.html#method.set_port),
- [`SocketAddrV4::set_ip`]
  (https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV4.html#method.set_ip)
- [`SocketAddrV4::set_port`]
  (https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV4.html#method.set_port),
- [`SocketAddrV6::set_ip`]
  (https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_ip)
- [`SocketAddrV6::set_port`]
  (https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_port)
- [`SocketAddrV6::set_flowinfo`]
  (https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_flowinfo)
- [`SocketAddrV6::set_scope_id`]
  (https://doc.rust-lang.org/stable/std/net/struct.SocketAddrV6.html#method.set_scope_id)
- [`char::is_digit`]
  (https://doc.rust-lang.org/stable/std/primitive.char.html#method.is_digit)
- [`char::is_whitespace`]
  (https://doc.rust-lang.org/stable/std/primitive.char.html#method.is_whitespace)
- [`<[[T; N]]>::as_flattened`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_flattened)
- [`<[[T; N]]>::as_flattened_mut`]
  (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_flattened_mut)
- [`String::into_bytes`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.into_bytes)
- [`String::as_str`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_str)
- [`String::capacity`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.capacity)
- [`String::as_bytes`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_bytes)
- [`String::len`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.len)
- [`String::is_empty`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.is_empty)
- [`String::as_mut_str`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_mut_str)
- [`String::as_mut_vec`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.as_mut_vec)
- [`Vec::as_ptr`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_ptr)
- [`Vec::as_slice`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_slice)
- [`Vec::capacity`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.capacity)
- [`Vec::len`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.len)
- [`Vec::is_empty`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.is_empty)
- [`Vec::as_mut_slice`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_mut_slice)
- [`Vec::as_mut_ptr`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.as_mut_ptr)

Cargo
-----
- [Add terminal integration via ANSI OSC 9;4 sequences]
  (rust-lang/cargo#14615)
- [chore: bump openssl to v3]
  (rust-lang/cargo#15232)
- [feat(package): add --exclude-lockfile flag]
  (rust-lang/cargo#15234)

Compatibility Notes
-------------------
- [Rust now raises an error for macro invocations inside the
  `#![crate_name]` attribute]
  (rust-lang/rust#127581)
- [Unstable fields are now always considered to be inhabited]
  (rust-lang/rust#133889)
- [Macro arguments of unary operators followed by open beginning
  ranges may now be matched differently]
  (rust-lang/rust#134900)
- [Make `Debug` impl of raw pointers print metadata if present]
  (rust-lang/rust#135080)
- [Warn against function pointers using unsupported ABI strings in dependencies]
  (rust-lang/rust#135767)
- [Associated types on `dyn` types are no longer deduplicated]
  (rust-lang/rust#136458)
- [Forbid attributes on `..` inside of struct patterns (`let Struct
  { #[attribute] .. }) =`]
  (rust-lang/rust#136490)
- [Make `ptr_cast_add_auto_to_object` lint into hard error]
  (rust-lang/rust#136764)
- Many `std::arch` intrinsics are now safe to call in some contexts,
  there may now be new `unused_unsafe` warnings in existing codebases.
- [Limit `width` and `precision` formatting options to 16 bits on all targets]
  (rust-lang/rust#136932)
- [Turn order dependent trait objects future incompat warning into a hard error]
  (rust-lang/rust#136968)
- [Denote `ControlFlow` as `#[must_use]`]
  (rust-lang/rust#137449)
- [Windows: The standard library no longer links `advapi32`, except
  on win7.] (rust-lang/rust#138233)
  Code such as C libraries that were relying on this assumption
  may need to explicitly link advapi32.
- [Proc macros can no longer observe expanded `cfg
  (true)` attributes.](rust-lang/rust#138844)
- [Start changing the internal representation of pasted tokens]
  (rust-lang/rust#124141). Certain invalid
  declarative macros that were previously accepted in obscure
  circumstances are now correctly rejected by the compiler. Use of
  a `tt` fragment specifier can often fix these macros.
- [Don't allow flattened format_args in const.]
  (rust-lang/rust#139624)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they
represent significant improvements to the performance or internals
of rustc and related tools.

- [Update to LLVM 20]
  (rust-lang/rust#135763)
@epage
Copy link
Contributor

epage commented May 21, 2025

Would you like me to open an issue in the anstyle repo?

An issue would be a good place to start.

anstyle has a fairly specific role, so I'm guessing we won't add features to that crate but we could add a new crate for some of this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-configuration Area: cargo config files and env vars A-console-output Area: Terminal output, colors, progress bar, etc. A-documenting-cargo-itself Area: Cargo's documentation disposition-merge FCP with intent to merge finished-final-comment-period FCP complete S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cargo Team: Cargo to-announce
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Use ANSI codes to report progress
10 participants