diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-03 17:30:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-03 17:30:08 +0000 |
commit | 7a322f9afff05b88507a6956a2d84a3abef0a0d6 (patch) | |
tree | f811a7f405edca2b7e0c32666604117ef6486229 /crates/ra_hir_ty | |
parent | 13b25d73b56ede36d1680efc19f5c11b0669b96c (diff) | |
parent | 4d5e80c6c86aa6bfee50e9f8b80b365c3120ed80 (diff) |
Merge #3392
3392: Implement concat eager macro r=matklad a=edwin0cheng
This PR implements the following things:
1. Add basic eager macro infrastructure by introducing `EagerCallId` such that the new `MacroCallId` is defined as :
```
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MacroCallId {
LazyMacro(LazyMacroId),
EagerMacro(EagerMacroId),
}
```
2. Add `concat!` builtin macro.
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/tests/macros.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index 53cd81d46..55386c030 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs | |||
@@ -420,6 +420,25 @@ fn main() { | |||
420 | } | 420 | } |
421 | 421 | ||
422 | #[test] | 422 | #[test] |
423 | fn infer_builtin_macros_concat() { | ||
424 | assert_snapshot!( | ||
425 | infer(r#" | ||
426 | #[rustc_builtin_macro] | ||
427 | macro_rules! concat {() => {}} | ||
428 | |||
429 | fn main() { | ||
430 | let x = concat!("hello", concat!("world", "!")); | ||
431 | } | ||
432 | "#), | ||
433 | @r###" | ||
434 | ![0; 13) '"helloworld!"': &str | ||
435 | [66; 122) '{ ...")); }': () | ||
436 | [76; 77) 'x': &str | ||
437 | "### | ||
438 | ); | ||
439 | } | ||
440 | |||
441 | #[test] | ||
423 | fn infer_derive_clone_simple() { | 442 | fn infer_derive_clone_simple() { |
424 | let (db, pos) = TestDB::with_position( | 443 | let (db, pos) = TestDB::with_position( |
425 | r#" | 444 | r#" |