Closed
Description
Given the following code: (playground)
fn main() {
let x = std::path::PathBuf::new();
std::fs::create_dir(x);
dbg!(x.join("x"));
}
The current output is:
error[E0382]: borrow of moved value: `x`
--> src/main.rs:4:10
|
2 | let x = std::path::PathBuf::new();
| - move occurs because `x` has type `PathBuf`, which does not implement the `Copy` trait
3 | std::fs::create_dir(x);
| - value moved here
4 | dbg!(x.join("x"));
| ^^^^^^^^^^^ value borrowed here after move
|
= note: borrow occurs due to deref coercion to `Path`
note: deref defined here
It would seem as if something is supposed to come after "deref defined here".