From 883c8d177d61d34d70d4fccef788fe4b35aaa7ea Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 3 Dec 2020 15:31:04 +0100 Subject: Make `compile_error!` lazy and emit a diagnostic --- crates/hir_def/src/body/tests.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/hir_def/src/body') diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs index c7003f2a6..7e78340ee 100644 --- a/crates/hir_def/src/body/tests.rs +++ b/crates/hir_def/src/body/tests.rs @@ -84,6 +84,9 @@ macro_rules! env {} #[rustc_builtin_macro] macro_rules! include {} +#[rustc_builtin_macro] +macro_rules! compile_error {} + #[rustc_builtin_macro] macro_rules! format_args { () => {} @@ -103,6 +106,9 @@ fn f() { env!("OUT_DIR"); //^^^^^^^^^^^^^^^ `OUT_DIR` not set, enable "load out dirs from check" to fix + compile_error!("compile_error works"); + //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `compile_error!` called: compile_error works + // Lazy: format_args!(); -- cgit v1.2.3