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

Stabilize const_raw_ptr_deref for *const T #89551

Merged
merged 1 commit into from
Nov 13, 2021

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Oct 5, 2021

This stabilizes dereferencing immutable raw pointers in const contexts.
It does not stabilize *mut T dereferencing. This is behind the
same feature gate as mutable references.

closes #51911

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

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

jhpratt commented Oct 5, 2021

@rustbot label +A-const-eval +A-const-fn +T-lang

r? @joshtriplett

cc @oli-obk @RalfJung

@rustbot rustbot added A-const-eval Area: Constant evaluation (MIR interpretation) A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Oct 5, 2021
@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test diffs lgtm

I'm only unsure about the new feature gate

@oli-obk
Copy link
Contributor

oli-obk commented Oct 5, 2021

cc @rust-lang/wg-const-eval

@nbdd0121
Copy link
Contributor

nbdd0121 commented Oct 5, 2021

I think *mut T should either stay in the current feature gate, or be merged to const_mut_refs feature gate like @oli-obk suggested.

@jhpratt jhpratt force-pushed the stabilize-const_raw_ptr_deref branch from 735c133 to 20bbeed Compare October 6, 2021 03:23
@jhpratt
Copy link
Member Author

jhpratt commented Oct 6, 2021

Just pushed up changes that move *mut T to the existing const_mut_refs feature.

@rust-log-analyzer

This comment has been minimized.

@jhpratt jhpratt force-pushed the stabilize-const_raw_ptr_deref branch from 20bbeed to b0f6e5d Compare October 6, 2021 04:13
@rust-log-analyzer

This comment has been minimized.

@jhpratt jhpratt force-pushed the stabilize-const_raw_ptr_deref branch from b0f6e5d to f4a43cc Compare October 6, 2021 04:55
@jhpratt
Copy link
Member Author

jhpratt commented Oct 9, 2021

Should FCP be kicked off on this to make it into 1.57? Ten days gets us just about to the beta cut I belive. I haven't had time to fix the minor concerns but will do so on Sunday. FCP is more about process than actual code, of course.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 9, 2021

Should FCP be kicked off on this to make it into 1.57? Ten days gets us just about to the beta cut I belive. I haven't had time to fix the minor concerns but will do so on Sunday. FCP is more about process than actual code, of course.

the 10 days will start once the FCP has been accepted. I don't think that will happen before the lang team mtg on Tuesday, so it won't be in time anyway. Let's let it ride the trains to 1.58, less stressful that way

@jhpratt jhpratt force-pushed the stabilize-const_raw_ptr_deref branch 2 times, most recently from 2181139 to 29336ed Compare October 11, 2021 05:33
@jhpratt
Copy link
Member Author

jhpratt commented Oct 11, 2021

Reversed the order of the two checks, deleted one of the duplicate tests, and bumped to stabilization 1.58. All checks are green.

@bors
Copy link
Contributor

bors commented Oct 15, 2021

☔ The latest upstream changes (presumably #89884) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Nov 13, 2021

💔 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 Nov 13, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-msvc-cargo failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test workspaces::virtual_primary_package_env_var ... ok

failures:

---- lto::complicated stdout ----
running `D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\release\cargo.exe build -v --release`
thread 'lto::complicated' panicked at '
test failed running `D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\release\cargo.exe build -v --release`
error: process exited with code 101 (expected 0)

--- stderr
--- stderr
    Updating `dummy-registry` index
---
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
   Compiling dep-shared v0.0.1
   Compiling dep-build2 v0.0.1
   Compiling dep-proc-macro2 v0.0.1
   Compiling dep-normal2 v0.0.1
     Running `rustc --crate-name dep_shared D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\home\.cargo\registry\src\-f42be7ed4e956aa7\dep-shared-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=815663fa4ca118de -C extra-filename=-815663fa4ca118de --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --cap-lints allow`
     Running `rustc --crate-name dep_normal2 D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\home\.cargo\registry\src\-f42be7ed4e956aa7\dep-normal2-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto -C metadata=8cf56e81cc7e8007 -C extra-filename=-8cf56e81cc7e8007 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --cap-lints allow`
     Running `rustc --crate-name dep_proc_macro2 D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\home\.cargo\registry\src\-f42be7ed4e956aa7\dep-proc-macro2-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=f829152b9eb79c53 -C extra-filename=-f829152b9eb79c53 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --cap-lints allow`
     Running `rustc --crate-name dep_build2 D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\home\.cargo\registry\src\-f42be7ed4e956aa7\dep-build2-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=df572682f4638748 -C extra-filename=-df572682f4638748 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --cap-lints allow`
   Compiling dep-build v0.0.1
   Compiling dep-normal v0.0.1
     Running `rustc --crate-name dep_normal D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\home\.cargo\registry\src\-f42be7ed4e956aa7\dep-normal-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto -C metadata=06ea447f8e785b1a -C extra-filename=-06ea447f8e785b1a --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --extern dep_normal2=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_normal2-8cf56e81cc7e8007.rmeta --extern dep_shared=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_shared-815663fa4ca118de.rmeta --cap-lints allow`
     Running `rustc --crate-name dep_build D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\home\.cargo\registry\src\-f42be7ed4e956aa7\dep-build-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=4b7343fd1f9e1e57 -C extra-filename=-4b7343fd1f9e1e57 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --extern dep_build2=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_build2-df572682f4638748.rmeta --extern dep_shared=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_shared-815663fa4ca118de.rmeta --cap-lints allow`
   Compiling test v0.0.0 (D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo)
   Compiling dep-proc-macro v0.0.1
     Running `rustc --crate-name build_script_build build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=1132ccd72abf6ae6 -C extra-filename=-1132ccd72abf6ae6 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\build\test-1132ccd72abf6ae6 -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --extern dep_build=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_build-4b7343fd1f9e1e57.rlib`
     Running `rustc --crate-name dep_proc_macro D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\home\.cargo\registry\src\-f42be7ed4e956aa7\dep-proc-macro-0.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C opt-level=3 -C embed-bitcode=no -C metadata=92b443923583e648 -C extra-filename=-92b443923583e648 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --extern dep_proc_macro2=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_proc_macro2-f829152b9eb79c53.rlib --extern dep_shared=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_shared-815663fa4ca118de.rlib --extern proc_macro --cap-lints allow`
     Running `D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\build\test-1132ccd72abf6ae6\build-script-build`
     Running `rustc --crate-name test src\main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C metadata=f9bd7972e02c2e3b --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --extern dep_normal=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_normal-06ea447f8e785b1a.rlib --extern dep_proc_macro=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\dep_proc_macro-92b443923583e648.dll`
     Running `rustc --crate-name test src\lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type cdylib --crate-type staticlib --emit=dep-info,link -C opt-level=3 -C lto -C metadata=10d13534f609fec7 --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --extern dep_normal=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_normal-06ea447f8e785b1a.rlib --extern dep_proc_macro=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\dep_proc_macro-92b443923583e648.dll`
error: linking with `link.exe` failed: exit code: 1201
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2-tools\\x86_64-pc-windows-msvc\\tmp\\cit\\t1288\\foo\\target\\release\\deps\\test.test.1ec84935-cgu.1.rcgu.o" "/LIBPATH:D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2-tools\\x86_64-pc-windows-msvc\\tmp\\cit\\t1288\\foo\\target\\release\\deps" "/LIBPATH:D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-2bd9c3b9b2394772.rlib" "kernel32.lib" "ws2_32.lib" "bcrypt.lib" "advapi32.lib" "userenv.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2-tools\\x86_64-pc-windows-msvc\\tmp\\cit\\t1288\\foo\\target\\release\\deps\\test.exe" "/OPT:REF,ICF" "/DEBUG"
  = note: LINK : fatal error LNK1201: error writing to program database 'D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\test.pdb'; check for insufficient disk space, invalid path, or insufficient privilege

error: could not compile `test` due to previous error

Caused by:
Caused by:
  process didn't exit successfully: `rustc --crate-name test src\main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C metadata=f9bd7972e02c2e3b --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps -L dependency=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps --extern dep_normal=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\libdep_normal-06ea447f8e785b1a.rlib --extern dep_proc_macro=D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\tmp\cit\t1288\foo\target\release\deps\dep_proc_macro-92b443923583e648.dll` (exit code: 1)
error: build failed
', src\tools\cargo\tests\testsuite\lto.rs:217:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@jhpratt
Copy link
Member Author

jhpratt commented Nov 13, 2021

Pretty sure I can't do this, but let's give it a shot.

@bors retry

@bors
Copy link
Contributor

bors commented Nov 13, 2021

@jhpratt: 🔑 Insufficient privileges: not in try users

@RalfJung
Copy link
Member

@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 Nov 13, 2021
@bors
Copy link
Contributor

bors commented Nov 13, 2021

⌛ Testing commit 0cdbeaa with merge d212d90...

@bors
Copy link
Contributor

bors commented Nov 13, 2021

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing d212d90 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 13, 2021
@bors bors merged commit d212d90 into rust-lang:master Nov 13, 2021
@rustbot rustbot added this to the 1.58.0 milestone Nov 13, 2021
@ehuss
Copy link
Contributor

ehuss commented Nov 13, 2021

Does the const eval section need to be updated for this change?

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d212d90): comparison url.

Summary: This change led to large relevant mixed results 🤷 in compiler performance.

  • Large improvement in instruction counts (up to -3.8% on incr-unchanged builds of deep-vector)
  • Small regression in instruction counts (up to 0.3% on incr-unchanged builds of html5ever)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression

@rustbot rustbot added the perf-regression Performance regression. label Nov 13, 2021
@jhpratt
Copy link
Member Author

jhpratt commented Nov 14, 2021

Not seeing anything notable in the perf run.

@jhpratt jhpratt deleted the stabilize-const_raw_ptr_deref branch November 14, 2021 04:58
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Nov 18, 2021
yvt added a commit to r3-os/r3 that referenced this pull request Dec 4, 2021
`const_raw_ptr_deref` has been stabilized by
<rust-lang/rust#89551>.
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Jan 22, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.57.0.
 * For some reason, the vendor/libc checksums don't need fixing.
 * Bump required external LLVM to 12.0, according to upstream change log.
 * Adapt the Darwin linker patch.

(For some reason I've not figured out yet, cargo is a lot more
verbose while building, echoes the rustc invocation.)

Upstream changes:

Version 1.58.1 (2022-01-19)
===========================

* Fix race condition in `std::fs::remove_dir_all` ([CVE-2022-21658])
* [Handle captured arguments in the `useless_format` Clippy lint][clippy/8295]
* [Move `non_send_fields_in_send_ty` Clippy lint to nursery][clippy/8075]
* [Fix wrong error message displayed when some imports are missing][91254]
* [Fix rustfmt not formatting generated files from stdin][92912]

[CVE-2022-21658]: https://www.cve.org/CVERecord?id=CVE-2022-21658]
[91254]: rust-lang/rust#91254
[92912]: rust-lang/rust#92912
[clippy/8075]: rust-lang/rust-clippy#8075
[clippy/8295]: rust-lang/rust-clippy#8295

Version 1.58.0 (2022-01-13)
==========================

Language
--------

- [Format strings can now capture arguments simply by writing
  `{ident}` in the string.][90473] This works in all macros accepting
  format strings. Support for this in `panic!` (`panic!("{ident}")`)
  requires the 2021 edition; panic invocations in previous editions
  that appear to be trying to use this will result in a warning lint
  about not having the intended effect.
- [`*const T` pointers can now be dereferenced in const contexts.][89551]
- [The rules for when a generic struct implements `Unsize` have
  been relaxed.][90417]

Compiler
--------

- [Add LLVM CFI support to the Rust compiler][89652]
- [Stabilize -Z strip as -C strip][90058]. Note that while release
  builds already don't add debug symbols for the code you compile,
  the compiled standard library that ships with Rust includes debug
  symbols, so you may want to use the `strip` option to remove these
  symbols to produce smaller release binaries. Note that this release
  only includes support in rustc, not directly in cargo.
- [Add support for LLVM coverage mapping format versions 5 and 6][91207]
- [Emit LLVM optimization remarks when enabled with `-Cremark`][90833]
- [Update the minimum external LLVM to 12][90175]
- [Add `x86_64-unknown-none` at Tier 3*][89062]
- [Build musl dist artifacts with debuginfo enabled][90733]. When
  building release binaries using musl, you may want to use the newly
  stabilized strip option to remove these debug symbols, reducing
  the size of your binaries.
- [Don't abort compilation after giving a lint error][87337]
- [Error messages point at the source of trait bound obligations
  in more places][89580]

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

Libraries
---------

- [All remaining functions in the standard library have `#[must_use]`
  annotations where appropriate][89692], producing a warning when
  ignoring their return value. This helps catch mistakes such as
  expecting a function to mutate a value in place rather than return
  a new value.
- [Paths are automatically canonicalized on Windows for operations
  that support it][89174]
- [Re-enable debug checks for `copy` and `copy_nonoverlapping`][90041]
- [Implement `RefUnwindSafe` for `Rc<T>`][87467]
- [Make RSplit<T, P>: Clone not require T: Clone][90117]
- [Implement `Termination` for `Result<Infallible, E>`][88601].
  This allows writing `fn main() -> Result<Infallible, ErrorType>`,
  for a program whose successful exits never involve returning from
  `main` (for instance, a program that calls `exit`, or that uses
  `exec` to run another program).

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

- [`Metadata::is_symlink`]
- [`Path::is_symlink`]
- [`{integer}::saturating_div`]
- [`Option::unwrap_unchecked`]
- [`Result::unwrap_unchecked`]
- [`Result::unwrap_err_unchecked`]
- [`NonZero{unsigned}::is_power_of_two`]
- [`File::options`]

These APIs are now usable in const contexts:

- [`Duration::new`]
- [`Duration::checked_add`]
- [`Duration::saturating_add`]
- [`Duration::checked_sub`]
- [`Duration::saturating_sub`]
- [`Duration::checked_mul`]
- [`Duration::saturating_mul`]
- [`Duration::checked_div`]
- [`MaybeUninit::as_ptr`]
- [`MaybeUninit::as_mut_ptr`]
- [`MaybeUninit::assume_init`]
- [`MaybeUninit::assume_init_ref`]

Cargo
-----

- [Add --message-format for install command][cargo/10107]
- [Warn when alias shadows external subcommand][cargo/10082]

Rustdoc
-------

- [Show all Deref implementations recursively in rustdoc][90183]
- [Use computed visibility in rustdoc][88447]

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

- [Try all stable method candidates first before trying unstable
  ones][90329]. This change ensures that adding new nightly-only
  methods to the Rust standard library will not break code invoking
  methods of the same name from traits outside the standard library.
- Windows: [`std::process::Command` will no longer search the
  current directory for executables.][87704]
- [All proc-macro backward-compatibility lints are now deny-by-default.][88041]
- [proc_macro: Append .0 to unsuffixed float if it would otherwise
  become int token][90297]
- [Refactor weak symbols in std::sys::unix][90846]. This optimizes
  accesses to glibc functions, by avoiding the use of dlopen. This
  does not increase the [minimum expected version of
  glibc](https://doc.rust-lang.org/nightly/rustc/platform-support.html).
  However, software distributions that use symbol versions to detect
  library dependencies, and which take weak symbols into account in
  that analysis, may detect rust binaries as requiring newer versions
  of glibc.
- [rustdoc now rejects some unexpected semicolons in doctests][91026]

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.

- [Implement coherence checks for negative trait impls][90104]
- [Add rustc lint, warning when iterating over hashmaps][89558]
- [Optimize live point computation][90491]
- [Enable verification for 1/32nd of queries loaded from disk][90361]
- [Implement version of normalize_erasing_regions that allows for
  normalization failure][91255]

[87337]: rust-lang/rust#87337
[87467]: rust-lang/rust#87467
[87704]: rust-lang/rust#87704
[88041]: rust-lang/rust#88041
[88300]: rust-lang/rust#88300
[88447]: rust-lang/rust#88447
[88601]: rust-lang/rust#88601
[88624]: rust-lang/rust#88624
[89062]: rust-lang/rust#89062
[89174]: rust-lang/rust#89174
[89542]: rust-lang/rust#89542
[89551]: rust-lang/rust#89551
[89558]: rust-lang/rust#89558
[89580]: rust-lang/rust#89580
[89652]: rust-lang/rust#89652
[89677]: rust-lang/rust#89677
[89951]: rust-lang/rust#89951
[90041]: rust-lang/rust#90041
[90058]: rust-lang/rust#90058
[90104]: rust-lang/rust#90104
[90117]: rust-lang/rust#90117
[90175]: rust-lang/rust#90175
[90183]: rust-lang/rust#90183
[90297]: rust-lang/rust#90297
[90329]: rust-lang/rust#90329
[90361]: rust-lang/rust#90361
[90417]: rust-lang/rust#90417
[90473]: rust-lang/rust#90473
[90491]: rust-lang/rust#90491
[90733]: rust-lang/rust#90733
[90833]: rust-lang/rust#90833
[90846]: rust-lang/rust#90846
[90896]: rust-lang/rust#90896
[91026]: rust-lang/rust#91026
[91207]: rust-lang/rust#91207
[91255]: rust-lang/rust#91255
[91301]: rust-lang/rust#91301
[cargo/10082]: rust-lang/cargo#10082
[cargo/10107]: rust-lang/cargo#10107
[`Metadata::is_symlink`]: https://doc.rust-lang.org/stable/std/fs/struct.Metadata.html#method.is_symlink
[`Path::is_symlink`]: https://doc.rust-lang.org/stable/std/path/struct.Path.html#method.is_symlink
[`{integer}::saturating_div`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.saturating_div
[`Option::unwrap_unchecked`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.unwrap_unchecked
[`Result::unwrap_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_unchecked
[`Result::unwrap_err_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_err_unchecked
[`NonZero{unsigned}::is_power_of_two`]: https://doc.rust-lang.org/stable/std/num/struct.NonZeroU8.html#method.is_power_of_two
[`File::options`]: https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.options
[`unix::process::ExitStatusExt::core_dumped`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.core_dumped
[`unix::process::ExitStatusExt::stopped_signal`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.stopped_signal
[`unix::process::ExitStatusExt::continued`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.continued
[`unix::process::ExitStatusExt::into_raw`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.into_raw
[`Duration::new`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.new
[`Duration::checked_add`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_add
[`Duration::saturating_add`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_add
[`Duration::checked_sub`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_sub
[`Duration::saturating_sub`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_sub
[`Duration::checked_mul`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_mul
[`Duration::saturating_mul`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_mul
[`Duration::checked_div`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_div
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.as_secs_f64
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.as_secs_f32
[`Duration::from_secs_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_secs_f64
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_secs_f32
[`Duration::mul_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.mul_f64
[`Duration::mul_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.mul_f32
[`Duration::div_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_f64
[`Duration::div_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_f32
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_duration_f64
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_duration_f32
[`MaybeUninit::as_ptr`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_ptr
[`MaybeUninit::as_mut_ptr`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_mut_ptr
[`MaybeUninit::assume_init`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init
[`MaybeUninit::assume_init_ref`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Mar 1, 2022
Pkgsrc changes:
 * Bump bootstrap kit version to 1.57.0.
 * Bump require external LLVM to 12.0, according to upstream change log.
 * Adjust patches as needed, adjust line numbers.
 * Update checksum adjustments.  For some reason the vendor/libc checksum
   doesn't need fixing, apparently, it remains as commented out.
 * Add makefile to do all the NetBSD boostrap/cross builds (do-cross.mk).
   Allow passing in additions to CONFIGURE_ARGS via ADD_CONFIGURE_ARGS.

Upstream changes:

Version 1.58.1 (2022-01-19)
===========================

* Fix race condition in `std::fs::remove_dir_all` ([CVE-2022-21658])
* [Handle captured arguments in the `useless_format` Clippy lint][clippy/8295]
* [Move `non_send_fields_in_send_ty` Clippy lint to nursery][clippy/8075]
* [Fix wrong error message displayed when some imports are missing][91254]
* [Fix rustfmt not formatting generated files from stdin][92912]

[CVE-2022-21658]: https://www.cve.org/CVERecord?id=CVE-2022-21658]
[91254]: rust-lang/rust#91254
[92912]: rust-lang/rust#92912
[clippy/8075]: rust-lang/rust-clippy#8075
[clippy/8295]: rust-lang/rust-clippy#8295

Version 1.58.0 (2022-01-13)
==========================

Language
--------

- [Format strings can now capture arguments simply by writing
  `{ident}` in the string.][90473] This works in all macros accepting
  format strings. Support for this in `panic!` (`panic!("{ident}")`)
  requires the 2021 edition; panic invocations in previous editions
  that appear to be trying to use this will result in a warning lint
  about not having the intended effect.
- [`*const T` pointers can now be dereferenced in const contexts.][89551]
- [The rules for when a generic struct implements `Unsize` have
  been relaxed.][90417]

Compiler
--------

- [Add LLVM CFI support to the Rust compiler][89652]
- [Stabilize -Z strip as -C strip][90058]. Note that while release
  builds already don't add debug symbols for the code you compile,
  the compiled standard library that ships with Rust includes debug
  symbols, so you may want to use the `strip` option to remove these
  symbols to produce smaller release binaries. Note that this release
  only includes support in rustc, not directly in cargo.
- [Add support for LLVM coverage mapping format versions 5 and 6][91207]
- [Emit LLVM optimization remarks when enabled with `-Cremark`][90833]
- [Update the minimum external LLVM to 12][90175]
- [Add `x86_64-unknown-none` at Tier 3*][89062]
- [Build musl dist artifacts with debuginfo enabled][90733]. When
  building release binaries using musl, you may want to use the newly
  stabilized strip option to remove these debug symbols, reducing
  the size of your binaries.
- [Don't abort compilation after giving a lint error][87337]
- [Error messages point at the source of trait bound obligations
  in more places][89580]

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

Libraries
---------

- [All remaining functions in the standard library have `#[must_use]`
  annotations where appropriate][89692], producing a warning when
  ignoring their return value. This helps catch mistakes such as
  expecting a function to mutate a value in place rather than return
  a new value.
- [Paths are automatically canonicalized on Windows for operations
  that support it][89174]
- [Re-enable debug checks for `copy` and `copy_nonoverlapping`][90041]
- [Implement `RefUnwindSafe` for `Rc<T>`][87467]
- [Make RSplit<T, P>: Clone not require T: Clone][90117]
- [Implement `Termination` for `Result<Infallible, E>`][88601].
  This allows writing `fn main() -> Result<Infallible, ErrorType>`,
  for a program whose successful exits never involve returning from
  `main` (for instance, a program that calls `exit`, or that uses
  `exec` to run another program).

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

- [`Metadata::is_symlink`]
- [`Path::is_symlink`]
- [`{integer}::saturating_div`]
- [`Option::unwrap_unchecked`]
- [`Result::unwrap_unchecked`]
- [`Result::unwrap_err_unchecked`]
- [`NonZero{unsigned}::is_power_of_two`]
- [`File::options`]

These APIs are now usable in const contexts:

- [`Duration::new`]
- [`Duration::checked_add`]
- [`Duration::saturating_add`]
- [`Duration::checked_sub`]
- [`Duration::saturating_sub`]
- [`Duration::checked_mul`]
- [`Duration::saturating_mul`]
- [`Duration::checked_div`]
- [`MaybeUninit::as_ptr`]
- [`MaybeUninit::as_mut_ptr`]
- [`MaybeUninit::assume_init`]
- [`MaybeUninit::assume_init_ref`]

Cargo
-----

- [Add --message-format for install command][cargo/10107]
- [Warn when alias shadows external subcommand][cargo/10082]

Rustdoc
-------

- [Show all Deref implementations recursively in rustdoc][90183]
- [Use computed visibility in rustdoc][88447]

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

- [Try all stable method candidates first before trying unstable
  ones][90329]. This change ensures that adding new nightly-only
  methods to the Rust standard library will not break code invoking
  methods of the same name from traits outside the standard library.
- Windows: [`std::process::Command` will no longer search the
  current directory for executables.][87704]
- [All proc-macro backward-compatibility lints are now deny-by-default.][88041]
- [proc_macro: Append .0 to unsuffixed float if it would otherwise
  become int token][90297]
- [Refactor weak symbols in std::sys::unix][90846]. This optimizes
  accesses to glibc functions, by avoiding the use of dlopen. This
  does not increase the [minimum expected version of
  glibc](https://doc.rust-lang.org/nightly/rustc/platform-support.html).
  However, software distributions that use symbol versions to detect
  library dependencies, and which take weak symbols into account in
  that analysis, may detect rust binaries as requiring newer versions
  of glibc.
- [rustdoc now rejects some unexpected semicolons in doctests][91026]

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.

- [Implement coherence checks for negative trait impls][90104]
- [Add rustc lint, warning when iterating over hashmaps][89558]
- [Optimize live point computation][90491]
- [Enable verification for 1/32nd of queries loaded from disk][90361]
- [Implement version of normalize_erasing_regions that allows for
  normalization failure][91255]

[87337]: rust-lang/rust#87337
[87467]: rust-lang/rust#87467
[87704]: rust-lang/rust#87704
[88041]: rust-lang/rust#88041
[88300]: rust-lang/rust#88300
[88447]: rust-lang/rust#88447
[88601]: rust-lang/rust#88601
[88624]: rust-lang/rust#88624
[89062]: rust-lang/rust#89062
[89174]: rust-lang/rust#89174
[89542]: rust-lang/rust#89542
[89551]: rust-lang/rust#89551
[89558]: rust-lang/rust#89558
[89580]: rust-lang/rust#89580
[89652]: rust-lang/rust#89652
[89677]: rust-lang/rust#89677
[89951]: rust-lang/rust#89951
[90041]: rust-lang/rust#90041
[90058]: rust-lang/rust#90058
[90104]: rust-lang/rust#90104
[90117]: rust-lang/rust#90117
[90175]: rust-lang/rust#90175
[90183]: rust-lang/rust#90183
[90297]: rust-lang/rust#90297
[90329]: rust-lang/rust#90329
[90361]: rust-lang/rust#90361
[90417]: rust-lang/rust#90417
[90473]: rust-lang/rust#90473
[90491]: rust-lang/rust#90491
[90733]: rust-lang/rust#90733
[90833]: rust-lang/rust#90833
[90846]: rust-lang/rust#90846
[90896]: rust-lang/rust#90896
[91026]: rust-lang/rust#91026
[91207]: rust-lang/rust#91207
[91255]: rust-lang/rust#91255
[91301]: rust-lang/rust#91301
[cargo/10082]: rust-lang/cargo#10082
[cargo/10107]: rust-lang/cargo#10107
[`Metadata::is_symlink`]: https://doc.rust-lang.org/stable/std/fs/struct.Metadata.html#method.is_symlink
[`Path::is_symlink`]: https://doc.rust-lang.org/stable/std/path/struct.Path.html#method.is_symlink
[`{integer}::saturating_div`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.saturating_div
[`Option::unwrap_unchecked`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.unwrap_unchecked
[`Result::unwrap_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_unchecked
[`Result::unwrap_err_unchecked`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.unwrap_err_unchecked
[`NonZero{unsigned}::is_power_of_two`]: https://doc.rust-lang.org/stable/std/num/struct.NonZeroU8.html#method.is_power_of_two
[`File::options`]: https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.options
[`unix::process::ExitStatusExt::core_dumped`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.core_dumped
[`unix::process::ExitStatusExt::stopped_signal`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.stopped_signal
[`unix::process::ExitStatusExt::continued`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.continued
[`unix::process::ExitStatusExt::into_raw`]: https://doc.rust-lang.org/stable/std/os/unix/process/trait.ExitStatusExt.html#tymethod.into_raw
[`Duration::new`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.new
[`Duration::checked_add`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_add
[`Duration::saturating_add`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_add
[`Duration::checked_sub`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_sub
[`Duration::saturating_sub`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_sub
[`Duration::checked_mul`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_mul
[`Duration::saturating_mul`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.saturating_mul
[`Duration::checked_div`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.checked_div
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.as_secs_f64
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.as_secs_f32
[`Duration::from_secs_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_secs_f64
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_secs_f32
[`Duration::mul_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.mul_f64
[`Duration::mul_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.mul_f32
[`Duration::div_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_f64
[`Duration::div_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_f32
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_duration_f64
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.div_duration_f32
[`MaybeUninit::as_ptr`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_ptr
[`MaybeUninit::as_mut_ptr`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_mut_ptr
[`MaybeUninit::assume_init`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init
[`MaybeUninit::assume_init_ref`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. 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. merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tracking issue] dereferencing raw pointers inside constants (const_raw_ptr_deref)