diff options
-rw-r--r-- | crates/ra_mbe/src/lib.rs | 46 | ||||
-rw-r--r-- | crates/ra_mbe/src/mbe_expander.rs | 12 |
2 files changed, 31 insertions, 27 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index 814586fd6..d2115bd67 100644 --- a/crates/ra_mbe/src/lib.rs +++ b/crates/ra_mbe/src/lib.rs | |||
@@ -763,29 +763,29 @@ MACRO_ITEMS@[0; 40) | |||
763 | ); | 763 | ); |
764 | } | 764 | } |
765 | 765 | ||
766 | #[test] | 766 | // #[test] |
767 | fn test_tt_block() { | 767 | // fn test_tt_block() { |
768 | let rules = create_rules( | 768 | // let rules = create_rules( |
769 | r#" | 769 | // r#" |
770 | macro_rules! foo { | 770 | // macro_rules! foo { |
771 | ($ i:tt) => { fn foo() $ i } | 771 | // ($ i:tt) => { fn foo() $ i } |
772 | } | 772 | // } |
773 | "#, | 773 | // "#, |
774 | ); | 774 | // ); |
775 | assert_expansion(&rules, r#"foo! { { 1; } }"#, r#"fn foo () {1 ;}"#); | 775 | // assert_expansion(&rules, r#"foo! { { 1; } }"#, r#"fn foo () {1 ;}"#); |
776 | } | 776 | // } |
777 | 777 | ||
778 | #[test] | 778 | // #[test] |
779 | fn test_tt_group() { | 779 | // fn test_tt_group() { |
780 | let rules = create_rules( | 780 | // let rules = create_rules( |
781 | r#" | 781 | // r#" |
782 | macro_rules! foo { | 782 | // macro_rules! foo { |
783 | ($($ i:tt)*) => { $($ i)* } | 783 | // ($($ i:tt)*) => { $($ i)* } |
784 | } | 784 | // } |
785 | "#, | 785 | // "#, |
786 | ); | 786 | // ); |
787 | assert_expansion(&rules, r#"foo! { fn foo() {} }"#, r#"fn foo () {}"#); | 787 | // assert_expansion(&rules, r#"foo! { fn foo() {} }"#, r#"fn foo () {}"#); |
788 | } | 788 | // } |
789 | 789 | ||
790 | #[test] | 790 | #[test] |
791 | fn test_lifetime() { | 791 | fn test_lifetime() { |
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs index 01e29b556..86867111f 100644 --- a/crates/ra_mbe/src/mbe_expander.rs +++ b/crates/ra_mbe/src/mbe_expander.rs | |||
@@ -171,10 +171,14 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings, | |||
171 | input.eat_meta().ok_or(ExpandError::UnexpectedToken)?.clone(); | 171 | input.eat_meta().ok_or(ExpandError::UnexpectedToken)?.clone(); |
172 | res.inner.insert(text.clone(), Binding::Simple(meta.into())); | 172 | res.inner.insert(text.clone(), Binding::Simple(meta.into())); |
173 | } | 173 | } |
174 | "tt" => { | 174 | // FIXME: |
175 | let token = input.eat().ok_or(ExpandError::UnexpectedToken)?.clone(); | 175 | // Enable followiing code when everything is fixed |
176 | res.inner.insert(text.clone(), Binding::Simple(token.into())); | 176 | // At least we can dogfood itself to not stackoverflow |
177 | } | 177 | // |
178 | // "tt" => { | ||
179 | // let token = input.eat().ok_or(ExpandError::UnexpectedToken)?.clone(); | ||
180 | // res.inner.insert(text.clone(), Binding::Simple(token.into())); | ||
181 | // } | ||
178 | "item" => { | 182 | "item" => { |
179 | let item = | 183 | let item = |
180 | input.eat_item().ok_or(ExpandError::UnexpectedToken)?.clone(); | 184 | input.eat_item().ok_or(ExpandError::UnexpectedToken)?.clone(); |