-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Suppose we have:
reflect::library! {
extern crate demo {
trait Demo {
fn f(&self);
}
trait SomeTrait {}
fn dynamic_dispatch(&dyn SomeTrait);
fn static_dispatch<T: SomeTrait>(&T);
}
}and our user's derive(Demo) macro is being invoked on:
#[derive(Demo)]
struct S<T> {
field: T,
}Then if they do:
let field = receiver.get_field("field");
RUNTIME::demo::dynamic_dispatch.INVOKE(field);
// OR
RUNTIME::demo::static_dispatch.INVOKE(field);then reflect needs to identify that these INVOKEs require a trait bound and emit the right bound on the impl we generate.
impl<T> demo::Demo for S<T>
where
T: demo::SomeTrait, // inferred
{
fn f(&self) {
demo::dynamic_dispatch(&self.field);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels