Fix panic on eager expansion

This commit is contained in:
Edwin Cheng 2020-03-04 02:41:33 +08:00
parent 074474fe00
commit e04c0f4222
2 changed files with 39 additions and 2 deletions

View file

@ -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(