aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-11 10:53:24 +0000
committerGitHub <[email protected]>2019-11-11 10:53:24 +0000
commitef2a9aedb6ac7f0b79e636cff7947935fecb909d (patch)
treea603361f9e6c02d90c0ae8cdfd0902370677f71d /crates/ra_hir
parent5ac4ffbc121c8231fe3ea5c2bb918f7aae60f197 (diff)
parent4f7df2aac107c0de2cab851f2a4f1ab369511fc8 (diff)
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 <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ty/tests.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index e56b9356e..896bf2924 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -4810,3 +4810,22 @@ fn no_such_field_diagnostics() {
4810 "### 4810 "###
4811 ); 4811 );
4812} 4812}
4813
4814#[test]
4815fn infer_builtin_macros_line() {
4816 assert_snapshot!(
4817 infer(r#"
4818#[rustc_builtin_macro]
4819macro_rules! line {() => {}}
4820
4821fn main() {
4822 let x = line!();
4823}
4824"#),
4825 @r###"
4826 ![0; 1) '6': i32
4827 [64; 88) '{ ...!(); }': ()
4828 [74; 75) 'x': i32
4829 "###
4830 );
4831}