Closed
Description
It seems that rust-analyzer
can sometimes incorrectly resolve location of an error, to a non-existing location such as <::alloc::macros::vec macros>
.
The compiler resolves those spans nicely:
error[E0308]: mismatched types
--> intcode-computer\./src/lib.rs:438:36
|
438 | test_memory!("1,0,0,0,99", vec![], "2,0,0,0,99");
| ^^^^^^ expected &[i64], found struct `std::vec::Vec`
|
= note: expected type `&[i64]`
found type `std::vec::Vec<_>`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
I tried to minimize it very crudely, but it didn't seem to always occur, at least not in this example:
macro_rules! my_macro {
($t: expr) => {
a($t);
};
}
fn a(v: &[i64]) {
unimplemented!()
}
fn main() {
let x = 0_i64;
my_macro!(vec![1])
}
which seems to resolve fine to main.rs
:
This reproduces on my advent of code repo https://github.com/omerbenamram/AOC2019/.
I'm not sure which part of rust-analyzer
is responsible for this behavior, but I could take a look in a general direction if it's not too complex.
Metadata
Metadata
Assignees
Labels
No labels