Skip to content

Use core::ptr in implicit_provenance_casts help for no_std crates - #166287

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
bardiharborow:implicit-provenance-casts-no-std
Nov 22, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
bardiharborow:implicit-provenance-casts-no-std

Conversation

@bardiharborow

@bardiharborow bardiharborow commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

The int-to-ptr help message hardcoded std::ptr::with_exposed_provenance, which is misleading in no_std crates where only core::ptr is available.

This commit uses std_or_core to pick the right crate path, falling back to core in no_core crates. The documentation link in both the int-to-ptr and ptr-to-int notes now also points at the matching crate's docs.

@rustbot label +A-lints +A-diagnostics +T-compiler +D-papercut

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. D-papercut Diagnostics: An error or lint that needs small tweaks. labels Nov 21, 2026
@rust-log-analyzer

This comment has been minimized.

@bardiharborow
bardiharborow force-pushed the implicit-provenance-casts-no-std branch from 45ef1e3 to 432bf56 Compare November 21, 2026 01:06
@bardiharborow
bardiharborow marked this pull request as ready for review November 21, 2026 04:11
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 21, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 21, 2026
@rustbot

rustbot commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

rustbot has assigned @folkertdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 79 candidates
  • Random selection from 21 candidates

The int-to-ptr help message hardcoded `std::ptr::with_exposed_provenance`,
which is misleading in `no_std` crates where only `core::ptr` is available.

This commit uses `std_or_core` to pick the right crate path, falling back
to `core` in `no_core` crates. The documentation link in both the
int-to-ptr and ptr-to-int notes now also points at the matching crate's
docs.
@bardiharborow
bardiharborow force-pushed the implicit-provenance-casts-no-std branch from 432bf56 to 4599931 Compare November 21, 2026 04:54
@folkertdev

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 4599931 has been approved by folkertdev

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

Reason for tree closure: repeated failures in dist-x86_64-msvc

@rust-bors rust-bors Bot 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 21, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 21, 2026
…casts-no-std, r=folkertdev

Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates

The int-to-ptr help message hardcoded `std::ptr::with_exposed_provenance`, which is misleading in `no_std` crates where only `core::ptr` is available.

This commit uses `std_or_core` to pick the right crate path, falling back to `core` in `no_core` crates. The documentation link in both the int-to-ptr and ptr-to-int notes now also points at the matching crate's docs.
rust-bors Bot pushed a commit that referenced this pull request Nov 22, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #166266 (miri subtree update)
 - #164878 (Don't require `extern "llvm-intrinsic"` return structs to be `#[repr(packed)]`)
 - #165008 (Support `NonNull` pointers as `asm!` input operands)
 - #165892 (`rustc_builtin_macros` cleanup, part 10)
 - #165930 (Add red-green mark when dumping dep graph. Show DefIds if available)
 - #166280 (std: also mark doctests with skip_unsupported_miri_tests)
 - #166295 (use `cfg!(overflow_checks)` in `overflow_checks` intrinsic instead of `cfg!(debug_assertions)`)
 - #165618 (Implement RangeIntersect on core::range types)
 - #166012 (Added more queries to AdtDef in rustc_public to check for rust language types)
 - #166142 (Lower to `hir::Param`s for extern functions)
 - #166259 (fmt: Improve `Debug` for `FormattingOptions`)
 - #166269 (libcore: Revert some comment changes)
 - #166287 (Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates)
 - #166306 (bootstrap: Stop passing `-Ztrim-paths` to cargo now that it's stable in beta)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 22, 2026
…casts-no-std, r=folkertdev

Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates

The int-to-ptr help message hardcoded `std::ptr::with_exposed_provenance`, which is misleading in `no_std` crates where only `core::ptr` is available.

This commit uses `std_or_core` to pick the right crate path, falling back to `core` in `no_core` crates. The documentation link in both the int-to-ptr and ptr-to-int notes now also points at the matching crate's docs.
rust-bors Bot pushed a commit that referenced this pull request Nov 22, 2026
…uwer

Rollup of 13 pull requests

Successful merges:

 - #166266 (miri subtree update)
 - #155216 (match: Use an aggregate equality comparison for constant array/slice patterns)
 - #166142 (Lower to `hir::Param`s for extern functions)
 - #163315 (s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers)
 - #165238 (make conflicting_repr_hints a hard error)
 - #165366 (Add lint against duplicate parameter names in fns without body)
 - #166269 (libcore: Revert some comment changes)
 - #166287 (Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates)
 - #166306 (bootstrap: Stop passing `-Ztrim-paths` to cargo now that it's stable in beta)
 - #166309 (Add `#[must_use]` to `Ip*Addr::as_octets` methods)
 - #166315 (rustc_diagnostic_item macros added on some iter functions)
 - #166331 (Include Build IDs in VEX V5 executables)
 - #166349 (compiletest: Remove some old special-case code paths)
@rust-bors
rust-bors Bot merged commit e7b1c24 into rust-lang:main Nov 22, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 22, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 22, 2026
Rollup merge of #166287 - bardiharborow:implicit-provenance-casts-no-std, r=folkertdev

Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates

The int-to-ptr help message hardcoded `std::ptr::with_exposed_provenance`, which is misleading in `no_std` crates where only `core::ptr` is available.

This commit uses `std_or_core` to pick the right crate path, falling back to `core` in `no_core` crates. The documentation link in both the int-to-ptr and ptr-to-int notes now also points at the matching crate's docs.
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Nov 23, 2026
…uwer

Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#166266 (miri subtree update)
 - rust-lang/rust#155216 (match: Use an aggregate equality comparison for constant array/slice patterns)
 - rust-lang/rust#166142 (Lower to `hir::Param`s for extern functions)
 - rust-lang/rust#163315 (s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers)
 - rust-lang/rust#165238 (make conflicting_repr_hints a hard error)
 - rust-lang/rust#165366 (Add lint against duplicate parameter names in fns without body)
 - rust-lang/rust#166269 (libcore: Revert some comment changes)
 - rust-lang/rust#166287 (Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates)
 - rust-lang/rust#166306 (bootstrap: Stop passing `-Ztrim-paths` to cargo now that it's stable in beta)
 - rust-lang/rust#166309 (Add `#[must_use]` to `Ip*Addr::as_octets` methods)
 - rust-lang/rust#166315 (rustc_diagnostic_item macros added on some iter functions)
 - rust-lang/rust#166331 (Include Build IDs in VEX V5 executables)
 - rust-lang/rust#166349 (compiletest: Remove some old special-case code paths)
@rust-timer

Copy link
Copy Markdown
Collaborator

Note

This PR was benchmarked as part of triage of its containing rollup: triage URL.

Finished benchmarking commit (e3cc43e): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.9% [-1.2%, -0.1%] 8
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (secondary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.1% [2.5%, 8.8%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.3% [-7.6%, -4.1%] 3
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Artifact size: 406.41 MiB -> 405.70 MiB (-0.18%)

@rustbot rustbot added the perf-regression Performance regression. label Nov 23, 2026
@bardiharborow
bardiharborow deleted the implicit-provenance-casts-no-std branch November 23, 2026 05:17
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rustbot label: +perf-regression-triaged
Improvements and regressions are noise

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Nov 23, 2026
github-merge-queue Bot pushed a commit to rust-lang/miri that referenced this pull request Nov 23, 2026
…uwer

Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#166266 (miri subtree update)
 - rust-lang/rust#155216 (match: Use an aggregate equality comparison for constant array/slice patterns)
 - rust-lang/rust#166142 (Lower to `hir::Param`s for extern functions)
 - rust-lang/rust#163315 (s390x: replace -Ctarget-feature=+backchain with -Cforce-frame-pointers)
 - rust-lang/rust#165238 (make conflicting_repr_hints a hard error)
 - rust-lang/rust#165366 (Add lint against duplicate parameter names in fns without body)
 - rust-lang/rust#166269 (libcore: Revert some comment changes)
 - rust-lang/rust#166287 (Use `core::ptr` in `implicit_provenance_casts` help for `no_std` crates)
 - rust-lang/rust#166306 (bootstrap: Stop passing `-Ztrim-paths` to cargo now that it's stable in beta)
 - rust-lang/rust#166309 (Add `#[must_use]` to `Ip*Addr::as_octets` methods)
 - rust-lang/rust#166315 (rustc_diagnostic_item macros added on some iter functions)
 - rust-lang/rust#166331 (Include Build IDs in VEX V5 executables)
 - rust-lang/rust#166349 (compiletest: Remove some old special-case code paths)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-diagnostics Area: Messages for errors, warnings, and lints A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. D-papercut Diagnostics: An error or lint that needs small tweaks. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants