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

GoTo Definition always fails #185

Closed
AnyCPU opened this issue Nov 4, 2017 · 24 comments
Closed

GoTo Definition always fails #185

AnyCPU opened this issue Nov 4, 2017 · 24 comments

Comments

@AnyCPU
Copy link

AnyCPU commented Nov 4, 2017

Rust: rustc 1.23.0-nightly (59d484575 2017-11-03)
Rust rls: 0.3.1
OS: Windows 10 Pro 64 bit latest

It always fails. But it is able to show symbol names in tooltips.

extern crate rand;

use std::io;
use std::cmp::Ordering;
use rand::Rng;

fn hello(){ println!("{}", "Hello!")}

fn main () {
    println!("Guess the number!");
    let secret_number = rand::thread_rng().gen_range(1, 100);
    println!("Please input your guess.");
    let mut guess = String::new();
    io::stdin().read_line(&mut guess).expect("Failed to read line");
    println!("You guessed: {}", guess);
    let num : u32 = guess.trim().parse().expect("Please type a number!");
    match num.cmp(&secret_number) {
        Ordering::Less => println!{"Too small!"},
        Ordering::Greater => println!("Too big!"),
        Ordering::Equal => println!("You win!")
    }
    hello();
}
@AnyCPU
Copy link
Author

AnyCPU commented Nov 4, 2017

Also there is the constantly-rolling circle in the left-bottom corner (RLS: working).

@nrc
Copy link
Member

nrc commented Nov 5, 2017

That the spinner is still going suggests that analysis has not copleted which is why goto def is not working. Could try enabling logging to try and some more information about what is going wrong please? Instructions are in debugging.md.

@AnyCPU
Copy link
Author

AnyCPU commented Nov 10, 2017

@nrc I updated the nightly rust, reinstalled the extension (0.3.2) and found in the log

thread '' panicked at 'need to specify SYSROOT or RUSTC env vars, or rustc must be in PATH', src\libcore\option.rs:839:4
note: Run with RUST_BACKTRACE=1 for a backtrace.

But the "rustc --version" command runs successfully in both Windows' cmd and PowerShell.

@akappel
Copy link

akappel commented Nov 13, 2017

@AnyCPU can you try a rustup update to get the latest RLS and then re-open VSCode and see if that helps?

@Geobert
Copy link

Geobert commented Nov 13, 2017

Just tried it, and still does not work :(

 nightly-x86_64-pc-windows-gnu updated - rustc 1.23.0-nightly (79cfce3d3 2017-11-12)
 nightly-x86_64-pc-windows-msvc updated - rustc 1.23.0-nightly (79cfce3d3 2017-11-12)
thread '<unnamed>' panicked at 'could not run cargo: CargoError(Msg("failed to run `rustc` to learn about target-specific information"), State { next_error: Some(CargoError(ProcessErrorKind(ProcessError { desc: "process didn\'t exit successfully: `rustc - --crate-name ___ --print=file-names --error-format=json -Zcontinue-parse-after-error -Zsave-analysis -Zunstable-options --target x86_64-pc-windows-msvc --crate-type bin --crate-type proc-macro --crate-type rlib` (exit code: 101)\n--- stderr\nerror: the option `Z` is only accepted on the nightly compiler\n\n", exit: Some(ExitStatus(ExitStatus(101))), output: Some(Output { status: ExitStatus(ExitStatus(101)), stdout: "", stderr: "error: the option `Z` is only accepted on the nightly compiler\n\n" }) }), State { next_error: None, backtrace: None })), backtrace: None })', src\libcore\result.rs:906:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

@AnyCPU
Copy link
Author

AnyCPU commented Nov 14, 2017

@akappel I have updated the nightly up to rustc 1.23.0-nightly (e21df8020 2017-11-13). I found this error was fixed, but I filed another one, please see #189

@Geobert
Copy link

Geobert commented Nov 14, 2017

I still have the error even with rustc 1.23.0-nightly (e21df8020 2017-11-13)
I tried to rustup default nightly and restart VSCode but it seems it is still using stable if I understand the Z flag error. How do I tell Rust (rls) plugin to use nightly?

@AnyCPU
Copy link
Author

AnyCPU commented Nov 14, 2017

@Geobert I use the latest versions of Windows 10 Pro 64 bit, VS Code, Rust (rls) extensions, Visual Studio build tools. It works.
Maybe did you make changes in VS Code configuration?

@Geobert
Copy link

Geobert commented Nov 14, 2017

Do I need to be on nightly toolchain for that? I'll check my options when back home. Thanks!

@AnyCPU
Copy link
Author

AnyCPU commented Nov 14, 2017

@Geobert Being on the nightly is recommended now.

@Geobert
Copy link

Geobert commented Nov 14, 2017

You were right, stuck in the middle of the config file, stable was specified

@Geobert
Copy link

Geobert commented Jan 27, 2018

nightly-x86_64-pc-windows-msvc unchanged - rustc 1.25.0-nightly (bacb5c58d 2018-01-26)
The issue occurs again

@AnyCPU
Copy link
Author

AnyCPU commented Jan 28, 2018

@Geobert
the latest ms c++ build tools and "nightly-x86_64-pc-windows-msvc unchanged - rustc 1.25.0-nightly (7d6e5b9da 2018-01-27)" work well.

@Geobert
Copy link

Geobert commented Jan 28, 2018

updated to 01-27, still not working, I'm using MS C++ build tools 2015

@Geobert
Copy link

Geobert commented Feb 19, 2018

with nightly-x86_64-pc-windows-msvc updated - rustc 1.25.0-nightly (27a046e93 2018-02-18)
I got VSCode that pop a message bar:

There was an error trying to build, RLS features will be limited. Try running cargo check for more information.

But I've run cargo +nightly check with no error on https://github.com/cobalt-org/cobalt.rs

@ghost
Copy link

ghost commented Feb 22, 2018

@Geobert
i have exact same message on OSX.

its a new laptop and with rustup and vscode only

@nrc
Copy link
Member

nrc commented Feb 22, 2018

There was an error trying to build, RLS features will be limited. Try running cargo check for more information.

I've been landing a bunch of patches to help here. They're currently on master but not yet in nightly. I have one more bigger thing to land and will then update the rustup nightlies. Unfortunately that process takes a while so it might be a few days to a week before the nightly reflects the improvements.

@basyg
Copy link

basyg commented Feb 23, 2018

@nrc I updated nightly. Some cases are repaired, but not all.

let a = Arc::new(5);
let b = a.clone();

Definition of "Arc" and "new" is found, but definition of "clone" isn't because of wrong path.

@Geobert
Copy link

Geobert commented Mar 7, 2018

Still broken with nightly-x86_64-pc-windows-msvc unchanged - rustc 1.26.0-nightly (2789b067d 2018-03-06)

cobalt.rs project does not have any code navigation.

@Geobert
Copy link

Geobert commented Mar 9, 2018

Does anybody has any workaround on this, I can't use RLS since end of january :(

@Geobert
Copy link

Geobert commented Mar 13, 2018

Just find out about RUST_LOG=rls=debug

Not much of a help, I'm afraid: https://gist.github.com/Geobert/07ccc3d6dbb429305f3f1793cc1d66f9

@Geobert
Copy link

Geobert commented Mar 15, 2018

Seen a new nightly but still broken :( (still cobalt.rs project)

nightly-x86_64-pc-windows-msvc updated - rustc 1.26.0-nightly (521d91c6b 2018-03-14)

https://gist.github.com/Geobert/892ef0dbec18e22c482ca1fbd3999ca1

@Geobert
Copy link

Geobert commented Mar 20, 2018

OMG, found why by reinstalling my system (unrelated issue to solve).

In order to build cobalt, in the terminal I need to call 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat' otherwise it will not build because of onig-sys

If I launch VSCode in a bat file:

@echo off
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
start "" code

it works!

@Xanewok
Copy link
Member

Xanewok commented Apr 7, 2019

Thanks to @alexheretic the RLS will report an error squiggle in case a dependency cannot be built by Cargo. I believe this is not an issue so will close this but feel free to reopen/comment if that's still the case!

@Xanewok Xanewok closed this as completed Apr 7, 2019
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

6 participants