diff options
Diffstat (limited to 'crates/hir_def/src/body')
-rw-r--r-- | crates/hir_def/src/body/tests.rs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs index baf1179f1..6dba9817d 100644 --- a/crates/hir_def/src/body/tests.rs +++ b/crates/hir_def/src/body/tests.rs | |||
@@ -78,21 +78,41 @@ fn f() { | |||
78 | fn macro_diag_builtin() { | 78 | fn macro_diag_builtin() { |
79 | check_diagnostics( | 79 | check_diagnostics( |
80 | r#" | 80 | r#" |
81 | #[rustc_builtin_macro] | ||
82 | macro_rules! env {} | ||
83 | |||
84 | #[rustc_builtin_macro] | ||
85 | macro_rules! include {} | ||
86 | |||
87 | #[rustc_builtin_macro] | ||
88 | macro_rules! compile_error {} | ||
89 | |||
90 | #[rustc_builtin_macro] | ||
91 | macro_rules! format_args { | ||
92 | () => {} | ||
93 | } | ||
94 | |||
81 | fn f() { | 95 | fn f() { |
82 | // Test a handful of built-in (eager) macros: | 96 | // Test a handful of built-in (eager) macros: |
83 | 97 | ||
84 | include!(invalid); | 98 | include!(invalid); |
85 | //^^^^^^^^^^^^^^^^^ failed to parse or resolve macro invocation | 99 | //^^^^^^^^^^^^^^^^^ could not convert tokens |
86 | include!("does not exist"); | 100 | include!("does not exist"); |
87 | //^^^^^^^^^^^^^^^^^^^^^^^^^^ failed to parse or resolve macro invocation | 101 | //^^^^^^^^^^^^^^^^^^^^^^^^^^ could not convert tokens |
88 | 102 | ||
89 | env!(invalid); | 103 | env!(invalid); |
90 | //^^^^^^^^^^^^^ failed to parse or resolve macro invocation | 104 | //^^^^^^^^^^^^^ could not convert tokens |
105 | |||
106 | env!("OUT_DIR"); | ||
107 | //^^^^^^^^^^^^^^^ `OUT_DIR` not set, enable "load out dirs from check" to fix | ||
108 | |||
109 | compile_error!("compile_error works"); | ||
110 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ compile_error works | ||
91 | 111 | ||
92 | // Lazy: | 112 | // Lazy: |
93 | 113 | ||
94 | format_args!(); | 114 | format_args!(); |
95 | //^^^^^^^^^^^^^^ failed to parse or resolve macro invocation | 115 | //^^^^^^^^^^^^^^ no rule matches input tokens |
96 | } | 116 | } |
97 | "#, | 117 | "#, |
98 | ); | 118 | ); |