From e04c0f42227b2c72aa8ea40d6aea873669428267 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 4 Mar 2020 02:41:33 +0800 Subject: Fix panic on eager expansion --- crates/ra_hir_ty/src/tests/macros.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'crates/ra_hir_ty/src/tests') diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index 55386c030..5d0efa0f4 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs @@ -438,6 +438,27 @@ fn main() { ); } +#[test] +fn infer_builtin_macros_concat_with_lazy() { + assert_snapshot!( + infer(r#" +macro_rules! hello {() => {"hello"}} + +#[rustc_builtin_macro] +macro_rules! concat {() => {}} + +fn main() { + let x = concat!(hello!(), concat!("world", "!")); +} +"#), + @r###" + ![0; 13) '"helloworld!"': &str + [104; 161) '{ ...")); }': () + [114; 115) 'x': &str + "### + ); +} + #[test] fn infer_derive_clone_simple() { let (db, pos) = TestDB::with_position( -- cgit v1.2.3