Skip to content

rust_analyzer name resolution is wrong with multiple, shadowing use statements in scope. #20253

@cjhopman

Description

@cjhopman

rust-analyzer incorrectly reports an error on this code: https://github.com/facebook/buck2/blob/6bf56d44f7a79beef652fd08c61b82cea24fd933/app/buck2_execute/src/execute/result.rs#L513

Simplified, that's something like:

use std::time::Duration;

#[cfg(test)]
mod tests {
  use super::*;
  #[test]
  fn test() {
    use prost_types::Duration;
    Duration { seconds: 0, nanos: 0 }; // <--- shows error
  }
}

It thinks the Duration there is std::time::Duration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-nameresname, path and module resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions