Skip to content

Slice coercion is too conservative with generic receiver. #29504

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

Closed
nagisa opened this issue Nov 1, 2015 · 1 comment
Closed

Slice coercion is too conservative with generic receiver. #29504

nagisa opened this issue Nov 1, 2015 · 1 comment
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@nagisa
Copy link
Member

nagisa commented Nov 1, 2015

fn main(){
    let x = "hello world";
    let y = ['h', 'e'];
    println!("{:?}", x.find(&y));
}

will not compile with “error: the trait core::ops::Fn<(char,)> is not implemented for the type [char; 2]”, but there’s impl<'a, 'b> Pattern<'a> for &'b [char], which could’ve been used if coercion happened.

@steveklabnik steveklabnik added T-lang Relevant to the language team, which will review and decide on the PR/issue. and removed A-lang labels Mar 24, 2017
@Mark-Simulacrum
Copy link
Member

Closing in favor of #39511.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants