Racer question -- run from Windows command line



I am using racer.exe tool in Windows from inside a cargo project root directory (the dir where cargo.toml is found) to find type definitions by passing the linenum, charnum and src/file1.rs file, that’s the cursor pos of the symbol inside file1.rs. My symbol is a type which is defined inside another .rs file (e.g. file2.rs) located in the same cargo src directory. Racer is failing to find a match. However, if the type is defined in the same .rs file, racer is able to find it. Symbols found in Rust standard libs or in downloaded crates are also found. How can I get the racer tool under Windows to find the definition of a type which is found in a separate .rs file inside the same cargo project src directory?

Your help is greatly appreciated.



We need more details.


I am using racer version 2.0.5 under Windows 7 ultimate SP1.
Cargo: cargo 0.15.0-nightly (298a012 2016-12-20)
rustc 1.14.0

I have a cargo lib project with many .rs files under src dir. I am then running racer.exe from the command line passing the find-definition subcommand. Current directory is my cargo project’s root which contains my toml file.

What other info do you need?



I need to know if you use file2 in file1 (via use).
I need to know what exactly type looks like.
Please mention that racer doesn’t support any form of macros.


Actually, I have created many types, each type in its own .rs file. I have included all my .rs files in my lib.rs file, using the include!() macro. So, no I am not using “use”. Should I? How? Would it solve my problem?

My types look like:

pub struct MyType1 {
	s: String,
        n: f64,

impl MyType1 {

	pub fn new() -> MyType1 {

        MyType1{ 	s: String::from(""), n: 0.0,	}

    // other public methods here

Racer is not supporting any macros.



Why do you use include instead of use?


My lib.rs doesn’t contain any code, just a list of includes. Could you please suggest something else that would solve my racer issue? How should I use use instead of include to allow me to use file1 types in file2 and vice versa?



It’s easy.
You need to read a chapter about modules: https://doc.rust-lang.org/book/crates-and-modules.html

Your lib.rs should have the following lines:

mod file1;
mod file2;

Your file1.rs should have the following line:

use file2::<something to use>;

Your file2.rs should have the following line:

use file1::<something to use>;


It works! Using include macro was not good practice.

Thank you very much.