Skip to content

Don't hardcode the intrinsic return types twice in the compiler #142405

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 14, 2025

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 12, 2025

We already manually check intrinsic types in intrinsicck so we don't need to do it in the interpreter

@rustbot
Copy link
Collaborator

rustbot commented Jun 12, 2025

r? @matthewjasper

rustbot has assigned @matthewjasper.
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-compiler Relevant to the compiler 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 CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

.instantiate(self.tcx.tcx, instance.args)
.output()
.no_bound_vars()
.unwrap();
let val = self
.ctfe_query(|tcx| tcx.const_eval_global_id(self.typing_env, gid, tcx.span))?;
Copy link
Member

Choose a reason for hiding this comment

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

I feel like ideally the query would return a value+type pair... but that's probably a pretty big refactor.

Copy link
Contributor Author

@oli-obk oli-obk Jun 12, 2025

Choose a reason for hiding this comment

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

oh heh, looking into the query I realized that I went through an overly complex route to get at the type. I'm using the same logic now. Oh nevermind, that just got me a FnDef, not its return type. My original thing was right

Returning the type may be useful in more places, but it may also be a perf regression for just a bit of convenience, we'll have to experiment

@RalfJung
Copy link
Member

r=me when CI is happy

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 13, 2025

@bors r=RalfJung

@bors
Copy link
Collaborator

bors commented Jun 13, 2025

📌 Commit de4e7ad 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
@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 13, 2025

@bors rollup

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 179bcf6 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 #142405 - oli-obk:type-once, r=RalfJung

Don't hardcode the intrinsic return types twice in the compiler

We already manually check intrinsic types in intrinsicck so we don't need to do it in the interpreter
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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