Skip to content

ICE with deep DST coercion #19404

Closed
@Kimundi

Description

@Kimundi

Error:

figment_sketch.rs:1:1: 1:1 error: internal compiler error: Encountered errors `[FulfillmentError(Obligation(trait_ref=<_ : core::kinds::Sized>,depth=1),Unimplemented)]` fulfilling `<*mut alloc::rc::RcBox<Component+'static> : core::ptr::RawPtr<alloc::rc::RcBox<Component+'static>>>` during trans
figment_sketch.rs:1 use std::intrinsics::TypeId;
                    ^

Reproduces with:

use std::intrinsics::TypeId;
use std::rc::Rc;

type Fp<T> = Rc<T>;

struct Engine;

trait Component: 'static {}
impl Component for Engine {}

trait Env {
    fn get_component_type_id(&self, type_id: TypeId) -> Option<Fp<Component>>;
}

impl<'a> Env+'a {
    fn get_component<T: Component>(&self) -> Option<Fp<T>> {
        // This line is needed to cause the error:
        let x = self.get_component_type_id(TypeId::of::<T>());
        None
    }
}

trait Figment {
    fn init(&mut self, env: &Env);
}


struct MyFigment;

impl Figment for MyFigment {
    fn init(&mut self, env: &Env) {
        let engine = env.get_component::<Engine>();
    }
}

fn main() {

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions