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

Update std::env::temp_dir to use GetTempPath2 on Windows when available. #89999

Merged
merged 2 commits into from Dec 9, 2021

Conversation

talagrand
Copy link
Contributor

@talagrand talagrand commented Oct 18, 2021

As a security measure, Windows 11 introduces a new temporary directory API, GetTempPath2.
When the calling process is running as SYSTEM, a separate temporary directory
will be returned inaccessible to non-SYSTEM processes. For non-SYSTEM processes
the behavior will be the same as before.

This can help mitigate against attacks such as this one:
https://medium.com/csis-techblog/cve-2020-1088-yet-another-arbitrary-delete-eop-a00b97d8c3e2

Compatibility risk: Software which relies on temporary files to communicate between SYSTEM and non-SYSTEM
processes may be affected by this change. In many cases, such patterns may be vulnerable to the very
attacks the new API was introduced to harden against.
I'm unclear on the Rust project's tolerance for such change-of-behavior in the standard library. If anything,
this PR is meant to raise awareness of the issue and hopefully start the conversation.

How tested: Taking the example code from the documentation and running it through psexec (from SysInternals) on
Win10 and Win11.
On Win10:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\WINDOWS\TEMP\

On Win11:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\Windows\SystemTemp\

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2021
@joshtriplett
Copy link
Member

This seems reasonable to me. It's certainly theoretically possible that two processes could be communicating via temporary files by passing just filenames and assuming the same temporary directory (or worse, by using constant filenames), but that doesn't seem like a safe or portable assumption. It doesn't seem at all likely that this would break anything. Nonetheless, we should document the behavior change in the release notes.

@joshtriplett joshtriplett added relnotes Marks issues that should be documented in the release notes of the next release. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 18, 2021
@joshtriplett
Copy link
Member

CC @rust-lang/libs-api for wider review. I think we can safely merge this.

@BurntSushi
Copy link
Member

BurntSushi commented Oct 18, 2021

I think this should probably require an FCP. In particular, this is changing the documented behavior of a routine. I suppose it's questionable that we listed the precise platform call we're using in the first place. But if we don't consider changing it to be breaking the contract, then we should probably either remove it or make the wording more relaxed.

One concern I have here is the difference in behavior between Windows versions. I don't really know how to measure it, though, it seems like it could be a source of subtle bugs in a "poorly" written program.

Another thought here is: why didn't Windows just change the behavior of of GetTempPath instead of adding a new GetTempPath2? A guess would be that they were worried enough about compatibility to do it. Should we be similarly worried?

Finally, what are other language ecosystems doing here, if anything?

We should also ping the Windows folks. (I forget how.)

@ChrisDenton
Copy link
Contributor

ChrisDenton commented Oct 18, 2021

Purely from a security point of view, it would be great to have this. But I agree with the concern about the current documentation being a bit too explicit, which is (I think) not normally how the std handles implementation details. E.g. std::io says this: https://doc.rust-lang.org/std/io/#platform-specific-behavior

Many I/O functions throughout the standard library are documented to indicate what various library or syscalls they are delegated to. This is done to help applications both understand what’s happening under the hood as well as investigate any possibly unclear semantics. Note, however, that this is informative, not a binding contract. The implementation of many of these functions are subject to change over time and may call fewer or more syscalls/library functions.


We should also ping the Windows folks. (I forget how.)

@rustbot ping windows

@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2021

Error: Only Rust team members can ping teams.

Please let @rust-lang/release know if you're having trouble with this bot.

@BurntSushi
Copy link
Member

@rustbot ping windows

@rustbot rustbot added the O-windows Operating system: Windows label Oct 18, 2021
@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2021

Hey Windows Group! This bug has been identified as a good "Windows candidate".
In case it's useful, here are some instructions for tackling these sorts of
bugs. Maybe take a look?
Thanks! <3

cc @arlosi @danielframpton @gdr-at-ms @kennykerr @luqmana @lzybkr @nico-abram @retep998 @rylev @sivadeilra @wesleywiser

@wesleywiser
Copy link
Member

This seems like a reasonable change to me as well. I also agree with the concerns regarding the current documentation. I think a note similar to the one @ChrisDenton referred to in the std::io docs would be appropriate here.

@talagrand
Copy link
Contributor Author

talagrand commented Oct 19, 2021

Updated documentation as suggested - I consolidated the platform-specific behavior notice centrally for std. The previous commit simply adds a disclaimer to the "env" module if that's deemed preferrable.
@BurntSushi unclear how to initiate an FCP, do we have a documented process surrounding that, or is that something initiated by the libraries team?

@talagrand talagrand force-pushed the GetTempPath2 branch 2 times, most recently from 93ed1e3 to 7c96abf Compare October 19, 2021 02:09
As a security measure, Windows 11 introduces a new temporary directory API, GetTempPath2.
When the calling process is running as SYSTEM, a separate temporary directory
will be returned inaccessible to non-SYSTEM processes. For non-SYSTEM processes
the behavior will be the same as before.
@talagrand
Copy link
Contributor Author

Updated documentation for temp_dir to fall more in line with the pattern established by std::io.

@joshtriplett
Copy link
Member

@rfcbot merge

Let's see if we have consensus to make this change.

@rfcbot
Copy link

rfcbot commented Oct 19, 2021

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 19, 2021
@yaahc
Copy link
Member

yaahc commented Oct 20, 2021

Another thought here is: why didn't Windows just change the behavior of of GetTempPath instead of adding a new GetTempPath2? A guess would be that they were worried enough about compatibility to do it. Should we be similarly worried?

I want to reiterate @BurntSushi's question here on why didn't Windows do this as a breaking change? If they did it because they're worried that makes me wonder if we should be mirroring their API choice and instead introduce a new method + deprecate the old one.

@sivadeilra
Copy link

sivadeilra commented Oct 21, 2021

Another thought here is: why didn't Windows just change the behavior of of GetTempPath instead of adding a new GetTempPath2? A guess would be that they were worried enough about compatibility to do it. Should we be similarly worried?

I want to reiterate @BurntSushi's question here on why didn't Windows do this as a breaking change? If they did it because they're worried that makes me wonder if we should be mirroring their API choice and instead introduce a new method + deprecate the old one.

Windows dev, here. Windows is under enormous pressure not to make any change in behavior, far beyond the threshold that most people would consider reasonable, because we can't predict the behavior of 10,000s of legacy apps, and neither can our customers. Somewhere out there, there's an app that calls GetTempPath as admin, writes a bunch of files, and then accidentally relies on them being visible to non-admin processes. Or, there's a scheduled task which cleans up %TEMP%, but doesn't clean up the admin version of %TEMP%, so some drive eventually fills up on some obscure machine, and it takes ages for someone to track it down. And then we get yelled at.

But I don't think the same is true for the Rust ecosystem. The distinction boils down to the size and age of the Windows app ecosystem -- it's huge, and much of it is literally decades old. By contrast, the Rust ecosystem is far younger, smaller, and is used to "evergreen" development, where apps track gradual updates to their tools.

I think a reasonable position here is to commit the change to switch to GetTempPath2, and then simply observe what happens. Perhaps it could be gated on whether you're running a nightly compiler or not.

I think erring on the side of safety (security) is best, in this particular situation. As a Windows dev, we would love to just push our customers into the safer behavior. And for 99.9% of our customers, that's probably the right call. But when the 0.1% might just happen to include, say, a hospital's IT department, it's harder for us to make that call for breaking behavior.

@rfcbot
Copy link

rfcbot commented Oct 21, 2021

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

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Oct 21, 2021
@talagrand
Copy link
Contributor Author

talagrand commented Oct 22, 2021

I'll reiterate the previous feedback here on the importance for Windows to not change the externally visible behavior of Win32 APIs release-over-release to maximize app compatibility due to the size and age of the ecosystem.

Additionally, supposing Windows had changed the behavior of GetTempPath, there would be limited ability for apps to restore the old behavior if absolutely necessary, since it's the lowest-level API.
As for what language runtimes should do, this dips into the cultural expectations of what that runtime is providing - is it an abstract platform, implemented in terms of what the underlying system provides, or is it a direct binding of underlying OS primitives? Personally, I would expect a C++ std::thread to bind directly to an OS thread, but the story around a java.lang.Thread to be more nuanced.

In the case of a Rust, I'd imagine the standard library falls somewhere along this abstraction gradient. I believe that, despite std::fs::File::create existing, there is still a role to play for winapi::um::fileapi::CreateFileW existing for developers who want the precise semantics of the underlying OS. In a similar vein, developers who want the precise OS behavior here could always call into winapi::um::fileapi::GetTempPathW to get that behavior. But ideally, we wouldn't want folks to have to reach into winapi to get safe semantics.

My primary motivation for proposing this change is to expose safe defaults, and establish safety even when higher-order abstractions are built on top (as in the "tempfile" crate, to pick an example).

@rfcbot
Copy link

rfcbot commented Oct 31, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Nov 11, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Dec 4, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Dec 4, 2021

📌 Commit 1d26e41 has been approved by m-ou-se

@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 Dec 4, 2021
@bors
Copy link
Contributor

bors commented Dec 4, 2021

⌛ Testing commit 1d26e41 with merge faab3b7772961f5b31c11e39765257318d2eb6b4...

@bors
Copy link
Contributor

bors commented Dec 4, 2021

💥 Test timed out

@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 Dec 4, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@wesleywiser
Copy link
Member

Seems spurious?

@bors retry

@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 Dec 6, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 6, 2021
Update std::env::temp_dir to use GetTempPath2 on Windows when available.

As a security measure, Windows 11 introduces a new temporary directory API, GetTempPath2.
When the calling process is running as SYSTEM, a separate temporary directory
will be returned inaccessible to non-SYSTEM processes. For non-SYSTEM processes
the behavior will be the same as before.

This can help mitigate against attacks such as this one:
https://medium.com/csis-techblog/cve-2020-1088-yet-another-arbitrary-delete-eop-a00b97d8c3e2

Compatibility risk: Software which relies on temporary files to communicate between SYSTEM and non-SYSTEM
processes may be affected by this change. In many cases, such patterns may be vulnerable to the very
attacks the new API was introduced to harden against.
I'm unclear on the Rust project's tolerance for such change-of-behavior in the standard library. If anything,
this PR is meant to raise awareness of the issue and hopefully start the conversation.

How tested: Taking the example code from the documentation and running it through psexec (from SysInternals) on
Win10 and Win11.
On Win10:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\WINDOWS\TEMP\

On Win11:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\Windows\SystemTemp\
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 6, 2021
Update std::env::temp_dir to use GetTempPath2 on Windows when available.

As a security measure, Windows 11 introduces a new temporary directory API, GetTempPath2.
When the calling process is running as SYSTEM, a separate temporary directory
will be returned inaccessible to non-SYSTEM processes. For non-SYSTEM processes
the behavior will be the same as before.

This can help mitigate against attacks such as this one:
https://medium.com/csis-techblog/cve-2020-1088-yet-another-arbitrary-delete-eop-a00b97d8c3e2

Compatibility risk: Software which relies on temporary files to communicate between SYSTEM and non-SYSTEM
processes may be affected by this change. In many cases, such patterns may be vulnerable to the very
attacks the new API was introduced to harden against.
I'm unclear on the Rust project's tolerance for such change-of-behavior in the standard library. If anything,
this PR is meant to raise awareness of the issue and hopefully start the conversation.

How tested: Taking the example code from the documentation and running it through psexec (from SysInternals) on
Win10 and Win11.
On Win10:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\WINDOWS\TEMP\

On Win11:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\Windows\SystemTemp\
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
Update std::env::temp_dir to use GetTempPath2 on Windows when available.

As a security measure, Windows 11 introduces a new temporary directory API, GetTempPath2.
When the calling process is running as SYSTEM, a separate temporary directory
will be returned inaccessible to non-SYSTEM processes. For non-SYSTEM processes
the behavior will be the same as before.

This can help mitigate against attacks such as this one:
https://medium.com/csis-techblog/cve-2020-1088-yet-another-arbitrary-delete-eop-a00b97d8c3e2

Compatibility risk: Software which relies on temporary files to communicate between SYSTEM and non-SYSTEM
processes may be affected by this change. In many cases, such patterns may be vulnerable to the very
attacks the new API was introduced to harden against.
I'm unclear on the Rust project's tolerance for such change-of-behavior in the standard library. If anything,
this PR is meant to raise awareness of the issue and hopefully start the conversation.

How tested: Taking the example code from the documentation and running it through psexec (from SysInternals) on
Win10 and Win11.
On Win10:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\WINDOWS\TEMP\

On Win11:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\Windows\SystemTemp\
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2021
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#87599 (Implement concat_bytes!)
 - rust-lang#89999 (Update std::env::temp_dir to use GetTempPath2 on Windows when available.)
 - rust-lang#90796 (Remove the reg_thumb register class for asm! on ARM)
 - rust-lang#91042 (Use Vec extend instead of repeated pushes on several places)
 - rust-lang#91634 (Do not attempt to suggest help for overly malformed struct/function call)
 - rust-lang#91685 (Install llvm tools to sysroot when assembling local toolchain)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 856eefe into rust-lang:master Dec 9, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 9, 2021
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Mar 2, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.58.1.
 * Adjust one patch (and checksum) so that it still applies.

Upstream changes:

Version 1.59.0 (2022-02-24)
==========================

Language
--------

- [Stabilize default arguments for const generics][90207]
- [Stabilize destructuring assignment][90521]
- [Relax private in public lint on generic bounds and where clauses
  of trait impls][90586]
- [Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64,
  and RISC-V][91728]

Compiler
--------

- [Stabilize new symbol mangling format, leaving it opt-in
  (-Csymbol-mangling-version=v0)][90128]
- [Emit LLVM optimization remarks when enabled with `-Cremark`][90833]
- [Fix sparc64 ABI for aggregates with floating point members][91003]
- [Warn when a `#[test]`-like built-in attribute macro is present
  multiple times.][91172]
- [Add support for riscv64gc-unknown-freebsd][91284]
- [Stabilize `-Z emit-future-incompat` as `--json future-incompat`][91535]
- [Soft disable incremental compilation][94124]

This release disables incremental compilation, unless the user has explicitly
opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
This is due to a known and relatively frequently occurring bug in incremental
compilation, which causes builds to issue internal compiler errors. This
particular bug is already fixed on nightly, but that fix has not yet rolled out
to stable and is deemed too risky for a direct stable backport.

As always, we encourage users to test with nightly and report bugs so that we
can track failures and fix issues earlier.

See [94124] for more details.

[94124]: rust-lang/rust#94124

Libraries
---------

- [Remove unnecessary bounds for some Hash{Map,Set} methods][91593]

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

- [`std::thread::available_parallelism`][available_parallelism]
- [`Result::copied`][result-copied]
- [`Result::cloned`][result-cloned]
- [`arch::asm!`][asm]
- [`arch::global_asm!`][global_asm]
- [`ops::ControlFlow::is_break`][is_break]
- [`ops::ControlFlow::is_continue`][is_continue]
- [`TryFrom<char> for u8`][try_from_char_u8]
- [`char::TryFromCharError`][try_from_char_err]
  implementing `Clone`, `Debug`, `Display`, `PartialEq`, `Copy`, `Eq`, `Error`
- [`iter::zip`][zip]
- [`NonZeroU8::is_power_of_two`][is_power_of_two8]
- [`NonZeroU16::is_power_of_two`][is_power_of_two16]
- [`NonZeroU32::is_power_of_two`][is_power_of_two32]
- [`NonZeroU64::is_power_of_two`][is_power_of_two64]
- [`NonZeroU128::is_power_of_two`][is_power_of_two128]
- [`DoubleEndedIterator for ToLowercase`][lowercase]
- [`DoubleEndedIterator for ToUppercase`][uppercase]
- [`TryFrom<&mut [T]> for [T; N]`][tryfrom_ref_arr]
- [`UnwindSafe for Once`][unwindsafe_once]
- [`RefUnwindSafe for Once`][refunwindsafe_once]
- [armv8 neon intrinsics for aarch64][stdarch/1266]

Const-stable:

- [`mem::MaybeUninit::as_ptr`][muninit_ptr]
- [`mem::MaybeUninit::assume_init`][muninit_init]
- [`mem::MaybeUninit::assume_init_ref`][muninit_init_ref]
- [`ffi::CStr::from_bytes_with_nul_unchecked`][cstr_from_bytes]

Cargo
-----

- [Stabilize the `strip` profile option][cargo/10088]
- [Stabilize future-incompat-report][cargo/10165]
- [Support abbreviating `--release` as `-r`][cargo/10133]
- [Support `term.quiet` configuration][cargo/10152]
- [Remove `--host` from cargo {publish,search,login}][cargo/10145]

Compatibility Notes
-------------------

- [Refactor weak symbols in std::sys::unix][90846]
  This may add new, versioned, symbols when building with a newer glibc, as the
  standard library uses weak linkage rather than dynamically attempting to load
  certain symbols at runtime.
- [Deprecate crate_type and crate_name nested inside `#![cfg_attr]`][83744]
  This adds a future compatibility lint to supporting the use of cfg_attr
  wrapping either crate_type or crate_name specification within Rust files;
  it is recommended that users migrate to setting the equivalent command line
  flags.
- [Remove effect of `#[no_link]` attribute on name resolution][92034]
  This may expose new names, leading to conflicts with preexisting names in a
  given namespace and a compilation failure.
- [Cargo will document libraries before binaries.][cargo/10172]
- [Respect doc=false in dependencies, not just the root crate][cargo/10201]
- [Weaken guarantee around advancing underlying iterators in zip][83791]
- [Make split_inclusive() on an empty slice yield an empty output][89825]
- [Update std::env::temp_dir to use GetTempPath2 on Windows when
  available.][89999]
- [unreachable! was updated to match other formatting macro behavior
  on Rust 2021][92137]

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

These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc
and related tools.

- [Fix many cases of normalization-related ICEs][91255]
- [Replace dominators algorithm with simple Lengauer-Tarjan][85013]
- [Store liveness in interval sets for region inference][90637]

- [Remove `in_band_lifetimes` from the compiler and standard library,
  in preparation for removing this unstable feature.][91867]

[91867]: rust-lang/rust#91867
[83744]: rust-lang/rust#83744
[83791]: rust-lang/rust#83791
[85013]: rust-lang/rust#85013
[89825]: rust-lang/rust#89825
[89999]: rust-lang/rust#89999
[90128]: rust-lang/rust#90128
[90207]: rust-lang/rust#90207
[90521]: rust-lang/rust#90521
[90586]: rust-lang/rust#90586
[90637]: rust-lang/rust#90637
[90833]: rust-lang/rust#90833
[90846]: rust-lang/rust#90846
[91003]: rust-lang/rust#91003
[91172]: rust-lang/rust#91172
[91255]: rust-lang/rust#91255
[91284]: rust-lang/rust#91284
[91535]: rust-lang/rust#91535
[91593]: rust-lang/rust#91593
[91728]: rust-lang/rust#91728
[91878]: rust-lang/rust#91878
[91896]: rust-lang/rust#91896
[91926]: rust-lang/rust#91926
[91984]: rust-lang/rust#91984
[92020]: rust-lang/rust#92020
[92034]: rust-lang/rust#92034
[92483]: rust-lang/rust#92483
[cargo/10088]: rust-lang/cargo#10088
[cargo/10133]: rust-lang/cargo#10133
[cargo/10145]: rust-lang/cargo#10145
[cargo/10152]: rust-lang/cargo#10152
[cargo/10165]: rust-lang/cargo#10165
[cargo/10172]: rust-lang/cargo#10172
[cargo/10201]: rust-lang/cargo#10201
[cargo/10269]: rust-lang/cargo#10269

[cstr_from_bytes]: https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.from_bytes_with_nul_unchecked
[muninit_ptr]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_ptr
[muninit_init]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init
[muninit_init_ref]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
[unwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-UnwindSafe
[refunwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-RefUnwindSafe
[tryfrom_ref_arr]: https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3C%26%27_%20mut%20%5BT%5D%3E
[lowercase]: https://doc.rust-lang.org/stable/std/char/struct.ToLowercase.html#impl-DoubleEndedIterator
[uppercase]: https://doc.rust-lang.org/stable/std/char/struct.ToUppercase.html#impl-DoubleEndedIterator
[try_from_char_err]: https://doc.rust-lang.org/stable/std/char/struct.TryFromCharError.html
[available_parallelism]: https://doc.rust-lang.org/stable/std/thread/fn.available_parallelism.html
[result-copied]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.copied
[result-cloned]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.cloned
[asm]: https://doc.rust-lang.org/stable/core/arch/macro.asm.html
[global_asm]: https://doc.rust-lang.org/stable/core/arch/macro.global_asm.html
[is_break]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_break
[is_continue]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_continue
[try_from_char_u8]: https://doc.rust-lang.org/stable/std/primitive.char.html#impl-TryFrom%3Cchar%3E
[zip]: https://doc.rust-lang.org/stable/std/iter/fn.zip.html
[is_power_of_two8]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU8.html#method.is_power_of_two
[is_power_of_two16]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU16.html#method.is_power_of_two
[is_power_of_two32]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU32.html#method.is_power_of_two
[is_power_of_two64]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU64.html#method.is_power_of_two
[is_power_of_two128]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU128.html#method.is_power_of_two
[stdarch/1266]: rust-lang/stdarch#1266
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 15, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.58.1.
 * Adjust one patch (and checksum) so that it still applies.

Upstream changes:

Version 1.59.0 (2022-02-24)
==========================

Language
--------

- [Stabilize default arguments for const generics][90207]
- [Stabilize destructuring assignment][90521]
- [Relax private in public lint on generic bounds and where clauses
  of trait impls][90586]
- [Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64,
  and RISC-V][91728]

Compiler
--------

- [Stabilize new symbol mangling format, leaving it opt-in
  (-Csymbol-mangling-version=v0)][90128]
- [Emit LLVM optimization remarks when enabled with `-Cremark`][90833]
- [Fix sparc64 ABI for aggregates with floating point members][91003]
- [Warn when a `#[test]`-like built-in attribute macro is present
  multiple times.][91172]
- [Add support for riscv64gc-unknown-freebsd][91284]
- [Stabilize `-Z emit-future-incompat` as `--json future-incompat`][91535]
- [Soft disable incremental compilation][94124]

This release disables incremental compilation, unless the user has explicitly
opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
This is due to a known and relatively frequently occurring bug in incremental
compilation, which causes builds to issue internal compiler errors. This
particular bug is already fixed on nightly, but that fix has not yet rolled out
to stable and is deemed too risky for a direct stable backport.

As always, we encourage users to test with nightly and report bugs so that we
can track failures and fix issues earlier.

See [94124] for more details.

[94124]: rust-lang/rust#94124

Libraries
---------

- [Remove unnecessary bounds for some Hash{Map,Set} methods][91593]

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

- [`std::thread::available_parallelism`][available_parallelism]
- [`Result::copied`][result-copied]
- [`Result::cloned`][result-cloned]
- [`arch::asm!`][asm]
- [`arch::global_asm!`][global_asm]
- [`ops::ControlFlow::is_break`][is_break]
- [`ops::ControlFlow::is_continue`][is_continue]
- [`TryFrom<char> for u8`][try_from_char_u8]
- [`char::TryFromCharError`][try_from_char_err]
  implementing `Clone`, `Debug`, `Display`, `PartialEq`, `Copy`, `Eq`, `Error`
- [`iter::zip`][zip]
- [`NonZeroU8::is_power_of_two`][is_power_of_two8]
- [`NonZeroU16::is_power_of_two`][is_power_of_two16]
- [`NonZeroU32::is_power_of_two`][is_power_of_two32]
- [`NonZeroU64::is_power_of_two`][is_power_of_two64]
- [`NonZeroU128::is_power_of_two`][is_power_of_two128]
- [`DoubleEndedIterator for ToLowercase`][lowercase]
- [`DoubleEndedIterator for ToUppercase`][uppercase]
- [`TryFrom<&mut [T]> for [T; N]`][tryfrom_ref_arr]
- [`UnwindSafe for Once`][unwindsafe_once]
- [`RefUnwindSafe for Once`][refunwindsafe_once]
- [armv8 neon intrinsics for aarch64][stdarch/1266]

Const-stable:

- [`mem::MaybeUninit::as_ptr`][muninit_ptr]
- [`mem::MaybeUninit::assume_init`][muninit_init]
- [`mem::MaybeUninit::assume_init_ref`][muninit_init_ref]
- [`ffi::CStr::from_bytes_with_nul_unchecked`][cstr_from_bytes]

Cargo
-----

- [Stabilize the `strip` profile option][cargo/10088]
- [Stabilize future-incompat-report][cargo/10165]
- [Support abbreviating `--release` as `-r`][cargo/10133]
- [Support `term.quiet` configuration][cargo/10152]
- [Remove `--host` from cargo {publish,search,login}][cargo/10145]

Compatibility Notes
-------------------

- [Refactor weak symbols in std::sys::unix][90846]
  This may add new, versioned, symbols when building with a newer glibc, as the
  standard library uses weak linkage rather than dynamically attempting to load
  certain symbols at runtime.
- [Deprecate crate_type and crate_name nested inside `#![cfg_attr]`][83744]
  This adds a future compatibility lint to supporting the use of cfg_attr
  wrapping either crate_type or crate_name specification within Rust files;
  it is recommended that users migrate to setting the equivalent command line
  flags.
- [Remove effect of `#[no_link]` attribute on name resolution][92034]
  This may expose new names, leading to conflicts with preexisting names in a
  given namespace and a compilation failure.
- [Cargo will document libraries before binaries.][cargo/10172]
- [Respect doc=false in dependencies, not just the root crate][cargo/10201]
- [Weaken guarantee around advancing underlying iterators in zip][83791]
- [Make split_inclusive() on an empty slice yield an empty output][89825]
- [Update std::env::temp_dir to use GetTempPath2 on Windows when
  available.][89999]
- [unreachable! was updated to match other formatting macro behavior
  on Rust 2021][92137]

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

These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc
and related tools.

- [Fix many cases of normalization-related ICEs][91255]
- [Replace dominators algorithm with simple Lengauer-Tarjan][85013]
- [Store liveness in interval sets for region inference][90637]

- [Remove `in_band_lifetimes` from the compiler and standard library,
  in preparation for removing this unstable feature.][91867]

[91867]: rust-lang/rust#91867
[83744]: rust-lang/rust#83744
[83791]: rust-lang/rust#83791
[85013]: rust-lang/rust#85013
[89825]: rust-lang/rust#89825
[89999]: rust-lang/rust#89999
[90128]: rust-lang/rust#90128
[90207]: rust-lang/rust#90207
[90521]: rust-lang/rust#90521
[90586]: rust-lang/rust#90586
[90637]: rust-lang/rust#90637
[90833]: rust-lang/rust#90833
[90846]: rust-lang/rust#90846
[91003]: rust-lang/rust#91003
[91172]: rust-lang/rust#91172
[91255]: rust-lang/rust#91255
[91284]: rust-lang/rust#91284
[91535]: rust-lang/rust#91535
[91593]: rust-lang/rust#91593
[91728]: rust-lang/rust#91728
[91878]: rust-lang/rust#91878
[91896]: rust-lang/rust#91896
[91926]: rust-lang/rust#91926
[91984]: rust-lang/rust#91984
[92020]: rust-lang/rust#92020
[92034]: rust-lang/rust#92034
[92483]: rust-lang/rust#92483
[cargo/10088]: rust-lang/cargo#10088
[cargo/10133]: rust-lang/cargo#10133
[cargo/10145]: rust-lang/cargo#10145
[cargo/10152]: rust-lang/cargo#10152
[cargo/10165]: rust-lang/cargo#10165
[cargo/10172]: rust-lang/cargo#10172
[cargo/10201]: rust-lang/cargo#10201
[cargo/10269]: rust-lang/cargo#10269

[cstr_from_bytes]: https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.from_bytes_with_nul_unchecked
[muninit_ptr]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_ptr
[muninit_init]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init
[muninit_init_ref]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
[unwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-UnwindSafe
[refunwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-RefUnwindSafe
[tryfrom_ref_arr]: https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3C%26%27_%20mut%20%5BT%5D%3E
[lowercase]: https://doc.rust-lang.org/stable/std/char/struct.ToLowercase.html#impl-DoubleEndedIterator
[uppercase]: https://doc.rust-lang.org/stable/std/char/struct.ToUppercase.html#impl-DoubleEndedIterator
[try_from_char_err]: https://doc.rust-lang.org/stable/std/char/struct.TryFromCharError.html
[available_parallelism]: https://doc.rust-lang.org/stable/std/thread/fn.available_parallelism.html
[result-copied]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.copied
[result-cloned]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.cloned
[asm]: https://doc.rust-lang.org/stable/core/arch/macro.asm.html
[global_asm]: https://doc.rust-lang.org/stable/core/arch/macro.global_asm.html
[is_break]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_break
[is_continue]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_continue
[try_from_char_u8]: https://doc.rust-lang.org/stable/std/primitive.char.html#impl-TryFrom%3Cchar%3E
[zip]: https://doc.rust-lang.org/stable/std/iter/fn.zip.html
[is_power_of_two8]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU8.html#method.is_power_of_two
[is_power_of_two16]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU16.html#method.is_power_of_two
[is_power_of_two32]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU32.html#method.is_power_of_two
[is_power_of_two64]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU64.html#method.is_power_of_two
[is_power_of_two128]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU128.html#method.is_power_of_two
[stdarch/1266]: rust-lang/stdarch#1266
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. O-windows Operating system: Windows relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet