Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Borrow<T> leads to T being unknown in a generic blanket impl #17170

Closed
sunrosa opened this issue May 1, 2024 · 3 comments
Closed

Borrow<T> leads to T being unknown in a generic blanket impl #17170

sunrosa opened this issue May 1, 2024 · 3 comments
Assignees
Labels
C-bug Category: bug

Comments

@sunrosa
Copy link

sunrosa commented May 1, 2024

I am using rust-analyzer VScode extension v0.3.1940 and rustc 1.77.2. I am having this issue with borrow(). With the impl below:
image

It is resolving to unknown and not linting, but has no compiler errors:
image

And of course, there is no linting when trying to access fields of the unknown type.

@sunrosa sunrosa added the C-bug Category: bug label May 1, 2024
@sunrosa sunrosa changed the title Borrow<T> leads to T being unknown in a generic trait impl Borrow<T> leads to T being unknown in a generic blanket impl May 1, 2024
@Kohei316
Copy link
Contributor

Kohei316 commented May 5, 2024

@rustbot claim

@DavidArchibald
Copy link

I believe I've run into this issue as well. Here's my own reproduction:

fn broken_into_inference(into_string: impl Into<String>) {
    let should_be_string = into_string.into();

    should_be_string.len();
}

should_be_string is displayed with a type of {unknown} and the documentation for stuff like len won't show up. Using the wrong methods still shows up as an error but I think that's because of a rustc pass or something.

I'm going to assume the root cause is the same, hence why this isn't its own issue. I just want to make sure it gets looked at alongside this reproduction, just in case the root causes are different.

@flodiebold
Copy link
Member

Both of these are cases of #5514.

@flodiebold flodiebold closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants