Skip to content

Rust-analyzer uses lowercase letters for Windows drives #14683

Closed
@jyn514

Description

@jyn514

When I run x check in the rust-lang/rust repo, it unconditionally recompiles rustc_llvm on Windows only. CARGO_LOG=info shows the following:

[2023-04-29T10:37:19Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for rustc_llvm v0.0.0 (C:\Users\jyn\src\rust2\compiler\rustc_llvm)/RunCustomBuild/TargetInner { ..: custom_build_target("build-script-build", "C:\\Users\\jyn\\src\\rust2\\compiler\\rustc_llvm\\build.rs", Edition2021) }      
[2023-04-29T10:37:19Z INFO  cargo::core::compiler::fingerprint]     dirty: EnvVarChanged { name: "LLVM_CONFIG", old_value: Some("c:\\Users\\jyn\\src\\rust2\\build\\x86_64-pc-windows-msvc\\ci-llvm\\bin\\llvm-config.exe"), new_value: Some("C:\\Users\\jyn\\src\\rust2\\build\\x86_64-pc-windows-msvc\\ci-llvm\\bin\\llvm-config.exe") }

I think c:\ must be coming from rust-analyzer; running x check twice in a row doesn't recompile, only if I've saved in between. Disabling checkOnSave makes the problem go away.


some more detailed tracing:

LLVM_CONFIG is set here: https://github.com/rust-lang/rust/blob/8ce92daa854e329f4fb7ac75c28dbeea3f5bb125/src/bootstrap/compile.rs#L890
llvm_config comes from https://github.com/rust-lang/rust/blob/8ce92daa854e329f4fb7ac75c28dbeea3f5bb125/src/bootstrap/llvm.rs#L83
which in turn comes from https://github.com/rust-lang/rust/blob/214894275722249e434d24507771b6fef789df55/src/bootstrap/config.rs#L1319;
ci_llvm_root is just forwarding self.out https://github.com/rust-lang/rust/blob/214894275722249e434d24507771b6fef789df55/src/bootstrap/config.rs#L1516
which defaults to build and is set to an absolute path here: https://github.com/rust-lang/rust/blob/214894275722249e434d24507771b6fef789df55/src/bootstrap/util.rs#L469-L475

I don't know why GetFullPathName would return a different value between the bootstrap launched from powershell and the one launched by rust-analyzer.


rust-analyzer version: rust-analyzer version: 0.4.1494-standalone (370b72c 2023-04-28)

rustc version: HEAD is branched from rust-lang/rust@572c0d5; the beta compiler version is beta-2023-04-20.

relevant settings: various; bootstrap sets lots of things. .vscode/settings.json is as follows:

{
    "rust-analyzer.check.invocationLocation": "root",
    "rust-analyzer.check.invocationStrategy": "once",
    "rust-analyzer.check.overrideCommand": [
        "python",
        "x.py",
        "check",
        "--json-output"
    ],
    "rust-analyzer.linkedProjects": ["src/bootstrap/Cargo.toml", "Cargo.toml"],
    "rust-analyzer.rustfmt.overrideCommand": [
        "./build/host/rustfmt/bin/rustfmt",
        "--edition=2021"
    ],
    "rust-analyzer.procMacro.server": "./build/host/stage0/libexec/rust-analyzer-proc-macro-srv",
    "rust-analyzer.procMacro.enable": true,
    "rust-analyzer.cargo.buildScripts.enable": true,
    "rust-analyzer.cargo.buildScripts.invocationLocation": "root",
    "rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
    "rust-analyzer.cargo.buildScripts.overrideCommand": [
        "python",
        "x.py",
        "check",
        "--json-output"
    ],
    "rust-analyzer.cargo.sysrootSrc": "./library",
    "rust-analyzer.rustc.source": "./Cargo.toml"
}

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