aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-17 20:42:52 +0000
committerGitHub <[email protected]>2021-03-17 20:42:52 +0000
commit9d691530d556bdc40262585383a1b18d3a1de07e (patch)
treeaf759a4222a13c4b07823e61bc16dedfb93b3a97 /crates
parentbba474bb52e75baf4cabb3fc73f2a4c818816857 (diff)
parentc64adfe706183ccce9764853ee9c7231c57c16ab (diff)
Merge #8072
8072: Fix "unset `OUT_DIR`" diagnostic when using it in item position r=jonas-schievink a=jonas-schievink "load out dirs from check" is enabled by default now, but better late than never I guess. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/nameres/collector.rs4
-rw-r--r--crates/hir_def/src/nameres/tests/diagnostics.rs17
2 files changed, 20 insertions, 1 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 81cf652b0..d73f895b7 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1469,7 +1469,9 @@ impl ModCollector<'_, '_> {
1469 ) 1469 )
1470 }) 1470 })
1471 }, 1471 },
1472 &mut |err| error = Some(err), 1472 &mut |err| {
1473 error.get_or_insert(err);
1474 },
1473 ) { 1475 ) {
1474 Ok(Ok(macro_call_id)) => { 1476 Ok(Ok(macro_call_id)) => {
1475 self.def_collector.unexpanded_macros.push(MacroDirective { 1477 self.def_collector.unexpanded_macros.push(MacroDirective {
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs
index c22ef46fd..6becd9ff1 100644
--- a/crates/hir_def/src/nameres/tests/diagnostics.rs
+++ b/crates/hir_def/src/nameres/tests/diagnostics.rs
@@ -200,3 +200,20 @@ fn builtin_macro_fails_expansion() {
200 "#, 200 "#,
201 ); 201 );
202} 202}
203
204#[test]
205fn good_out_dir_diagnostic() {
206 check_diagnostics(
207 r#"
208 #[rustc_builtin_macro]
209 macro_rules! include { () => {} }
210 #[rustc_builtin_macro]
211 macro_rules! env { () => {} }
212 #[rustc_builtin_macro]
213 macro_rules! concat { () => {} }
214
215 include!(concat!(env!("OUT_DIR"), "/out.rs"));
216 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `OUT_DIR` not set, enable "load out dirs from check" to fix
217 "#,
218 );
219}