Closed
Description
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() {
}