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

Proper handling of intrinsics with #[rustc_intrinsic_must_be_overridden] #79

Open
celinval opened this issue May 23, 2024 · 0 comments · Fixed by rust-lang/rust#126361

Comments

@celinval
Copy link
Contributor

rust-lang/rust#120675 introduced a new mechanism to declare intrinsics which will potentially replace the rust-intrinsic ABI. The new mechanism introduces a dummy body and mark the intrinsic with #[rustc_intrinsic_must_be_overridden].

I believe we can maintain the same interface we have so far, and we can change the has_body check for instances. For the case of an intrinsic, we return that a body is not available if rustc_intrinsic_must_be_overridden annotation is present.

@oli-obk, would that make sense?

celinval added a commit to celinval/kani-dev that referenced this issue Jun 12, 2024
  - Enable Kani to use fallback fn body for intrinsics, so they can
    be verified.
    - Until <rust-lang/project-stable-mir#79>
      is implemented, we have to check has_body and must_be_overridden
  - Export all kani_macro definitions. Rename `unstable` to avoid
    conflict with the Rust standard library one.
  - Dump stable mir body since transformations are made at that level.
    - I just did this as I was debugging things.
tautschnig added a commit to model-checking/kani that referenced this issue Jun 12, 2024
- Enable Kani to use fallback fn body for intrinsics, so they can be
verified.
- Until <rust-lang/project-stable-mir#79> is
implemented, we have to check has_body and must_be_overridden
- Export all kani_macro definitions. Rename `unstable` to avoid conflict
with the Rust standard library one.
  - Dump stable mir body since transformations are made at that level.
    - I just did this as I was debugging things.

Co-authored-by: Michael Tautschnig <tautschn@amazon.com>
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 15, 2024
…li-obk

Unify intrinsics body handling in StableMIR

rust-lang#120675 introduced a new mechanism to declare intrinsics which will potentially replace the rust-intrinsic ABI.

The new mechanism introduces a placeholder body and mark the intrinsic with `#[rustc_intrinsic_must_be_overridden]`.
In practice, this means that a backend should not generate code for the placeholder, and shim the intrinsic.
The new annotation is an internal compiler implementation, and it doesn't need to be exposed to StableMIR users.

In this PR, we unify the interface for intrinsics marked with `rustc_intrinsic_must_be_overridden` and intrinsics that do not have a body.

Fixes rust-lang/project-stable-mir#79

r? `@oli-obk`

cc: `@momvart`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 15, 2024
…li-obk

Unify intrinsics body handling in StableMIR

rust-lang#120675 introduced a new mechanism to declare intrinsics which will potentially replace the rust-intrinsic ABI.

The new mechanism introduces a placeholder body and mark the intrinsic with `#[rustc_intrinsic_must_be_overridden]`.
In practice, this means that a backend should not generate code for the placeholder, and shim the intrinsic.
The new annotation is an internal compiler implementation, and it doesn't need to be exposed to StableMIR users.

In this PR, we unify the interface for intrinsics marked with `rustc_intrinsic_must_be_overridden` and intrinsics that do not have a body.

Fixes rust-lang/project-stable-mir#79

r? ``@oli-obk``

cc: ``@momvart``
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 15, 2024
Rollup merge of rust-lang#126361 - celinval:issue-0079-intrinsic, r=oli-obk

Unify intrinsics body handling in StableMIR

rust-lang#120675 introduced a new mechanism to declare intrinsics which will potentially replace the rust-intrinsic ABI.

The new mechanism introduces a placeholder body and mark the intrinsic with `#[rustc_intrinsic_must_be_overridden]`.
In practice, this means that a backend should not generate code for the placeholder, and shim the intrinsic.
The new annotation is an internal compiler implementation, and it doesn't need to be exposed to StableMIR users.

In this PR, we unify the interface for intrinsics marked with `rustc_intrinsic_must_be_overridden` and intrinsics that do not have a body.

Fixes rust-lang/project-stable-mir#79

r? ``@oli-obk``

cc: ``@momvart``
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jun 17, 2024
Unify intrinsics body handling in StableMIR

rust-lang/rust#120675 introduced a new mechanism to declare intrinsics which will potentially replace the rust-intrinsic ABI.

The new mechanism introduces a placeholder body and mark the intrinsic with `#[rustc_intrinsic_must_be_overridden]`.
In practice, this means that a backend should not generate code for the placeholder, and shim the intrinsic.
The new annotation is an internal compiler implementation, and it doesn't need to be exposed to StableMIR users.

In this PR, we unify the interface for intrinsics marked with `rustc_intrinsic_must_be_overridden` and intrinsics that do not have a body.

Fixes rust-lang/project-stable-mir#79

r? ``@oli-obk``

cc: ``@momvart``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant