2205: Implement bulitin line! macro r=matklad a=edwin0cheng

This PR implements bulitin macro `line!` and add basic infra-structure for other bulitin macros:

1. Extend `MacroDefId` to support builtin macros
2. Add a `quote!` macro for simple quasi quoting.

Note that for support others builtin macros, eager macro expansion have to be supported first, this PR not try to handle it. :)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
bors[bot] 2019-11-11 10:53:24 +00:00 committed by GitHub
commit ef2a9aedb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 458 additions and 22 deletions

View file

@ -4810,3 +4810,22 @@ fn no_such_field_diagnostics() {
"###
);
}
#[test]
fn infer_builtin_macros_line() {
assert_snapshot!(
infer(r#"
#[rustc_builtin_macro]
macro_rules! line {() => {}}
fn main() {
let x = line!();
}
"#),
@r###"
![0; 1) '6': i32
[64; 88) '{ ...!(); }': ()
[74; 75) 'x': i32
"###
);
}