Closed
Description
I tried this code:
pub struct Datum {
/// The name of this datum.
pub name: String,
/// Whether the datum indicates support for the platform or not.
pub pass: bool,
/// Short additional information to display to the user.
pub info: Option<String>,
/// Longer explanatory message on how to resolve problems.
pub mesg: Option<String>,
}
fn dev_kvm() -> super::Datum {
let dev_kvm = std::path::Path::new("/dev/kvm");
super::Datum {
name: "Driver".into(),
pass: dev_kvm.exists(),
info: Some("/dev/kvm".into()),
mesg: None,
}
}
I expected to see this happen:
Successful compilation. This has compiled and worked for years until nightly-2021-10-01
. Reverting to nightly-2021-09-30
produces a successful compilation.
Instead, this happened:
error[E0277]: the trait bound `std::string::String: From<&str>` is not satisfied
--> src/backend/kvm/mod.rs:23:24
|
23 | name: "Driver".into(),
| ^^^^ the trait `From<&str>` is not implemented for `std::string::String`
|
= note: required because of the requirements on the impl of `Into<std::string::String>` for `&str`
help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
|
19 | fn dev_kvm() -> super::Datum where std::string::String: From<&str> {
| +++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `std::string::String: From<&str>` is not satisfied
--> src/backend/kvm/mod.rs:25:20
|
25 | info: Some("/dev/kvm".into()),
| ---- ^^^^^^^^^^^^^^^^^ the trait `From<&str>` is not implemented for `std::string::String`
| |
| required by a bound introduced by this call
|
= note: required because of the requirements on the impl of `Into<std::string::String>` for `&str`
help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
|
19 | fn dev_kvm() -> super::Datum where std::string::String: From<&str> {
| +++++++++++++++++++++++++++++++++++++
Meta
rustc --version --verbose
:
rustc 1.57.0-nightly (aa7aca3b9 2021-09-30)
binary: rustc
commit-hash: aa7aca3b954131720df725e70d12e902eb3be1de
commit-date: 2021-09-30
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0