I have some existing code which has been broken by the 1.90 release. The code below, on playground, fails to compile with 1.90, but succeeded without as much as a warning on 1.89.
Is this a bug? I don't understand why the trait can't resolve as I expect it to, but I haven't dug too deeply. However all my builds are broken now, yikes!
use std::ffi::CString;
fn main() {
assert_eq!(CString::from(c"foo"), c"foo".into());
}
Compiling playground v0.0.1 (/playground)
error[E0283]: type annotations needed
--> src/main.rs:4:46
|
4 | assert_eq!(CString::from(c"foo"), c"foo".into());
| ^^^^
|
= note: cannot satisfy `_: From<&CStr>`
= note: required for `&CStr` to implement `Into<_>`
help: try using a fully qualified path to specify the expected types
|
4 - assert_eq!(CString::from(c"foo"), c"foo".into());
4 + assert_eq!(CString::from(c"foo"), <&CStr as Into<T>>::into(c"foo"));
|
For more information about this error, try `rustc --explain E0283`.
error: could not compile `playground` (bin "playground") due to 1 previous error
I have found that those new to rust (especially coming from C) are more comfortable seeing the more-explicit some_cstring.as_c_str(), but it all amounts to the same thing Thanks again for your help.
Do these comparisons take place by comparing them as byte strings by any chance? If not, I'm confused how that could possibly work, as C-strings don't have to be valid UTF-8.