aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/tests
diff options
context:
space:
mode:
authorBrandon <[email protected]>2021-03-14 05:28:10 +0000
committerBrandon <[email protected]>2021-03-14 05:28:10 +0000
commit2df637f41900e50bbe47d2628554f7ffd167749a (patch)
tree0210f11dbff67587608a1d14c46b9b9987972ca9 /crates/hir_def/src/nameres/tests
parent4245973e246d634fb58bdf0e570b59d0f7340f86 (diff)
Fix incorrect diagnositics for failing built in eager macros
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-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}