Skip to content

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

Closed
@meithecatte

Description

@meithecatte

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

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions