Closed
Description
The following file compiles on Rust 1.27.0:
use std::borrow::Cow;
struct Widget<'a> {
handle: &'a u32,
}
impl<'a> Widget<'a> {
pub fn new<S>(host: S) -> Result<Widget<'a>, String> where S: Into<Cow<'a, str>> {
unimplemented!();
}
}
pub fn main() {
let host: String = "localhost".to_string();
Widget::new(host.as_ref()).unwrap();
}
On 1.28.0, it fails with the following message:
error[E0283]: type annotations required: cannot resolve `std::string::String: std::convert::AsRef<_>`
--> example.rs:15:22
|
15 | Widget::new(host.as_ref()).unwrap();
| ^^^^^^
error: aborting due to previous error
I found #48668 which looks related, but it happened around 1.25.0.
The regression is still present in Rust 1.29.2.
Metadata
Metadata
Assignees
Labels
No labels