Fully quilified path to files with errors

I use my own IDE for Rust development. Ii works also for other languages as C, Java, Swift, Go...
When an error detected in Rust code, the compiler gives me an error notification as below:

ompiling main ...

error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `rom`
  --> main.rs:11:30
   |
11 |    let greetings = String::f rom("Welcome to the festival!!!");
   |                              ^^^ expected one of 8 possible tokens

   |
help: there is a keyword `fn` with a similar name
   |
11 |    let greetings = String::fn rom("Welcome to the festival!!!");
   |                             +

But my IDE struggles to find the main.rs. It's much simpler in Java:

Compiling learning ...

/media/exhdd/Dev/leaner/src/java/org/dayone/model/term.java:21: error: cannot find symbol
	@FormField(presentType = FieldType.Hidde)
	                                  ^
  symbol:   variable Hidde
  location: class FieldType

1 error

Because Java gives a fully qualified path to the file where an error detected. Is there a similar way to make Rust the same verbose? I tried '-v' option, but nothing was changed.

rustc just uses the file path from the command line arguments:

šŸ“¦[nerditation@tumbleweed hello]$ rustc src/main.rs 
error[E0423]: expected function, found macro `println`
 --> src/main.rs:2:2
  |
2 |     println("Hello, world!");
  |     ^^^^^^^ not a function
  |
help: use `!` to invoke the macro
  |
2 |     println!("Hello, world!");
  |            +

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0423`.

šŸ“¦[nerditation@tumbleweed hello]$ rustc /tmp/hello/src/main.rs 
error[E0423]: expected function, found macro `println`
 --> /tmp/hello/src/main.rs:2:2
  |
2 |     println("Hello, world!");
  |     ^^^^^^^ not a function
  |
help: use `!` to invoke the macro
  |
2 |     println!("Hello, world!");
  |            +

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0423`.

have you tried to configure your IDE to pass the full file path to the compiler?

1 Like

You are genius.


It works like a charm.