-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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".
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.