mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Merge #2205
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:
commit
ef2a9aedb6
9 changed files with 458 additions and 22 deletions
|
@ -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
|
||||
"###
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue