Pass FnAbi to find_mir_or_eval_fn by tiif · Pull Request #133103 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation56 Commits1 Checks6 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

tiif

@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

Nov 16, 2024

@rustbot

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

RalfJung

@RalfJung

@rustbot rustbot added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Nov 24, 2024

@tiif

@RalfJung There are some refactorings needed to remove ExternAbi from find_mir_or_eval_fn. Specifically, all functions that call this.check_shim will need to be updated. Could I confirm if this direction is what we are going for?

@rust-log-analyzer

This comment has been minimized.

@RalfJung

Specifically, all functions that call this.check_shim will need to be updated.

Yeah, they should pass fn_abi to check_shim, and all the ExternAbi::C { unwind: false } become abi::Conv::C.

tiif

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

tiif

tiif

@rust-log-analyzer

This comment has been minimized.

@bors

@tiif

Interesting... for the same test, running on Linux will pass, but running on Windows will fail because of incompatible ABI.

For future reference:

This means that for the exact same function, whether we should use Conv::C or Conv::X86Stdcall depends on the target we are running? Or maybe I just did something bad somewhere...

EDIT: Ok nevermind, it's just I used Conv::X86Stdcall when it supposed to be Conv::C, even for the same tests, it hits different path for Windows and Linux.

@RalfJung

This means that for the exact same function, whether we should use Conv::C or Conv::X86Stdcall depends on the target we are running? Or maybe I just did something bad somewhere...

Yes that makes sense, Windows has some special rules here.

tiif

@tiif

I might continue to fix some cosmetic issues such as stray new lines, but this PR is ready for review

@rustbot ready

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Dec 14, 2024

RalfJung

Choose a reason for hiding this comment

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

Looks pretty good. :) Just some minor comments.

Comment on lines 936 to 938

if fn_abi.conv != exp_abi {
throw_ub_format!(
"calling a function with ABI {} using caller ABI {}",

Choose a reason for hiding this comment

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

Just use debug formatting for the error for now. We do the same in interpret/call.rs already.

The proper fix here would be a impl Display for Conv somewhere near this. If you want you can do that in a future PR. :)

Choose a reason for hiding this comment

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

Sure, I can open one after this.

@RalfJung

@rustbot rustbot added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Dec 15, 2024

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

Dec 17, 2024

@jieyouxu

Pass FnAbi to find_mir_or_eval_fn

rust-lang/miri#4013 needs information from FnAbi, hence it is passed to find_mir_or_eval_fn.

r? @RalfJung

@bors

@bors bors added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

labels

Dec 17, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Dec 18, 2024

@bors

…iaskrgr

Rollup of 7 pull requests

Successful merges:

Failed merges:

r? @ghost @rustbot modify labels: rollup

@tiif

I will need some time to figure out how to resolve the merge conflict, and will request for r+ again after resolving it.

@tiif

Hmm this is weird, the import is valid and I didn't change anything from attr, but got this error:

--> compiler/rustc_hir/src/hir.rs:5:5 | 5 | use rustc_ast::attr::AttributeExt; | ^^^^^^^^^^^^^^^^^------------ | | | | | help: a similar name exists in the module: Attribute | no AttributeExt in attr

error[E0432]: unresolved import rustc_ast::UnsafeBinderCastKind --> compiler/rustc_hir/src/hir.rs:14:57 | 14 | ImplPolarity, IsAuto, Movability, Mutability, UnOp, UnsafeBinderCastKind, | ^^^^^^^^^^^^^^^^^^^^ no UnsafeBinderCastKind in the root

error[E0432]: unresolved import rustc_ast::attr::AttributeExt --> compiler/rustc_hir/src/lang_items.rs:10:5 | 10 | use rustc_ast::attr::AttributeExt; | ^^^^^^^^^^^^^^^^^------------ | | | | | help: a similar name exists in the module: Attribute | no AttributeExt in attr

For more information about this error, try rustc --explain E0432.

@oli-obk since you reviewed #134381, do you know what's going on here and how to resolve this?

@oli-obk

That's weird. Sounds like a cache issue where it doesn't think a crate has changed when it acrually has. Worst case try x clean

@rust-log-analyzer

This comment has been minimized.

@tiif

@bors

@tiif

@RalfJung

@oli-obk

@bors

@oli-obk

@bors

📌 Commit fd8b983 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-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Dec 19, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Dec 20, 2024

@bors

Rollup of 6 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Dec 20, 2024

@rust-timer

Rollup merge of rust-lang#133103 - tiif:fnabi, r=RalfJung

Pass FnAbi to find_mir_or_eval_fn

rust-lang/miri#4013 needs information from FnAbi, hence it is passed to find_mir_or_eval_fn.

r? @RalfJung

@tiif tiif mentioned this pull request

Jan 21, 2025

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.