You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I understand, internally, a dynamic reference is a vtable containing all the required struct items, and method pointers. Since rust supports parent and child traits (supertraits), I believe casting from &dyn Child -> &dyn parent requires pruning the Child's vtable to match the Parent's vtable, as far as gccrs is concerned. Rust does not have a specified ABI in this case, so we do not need to conform to some specific vtable layout.
As of writing, rustc stable does not support dynamic upcasting, but the RFC is implemented in nightly rust. Meaning it's likely we will have to support this at some point to remain compliant with rustc.
Summary
This issue is created because of a comment under #3124.
Background: https://rust-lang.github.io/rfcs/3324-dyn-upcasting.html
As far as I understand, internally, a dynamic reference is a vtable containing all the required struct items, and method pointers. Since rust supports parent and child traits (supertraits), I believe casting from &dyn Child -> &dyn parent requires pruning the Child's vtable to match the Parent's vtable, as far as gccrs is concerned. Rust does not have a specified ABI in this case, so we do not need to conform to some specific vtable layout.
As of writing, rustc stable does not support dynamic upcasting, but the RFC is implemented in nightly rust. Meaning it's likely we will have to support this at some point to remain compliant with rustc.
Reproducer
I tried this code:
Does the code make use of any (1.49) nightly feature ?
Godbolt link
No response
Actual behavior
Crash in the gimple verifier
Expected behavior
Either we need to gate this conversion until rustc stabilizes the behavior, or implement the feature once stabilized.
GCC Version
c5f9d6d
The text was updated successfully, but these errors were encountered: