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

AsRef + Into bound not working in Nightly (2019-06-17) #61928

Closed
95th opened this issue Jun 18, 2019 · 2 comments
Closed

AsRef + Into bound not working in Nightly (2019-06-17) #61928

95th opened this issue Jun 18, 2019 · 2 comments

Comments

@95th
Copy link
Contributor

95th commented Jun 18, 2019

Below code compiles on Rust 1.35.0 stable:

Code A:

fn foo(>) {
    let s = "hello world".to_string();
    bar(s.as_ref());
}

fn bar<T: AsRef<str> + Into<String>>(s: T) {
    println!("{}", s.into());
}

and following doesn't work on Rust 1.35.0 stable:
Code B:

fn foo() {
    let s = "hello world".to_string();
    bar(&s);
}

fn bar<T: AsRef<str> + Into<String>>(s: T) {
    println!("{}", s.into());
}

But on nightly (2019-06-17) rust, Code B compiles while Code A doesn't.

@tesuji
Copy link
Contributor

tesuji commented Jun 18, 2019

Duplicate of #60958

@95th
Copy link
Contributor Author

95th commented Jun 18, 2019

Hm.. that explains the breaking behavior.. Thanks .

@95th 95th closed this as completed Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants