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

Add support to intrinsics fallback body #123659

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

celinval
Copy link
Contributor

@celinval celinval commented Apr 9, 2024

Before this fix, the call to body() would crash, since has_body() would return true, but we would try to retrieve the body of an intrinsic which is not allowed.

Instead, the Instance::body() function will now convert an Intrinsic into an Item before retrieving its body.

Note: I also changed how we monomorphize the instance body. Unfortunately, the call still ICE for some shims.

r? @oli-obk

Before this fix, the call to `body()` would crash, since `has_body()`
would return true, but we would try to retrieve the body of an intrinsic
which is not allowed.

Instead, the `Instance::body()` function will now convert an Intrinsic
into an Item before retrieving its body.
@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 Apr 9, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 9, 2024

This PR changes Stable MIR

cc @oli-obk, @celinval, @ouz-a

@oli-obk
Copy link
Contributor

oli-obk commented Apr 9, 2024

Unfortunately, the call still ICE for some shims.

do you have an example program that hits that ICE?

@celinval
Copy link
Contributor Author

celinval commented Apr 9, 2024

Unfortunately, the call still ICE for some shims.

do you have an example program that hits that ICE?

If you remove the if condition and run the ui-fulldeps/stable-mir suite, it will ICE in a few tests.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 10, 2024

The problem was the anonymous constant in the array length, because without the generic_const_exprs feature gate, we don't give those anon consts any generics and instead rely on const eval and the rest of the compiler just handling anon consts whose body just returns a generic param

@oli-obk
Copy link
Contributor

oli-obk commented Apr 10, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 10, 2024

📌 Commit 1cbe927 has been approved by oli-obk

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 Apr 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2024
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#118391 (Add `REDUNDANT_LIFETIMES` lint to detect lifetimes which are semantically redundant)
 - rust-lang#123534 (Windows: set main thread name without re-encoding)
 - rust-lang#123659 (Add support to intrinsics fallback body)
 - rust-lang#123689 (Add const generics support for pattern types)
 - rust-lang#123701 (Only assert for child/parent projection compatibility AFTER checking that theyre coming from the same place)
 - rust-lang#123702 (Further cleanup cfgs in the UI test suite)
 - rust-lang#123706 (rustdoc: reduce per-page HTML overhead)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2b4c581 into rust-lang:master Apr 10, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2024
Rollup merge of rust-lang#123659 - celinval:smir-fix-intrinsic, r=oli-obk

Add support to intrinsics fallback body

Before this fix, the call to `body()` would crash, since `has_body()` would return true, but we would try to retrieve the body of an intrinsic which is not allowed.

Instead, the `Instance::body()` function will now convert an Intrinsic into an Item before retrieving its body.

Note: I also changed how we monomorphize the instance body. Unfortunately, the call still ICE for some shims.

r? `@oli-obk`
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-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.

4 participants