Skip to content

method-probing machinery can false-negative because it doesn't know about associated types #46460

Open
@zackmdavis

Description

@zackmdavis

As part of the endeavor that also prompted #46459, it was noticed that we never generated a suggestion for .to_owned() even where it would be appropriate. Some strategic logging in matches_return_type revealed that the result being returned by .can_sub was—

Err(
    Sorts(
        ExpectedFound {
            expected: <_ as std::borrow::ToOwned>::Owned,
            found: std::string::String
        }
    )
)

But in this case, ToOwned::Owned should have been String.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions