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

Recursive generic function with std::fmt::Borrow bound expects the same generic type for recursive call #58510

Closed
timvermeulen opened this issue Feb 16, 2019 · 2 comments
Labels
A-typesystem Area: The type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@timvermeulen
Copy link
Contributor

fn f<T: ?Sized>(_: &T)
where
    String: std::borrow::Borrow<T>,
{
    // doesn't compile:
    f("");
    
    // compiles:
    f::<str>("");
}
error[E0308]: mismatched types
 --> src/lib.rs:6:7
  |
6 |     f("");
  |       ^^ expected type parameter, found str
  |
  = note: expected type `&T`
             found type `&'static str`
@jonas-schievink jonas-schievink added A-typesystem Area: The type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 16, 2019
@ExpHP
Copy link
Contributor

ExpHP commented Feb 19, 2019

See #24066

@Enselic
Copy link
Member

Enselic commented Nov 20, 2023

Triage: Closing as duplicate of #24066 because the root cause is likely the same.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants