Skip to content

doc: mention that intrinsics should not be called in user code #142439

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

Merged
merged 1 commit into from
Jun 14, 2025

Conversation

scrabsha
Copy link
Contributor

@scrabsha scrabsha commented Jun 12, 2025

Intrinsic functions declared in std::intrinsics are an implementation detail and should not be called directly by the user. The compiler explicitly warns against their use in user code:

warning: the feature `core_intrinsics` is internal to the compiler or standard library
 --> src/lib.rs:1:12
  |
1 | #![feature(core_intrinsics)]
  |            ^^^^^^^^^^^^^^^
  |
  = note: using it is strongly discouraged
  = note: `#[warn(internal_features)]` on by default

Playground link

This PR documents what the compiler warning says: these intrinsics should not be used in user code.

@rustbot
Copy link
Collaborator

rustbot commented Jun 12, 2025

r? @workingjubilee

rustbot has assigned @workingjubilee.
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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 12, 2025

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

@rust-log-analyzer

This comment has been minimized.

@scrabsha scrabsha force-pushed the rust/sasha/uwkqrkztvqry branch from 346303b to 55beb4b Compare June 12, 2025 22:39
@scrabsha scrabsha force-pushed the rust/sasha/uwkqrkztvqry branch from 55beb4b to 30872d0 Compare June 13, 2025 10:51
Intrinsic functions declared in `std::intrinsics` are an implementation
detail and should not be called directly by the user. The compiler
explicitly warns against their use in user code:

```
warning: the feature `core_intrinsics` is internal to the compiler or standard library
 --> src/lib.rs:1:12
  |
1 | #![feature(core_intrinsics)]
  |            ^^^^^^^^^^^^^^^
  |
  = note: using it is strongly discouraged
  = note: `#[warn(internal_features)]` on by default
```

[**Playground link**]

This PR documents what the compiler warning says: these intrinsics should
not be called outside the standard library.

[**Playground link**]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=1c893b0698291f550bbdde0151fd221b
@scrabsha scrabsha force-pushed the rust/sasha/uwkqrkztvqry branch from 30872d0 to 527f35a Compare June 13, 2025 12:58
@RalfJung
Copy link
Member

Looks good, thanks!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 13, 2025

📌 Commit 527f35a has been approved by RalfJung

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 13, 2025
bors added a commit that referenced this pull request Jun 14, 2025
Rollup of 16 pull requests

Successful merges:

 - #140969 (Allow initializing logger with additional tracing Layer)
 - #141352 (builtin dyn impl no guide inference)
 - #142046 (add Vec::peek_mut)
 - #142273 (tests: Minicore `extern "gpu-kernel"` feature test)
 - #142302 (Rework how the disallowed qualifier in function type diagnostics are generated)
 - #142405 (Don't hardcode the intrinsic return types twice in the compiler)
 - #142434 ( Pre-install JS dependencies in tidy Dockerfile)
 - #142439 (doc: mention that intrinsics should not be called in user code)
 - #142441 (Delay replacing escaping bound vars in `FindParamInClause`)
 - #142449 (Require generic params for const generic params)
 - #142452 (Remove "intermittent" wording from `ReadDir`)
 - #142459 (Remove output helper bootstrap)
 - #142460 (cleanup search graph impl)
 - #142461 (compiletest: Clarify that `--no-capture` is needed with `--verbose`)
 - #142475 (Add platform support docs & maintainers for *-windows-msvc)
 - #142480 (tests: Convert two handwritten minicores to add-core-stubs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2f56557 into rust-lang:master Jun 14, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 14, 2025
rust-timer added a commit that referenced this pull request Jun 14, 2025
Rollup merge of #142439 - scrabsha:rust/sasha/uwkqrkztvqry, r=RalfJung

doc: mention that intrinsics should not be called in user code

Intrinsic functions declared in `std::intrinsics` are an implementation detail and should not be called directly by the user. The compiler explicitly warns against their use in user code:

```
warning: the feature `core_intrinsics` is internal to the compiler or standard library
 --> src/lib.rs:1:12
  |
1 | #![feature(core_intrinsics)]
  |            ^^^^^^^^^^^^^^^
  |
  = note: using it is strongly discouraged
  = note: `#[warn(internal_features)]` on by default
```

[**Playground link**]

This PR documents what the compiler warning says: these intrinsics should not be used in user code.

[**Playground link**]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=1c893b0698291f550bbdde0151fd221b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants