Code
I tried this code in nightly:
pub fn parse(bytes: &[u8]) -> String {
std::ffi::CStr::from_bytes_until_nul(bytes)
.unwrap()
.to_str()
.unwrap()
.split('\n')
.map(str::trim_end)
.collect::<Box<_>>()
.join("\n")
}
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=be71e0fb8185c11ac3123de70b02cee6
I expected to see this happen: it compiles successfully
Instead, this happened:
error[E0282]: type annotations needed
--> src/lib.rs:8:10
|
8 | .collect::<Box<_>>()
| ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
9 | .join("\n")
| ---- type must be known at this point
|
help: consider specifying the generic argument
|
8 | .collect::<Vec<_>>()
| ~~~~~~~~~~
For more information about this error, try `rustc --explain E0282`.
error: could not compile `playground` (lib) due to 1 previous error
Version it worked on
It most recently worked on: Rust 1.79.0
Version with regression
nightly-2024-06-19
Code
I tried this code in nightly:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=be71e0fb8185c11ac3123de70b02cee6
I expected to see this happen: it compiles successfully
Instead, this happened:
Version it worked on
It most recently worked on: Rust 1.79.0
Version with regression
nightly-2024-06-19