Skip to content

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

Closed
@95th

Description

@95th

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions