Closed
Description
This code fails to compile on nightly 2018-05-20 (playground):
use std::borrow::{Borrow, Cow};
fn takes_into_cow<'a, T: Into<Cow<'a, str>>>(x: T) {
let s = x.into();
println!("{}", s);
}
fn forward_cow<'a>(x: Cow<'a, str>) {
takes_into_cow(x.borrow())
}
fn main() {
forward_cow("test".into());
}
With this error:
error[E0283]: type annotations required: cannot resolve `std::borrow::Cow<'_, str>: std::borrow::Borrow<_>`
--> src/main.rs:9:22
|
9 | takes_into_cow(x.borrow())
| ^^^^^^
This compiles fine on stable and beta, and probably on nightly as well until some time in the last week or so.
This is a simplified version of the code involved in rwf2/Rocket#643.
Metadata
Metadata
Assignees
Labels
No labels