Closed
Description
See discussion here: #41531.
To summarize, the following should work, but currently doesn't. It's likely that implementing impl<P: AsRef<OsStr>> FromIterator<P> for PathBuf
would solve this, but I haven't tested.
use std::path::{PathBuf, Path};
fn main() {
let path = Path::new("a/b/c/d");
println!("{:?}", path.components().filter(|c| c.as_os_str() != "b").collect::<PathBuf>());
}