This example fails:
#[portrait::make()]
pub trait X {
fn m(&mut self);
}
struct MyStruct {}
impl X for MyStruct {
fn m(&mut self) {
println!("ok")
}
}
#[portrait::fill(portrait::delegate(T; self))]
impl<T> X for Box<T> where T: X {}
The problem is, that here we delegate to self. Doing this is useful - it allows to achieve similar things as the blanket crate does.
However, right now the generated code would do something like:
<T as X>::m(&mut self)
The reference and mutability need to be stripped when self is already of type &mut Self. Likely problem would show up also with other cases.
Pull request comes in a second.
This example fails:
The problem is, that here we delegate to
self. Doing this is useful - it allows to achieve similar things as theblanketcrate does.However, right now the generated code would do something like:
<T as X>::m(&mut self)The reference and mutability need to be stripped when
selfis already of type&mut Self. Likely problem would show up also with other cases.Pull request comes in a second.