Skip to content

No abstraction edge generated for call to a.get() in main #142

@zgrannan

Description

@zgrannan
trait Foo<'a> {
    fn get<'b, T: FromMutref<'b>>(&'b mut self) -> T;
}

struct A<'a> {
    f: &'a mut i32,
}

impl<'a> Foo<'a> for A<'a> {
    fn get<'b, T: FromMutref<'b>>(&'b mut self) -> T {
        T::from_mutref(&mut self.f)
    }
}

trait FromMutref<'a> {
    fn from_mutref(x: &'a mut i32) -> Self;
}

impl<'a> FromMutref<'a> for &'a mut i32 {
    fn from_mutref(x: &'a mut i32) -> Self { x }
}

fn main() {
    let mut i = 42;
    let mut a = A {
        f: &mut i,
    };
    let b = a.get::<&mut i32>();
    *b = 1;
    println!("{i}");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions