Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

rls::actions::hover: extract_decl: error: could not open file #1197

Closed
doxxx opened this issue Dec 17, 2018 · 3 comments
Closed

rls::actions::hover: extract_decl: error: could not open file #1197

doxxx opened this issue Dec 17, 2018 · 3 comments

Comments

@doxxx
Copy link

doxxx commented Dec 17, 2018

OS: Windows 10
rls-preview 1.31.6 (6610526 2018-12-01)
rustc 1.31.0 (abe02cefd 2018-12-04)

Using Visual Studio Code, when hovering over unwrap in some code like this:

let i: i32 = "123".parse().unwrap();

The RLS window logs the following errors:

ERROR 2018-12-17T20:57:35Z: rls::actions::hover: extract_decl: error: Io(Some("C:\\Users\\Gordon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\libcore\\result.rs"), Some("Could not open file: C:\\Users\\Gordon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\libcore\\result.rs"))
ERROR 2018-12-17T20:57:35Z: rls::actions::hover: failed to extract docs: row: Row(804, PhantomData), file: "C:\\Users\\Gordon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\libcore\\result.rs" (Io(Some("C:\\Users\\Gordon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\libcore\\result.rs"), Some("Could not open file: C:\\Users\\Gordon\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\libcore\\result.rs")))

It's looking for a file:

C:\Users\Gordon\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\libcore\result.rs

which is actually located at:

C:\Users\Gordon\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\result.rs

I do still get a tooltip though.

@aloucks
Copy link
Contributor

aloucks commented Dec 18, 2018

I'm able to reproduce on stable but not on nightly. The hover mechanism will fall back to using the docs provided by the save-analysis when source extraction fails. That's why you're getting a tooltip, but the docs are limited to a single line.

It looks like the file path coming out of the save-analysis is wrong:

TRACE 2018-12-18T00:30:40Z: rls::actions::hover: tooltip: span_def: Ok(Def { kind: Method, span: Span { file: "C:\\Users\\Aaron\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\libcore\\result.rs", range: Range { row_start: Row(804, PhantomData), row_end: Row(804, PhantomData), col_start: Column(11, PhantomData), col_end: Column(17, PhantomData) } }, name: "unwrap", qualname: "core<Result<T, E>>::unwrap", distro_crate: true, parent: None, value: "fn (self) -> T", docs: " Unwraps a result, yielding the content of an [`Ok`]." })
$ find -name result.rs | grep -v tests
./nightly-2018-12-14-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/result.rs
./nightly-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/result.rs
./stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/libcore/result.rs

@aloucks
Copy link
Contributor

aloucks commented Dec 18, 2018

Duplicate of #1171

@doxxx
Copy link
Author

doxxx commented Dec 18, 2018

Closing in favor of dupe.

@doxxx doxxx closed this as completed Dec 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants