Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/macro_error.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/macro_error.rs24
1 files changed, 20 insertions, 4 deletions
diff --git a/crates/ide-diagnostics/src/handlers/macro_error.rs b/crates/ide-diagnostics/src/handlers/macro_error.rs
index 7ca0a0eab2..099de4528d 100644
--- a/crates/ide-diagnostics/src/handlers/macro_error.rs
+++ b/crates/ide-diagnostics/src/handlers/macro_error.rs
@@ -60,9 +60,6 @@ macro_rules! compile_error { () => {} }
#[test]
fn eager_macro_concat() {
- // FIXME: this is incorrectly handling `$crate`, resulting in a wrong diagnostic.
- // See: https://github.com/rust-lang/rust-analyzer/issues/10300
-
check_diagnostics(
r#"
//- /lib.rs crate:lib deps:core
@@ -80,7 +77,6 @@ macro_rules! m {
fn f() {
m!();
- //^^^^ error: unresolved macro $crate::private::concat
}
//- /core.rs crate:core
@@ -268,4 +264,24 @@ fn f() {
"#,
)
}
+
+ #[test]
+ fn include_does_not_break_diagnostics() {
+ let mut config = DiagnosticsConfig::test_sample();
+ config.disabled.insert("inactive-code".to_string());
+ config.disabled.insert("unlinked-file".to_string());
+ check_diagnostics_with_config(
+ config,
+ r#"
+//- minicore: include
+//- /lib.rs crate:lib
+include!("include-me.rs");
+//- /include-me.rs
+/// long doc that pushes the diagnostic range beyond the first file's text length
+ #[err]
+//^^^^^^error: unresolved macro `err`
+mod prim_never {}
+"#,
+ );
+ }
}