brownsys/paralegal

Resolving virtual methods with generic arguments does not work.

JustusAdam opened this issue · 0 comments

Setup:

#[paralegal::marker(sink, arguments = [0])]
fn actual_sink<T>(t: T) {}

#[paralegal::analyze]
fn main<S: Snk>(s: &S) {
    s.sink(0)
}

When the trait Snk is defined with a method that does not take a generic parameter then calling Instance::resolve returns a Virtual instance.

trait Snk {
    fn sink(&self, t: usize) {
        actual_sink(t)
    }
}

However if the argument is generic, instance resolution fails.

trait Snk {
    fn sink<T>(&self, t: T) {
        actual_sink(t)
    }
}