-
Notifications
You must be signed in to change notification settings - Fork 159
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
Dynamic objects support inheritance #914
Comments
You can't get from |
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914
1583: Support type resolution on super traits on dyn objects r=philberty a=philberty When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses Rust-GCC#914 gcc/rust/ChangeLog: * backend/rust-compile.cc: Add note about missing support for super traits. * typecheck/rust-tyty.cc (BaseType::satisfies_bound): New function. (BaseType::bounds_compatible): New function. (DynamicObjectType::get_object_items): New function. * typecheck/rust-hir-trait-ref.h: Use new API to perform type resolution on dyn objects.
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses Rust-GCC#914 gcc/rust/ChangeLog: * backend/rust-compile.cc: Add note about missing support for super traits. * typecheck/rust-tyty.cc (BaseType::satisfies_bound): New function. (BaseType::bounds_compatible): New function. (DynamicObjectType::get_object_items): New function. * typecheck/rust-hir-trait-ref.h: Use new API to perform type resolution on dyn objects.
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses Rust-GCC#914 gcc/rust/ChangeLog: * backend/rust-compile.cc: Add note about missing support for super traits. * typecheck/rust-tyty.cc (BaseType::satisfies_bound): New function. (BaseType::bounds_compatible): New function. (DynamicObjectType::get_object_items): New function. * typecheck/rust-hir-trait-ref.h: Use new API to perform type resolution on dyn objects.
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses Rust-GCC#914 gcc/rust/ChangeLog: * backend/rust-compile.cc: Add note about missing support for super traits. * typecheck/rust-tyty.cc (BaseType::satisfies_bound): New function. (BaseType::bounds_compatible): New function. (DynamicObjectType::get_object_items): New function. * typecheck/rust-hir-trait-ref.h: Use new API to perform type resolution on dyn objects.
When checking if specified bounds satisfy other bounds we must lookup the super traits. To finish the support for super traits we need to redo the computation of method addresses to support super traits. Addresses #914 gcc/rust/ChangeLog: * backend/rust-compile.cc: Add note about missing support for super traits. * typecheck/rust-tyty.cc (BaseType::satisfies_bound): New function. (BaseType::bounds_compatible): New function. (DynamicObjectType::get_object_items): New function. * typecheck/rust-hir-trait-ref.h: Use new API to perform type resolution on dyn objects.
New behavior: ICE!
|
This ICE isn't related to either t.baz() or t.qux() invocations, it's related to passing Foo(123) as a dynamic reference to Baz. Here's a minified reproducer of the same issue: #![allow(dead_code)]
struct Foo(i32);
trait Bar {
fn baz(&self);
}
trait Baz : Bar {
fn qux(&self);
}
impl Bar for Foo {
fn baz(&self) {
}
}
impl Baz for Foo {
fn qux(&self) {
}
}
pub fn main() {
let a = Foo(123);
let _b: &dyn Baz = &a;
} |
As a note, I think @bjorn3 's comment is out of date now. I'm able to compile the example @philberty posted without trouble on stable rustc:
|
gcc/rust/ChangeLog: * gcc/rust/backend/rust-compile.cc: Modify compute_address_for_trait_item to support supertraits gcc/testsuite/ChangeLog: * rust/execute/torture/trait14.rs: Add test for dynamic dispatch with supertraits Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
gcc/rust/ChangeLog: * backend/rust-compile.cc: Modify compute_address_for_trait_item to support supertraits * typecheck/rust-tyty.cc: Remove auto gcc/testsuite/ChangeLog: * rust/execute/torture/trait14.rs: Add test for dynamic dispatch with supertraits Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
gcc/rust/ChangeLog: * backend/rust-compile.cc: Modify compute_address_for_trait_item to support supertraits * typecheck/rust-tyty.cc: Remove auto gcc/testsuite/ChangeLog: * rust/execute/torture/trait14.rs: Add test for dynamic dispatch with supertraits Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
gcc/rust/ChangeLog: * backend/rust-compile.cc: Modify compute_address_for_trait_item to support supertraits * typecheck/rust-tyty.cc: Remove auto gcc/testsuite/ChangeLog: * rust/execute/torture/trait14.rs: Add test for dynamic dispatch with supertraits Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
I tried this code:
I expected to see this happen: compile without error
Instead, this happened:
Meta
The text was updated successfully, but these errors were encountered: