Skip to content

RFC: goto-definition between From::from and Into::intoΒ #18316

Open
@ShoyuVanilla

Description

Currently if we trigger goto defintion here;

struct Foo;

fn foo() -> Foo {
    struct Bar;
    impl From<Bar> for Foo {
        fn from(_: Bar) -> Self {
            Foo
        }
    }
    Bar.into$0()
}

it just takes us to std::convert::Into<T>::into, because we do not have manual implementation of impl Into<Foo> for Bar here.

I think that it would be reasonable to provide two definition sources, std::convert::Into<T>::into(..) with the above fn from(..) inside the impl From<Bar> for Foo { .. } block as well, and implement similar thing to the opposite direction from(..) -> into(..).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-idegeneral IDE featuresC-featureCategory: feature request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions