Skip to content

goto-definition for include*!(expr), where expr is not a string literal #15836

@cyqsimon

Description

@cyqsimon

Related: #3767, #5871,#9149.

At the moment, rust-analyzer already supports goto-definition when including a file with a string literal. However the following case is not addressed:

// from https://docs.rs/phf_codegen/0.11.2/phf_codegen/#examples
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));

Not having support for this case is especially inconvenient because OUT_DIR may change for each build, and finding the correct file in target/$PROFILE/build/$CRATE_NAME-$HASH/out is not the easiest thing in the world.

Right now I deliberately keep an unused item in the generated file, so that rust-analyzer marks it as containing a warning, allowing me to find it quickly in the file tree. Obviously this is a terrible hack and won't work for non Rust source files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions