Skip to content

unresolvedReference on many inherent methods from libcore on nightly rust (as of at least 2022-03-31's nightly) #11876

Closed
@thomcc

Description

@thomcc

This is the issue version of this zulip thread. There may be more info in it: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Unresolved.20reference.20to.20slice.20methods.2E .

Rust analyzer is failing to resolve references of slice methods, and other things from libcore on some fairly simple code. Here's a screenshot (the red text with an underline is from the unresolvedReference scope in https://github.com/matklad/pale-fire):

Screen Shot 2022-04-01 at 5 54 14 PM

This screenshot is taken from https://github.com/thomcc/envparse/blob/e2002f9fd30eca8f3cba9ff3ef121333b5feb2b3/src/parse.rs#L81-L100 , which reproduces the issue, at least at that checkout. It seems like slices, strs, Option, primitive numbers (not complete list, seems like a lot of things from libcore), don't have any of their inherent methods according to rust-analyzer.

An exception is that things that come from traits appear to be understood by r-a even if those traits/impls are from libcore. (And more broadly everything else from libcore is present, like types, traits, enum variants, constants, etc are all present)

I've tired on the both the unstable (rust-analyzer version: 0fe74175e 2022-04-02 nightly) and stable (rust-analyzer version: bc08b8eff 2022-03-28 stable) versions of rust-analyzer.

I'm using the following version of Visual Studio Code (insider version):

Version: 1.67.0-insider (Universal)
Commit: 8b7086afdbfd42bf6e7b8c0bb586530bf7cf1396
Date: 2022-04-01T05:16:51.251Z
Electron: 17.3.0
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin arm64 21.4.0

And in case it matters, my rust version is:

$ rustc -Vv
rustc 1.61.0-nightly (0677edc86 2022-03-31)
binary: rustc
commit-hash: 0677edc86e342f333d4828b0ee1ef395a4e70fe5
commit-date: 2022-03-31
host: aarch64-apple-darwin
release: 1.61.0-nightly
LLVM version: 14.0.0

Metadata

Metadata

Assignees

Labels

Broken WindowBugs / technical debt to be addressed immediately

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions