mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Improve proc macro errors a bit
Distinguish between - there is no build data (for some reason?) - there is build data, but the cargo package didn't build a proc macro dylib - there is a proc macro dylib, but it didn't contain the proc macro we expected - the name did not resolve to any macro (this is now an unresolved_macro_call even for attributes) I changed the handling of disabled attribute macro expansion to immediately ignore the macro and report an unresolved_proc_macro, because otherwise they would now result in loud unresolved_macro_call errors. I hope this doesn't break anything. Also try to improve error ranges for unresolved_macro_call / macro_error by reusing the code for unresolved_proc_macro. It's not perfect but probably better than before.
This commit is contained in:
parent
32b40ded0f
commit
c80c34867f
10 changed files with 164 additions and 163 deletions
|
@ -172,8 +172,8 @@ fn cargo_hello_world_project_model_with_wildcard_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -247,8 +247,8 @@ fn cargo_hello_world_project_model_with_wildcard_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -312,8 +312,8 @@ fn cargo_hello_world_project_model_with_wildcard_overrides() {
|
|||
},
|
||||
},
|
||||
dependencies: [],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: Some(
|
||||
|
@ -389,8 +389,8 @@ fn cargo_hello_world_project_model_with_wildcard_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -464,8 +464,8 @@ fn cargo_hello_world_project_model_with_wildcard_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -554,8 +554,8 @@ fn cargo_hello_world_project_model_with_selective_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -631,8 +631,8 @@ fn cargo_hello_world_project_model_with_selective_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -696,8 +696,8 @@ fn cargo_hello_world_project_model_with_selective_overrides() {
|
|||
},
|
||||
},
|
||||
dependencies: [],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: Some(
|
||||
|
@ -775,8 +775,8 @@ fn cargo_hello_world_project_model_with_selective_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -852,8 +852,8 @@ fn cargo_hello_world_project_model_with_selective_overrides() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -933,8 +933,8 @@ fn cargo_hello_world_project_model() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -1010,8 +1010,8 @@ fn cargo_hello_world_project_model() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -1075,8 +1075,8 @@ fn cargo_hello_world_project_model() {
|
|||
},
|
||||
},
|
||||
dependencies: [],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: Some(
|
||||
|
@ -1154,8 +1154,8 @@ fn cargo_hello_world_project_model() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -1231,8 +1231,8 @@ fn cargo_hello_world_project_model() {
|
|||
prelude: true,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no build data",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
@ -1505,8 +1505,8 @@ fn rust_project_hello_world_project_model() {
|
|||
prelude: false,
|
||||
},
|
||||
],
|
||||
proc_macro: Ok(
|
||||
[],
|
||||
proc_macro: Err(
|
||||
"no proc macro dylib present",
|
||||
),
|
||||
origin: CratesIo {
|
||||
repo: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue