Skip to content

include! macro silently gives empty string if destination file is outside of the crate #17040

Open
@saschanaz

Description

@saschanaz

rust-analyzer version: 0.3.1916-standalone (7a8374c 2024-04-08)

rustc version: rustc 1.77.2 (25ef9e3d8 2024-04-09)

editor or extension: VSCode, rust-analyzer v0.3.1916

relevant settings: N/A?

repository link (if public, optional): https://github.com/saschanaz/rust-include-repro

code snippet to reproduce: (Please refer to the repo to see the exact file tree)

include!("in-src.rs");
include!("../in-crate.rs");
include!("../../in-workspace.rs");

fn main() {
    in_src();
    in_crate();
    in_workspace();
}

The issue is threefold:

  1. The function name of in_workspace does not autocomplete in main()
  2. Hovering over in_workspace(); shows nothing
  3. Clicking "Inline macro" feature from light bulb menu for include!("../../in-workspace.rs") just deletes the line

The build result works as expected, so this should be rust-analyzer specific.

See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1890431

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions