aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/nameres/tests/diagnostics.rs')
-rw-r--r--crates/hir_def/src/nameres/tests/diagnostics.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs
index d5ef8ceb5..bfc1ab13f 100644
--- a/crates/hir_def/src/nameres/tests/diagnostics.rs
+++ b/crates/hir_def/src/nameres/tests/diagnostics.rs
@@ -152,3 +152,48 @@ fn inactive_via_cfg_attr() {
152 "#, 152 "#,
153 ); 153 );
154} 154}
155
156#[test]
157fn unresolved_legacy_scope_macro() {
158 check_diagnostics(
159 r#"
160 //- /lib.rs
161 macro_rules! m { () => {} }
162
163 m!();
164 m2!();
165 //^^^^^^ unresolved macro call
166 "#,
167 );
168}
169
170#[test]
171fn unresolved_module_scope_macro() {
172 check_diagnostics(
173 r#"
174 //- /lib.rs
175 mod mac {
176 #[macro_export]
177 macro_rules! m { () => {} }
178 }
179
180 self::m!();
181 self::m2!();
182 //^^^^^^^^^^^^ unresolved macro call
183 "#,
184 );
185}
186
187#[test]
188fn builtin_macro_fails_expansion() {
189 check_diagnostics(
190 r#"
191 //- /lib.rs
192 #[rustc_builtin_macro]
193 macro_rules! include { () => {} }
194
195 include!("doesntexist");
196 //^^^^^^^^^^^^^^^^^^^^^^^^ could not convert tokens
197 "#,
198 );
199}