Skip to content

"note: deref defined here", but it doesn't actually show anything #87060

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
meithecatte opened this issue Jul 11, 2021 · 0 comments · Fixed by #87088
Closed

"note: deref defined here", but it doesn't actually show anything #87060

meithecatte opened this issue Jul 11, 2021 · 0 comments · Fixed by #87088
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@meithecatte
Copy link
Contributor

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".

@meithecatte meithecatte added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 11, 2021
@jonas-schievink jonas-schievink added the C-bug Category: This is a bug. label Jul 11, 2021
@bors bors closed this as completed in e422612 Sep 11, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants