From 8622e4cc1b79f5d23b8a2c6610d749f5b987ea7e Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 11 Jun 2020 18:15:03 +0100 Subject: Add example of old trait object syntax --- crates/ra_parser/src/grammar/types.rs | 1 + .../test_data/parser/inline/ok/0081_for_type.rast | 38 +++++++++++++++++++++- .../test_data/parser/inline/ok/0081_for_type.rs | 1 + 3 files changed, 39 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index 63dd3774f..9e8e3bd97 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs @@ -217,6 +217,7 @@ pub(super) fn for_binder(p: &mut Parser) { // test for_type // type A = for<'a> fn() -> (); // type B = for<'a> unsafe extern "C" fn(&'a ()) -> (); +// type Obj = for<'a> PartialEq<&'a i32>; pub(super) fn for_type(p: &mut Parser) { assert!(p.at(T![for])); let m = p.start(); diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast index 26a80017a..b26ac2d36 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast @@ -1,4 +1,4 @@ -SOURCE_FILE@0..82 +SOURCE_FILE@0..121 TYPE_ALIAS_DEF@0..28 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " @@ -74,3 +74,39 @@ SOURCE_FILE@0..82 R_PAREN@79..80 ")" SEMICOLON@80..81 ";" WHITESPACE@81..82 "\n" + TYPE_ALIAS_DEF@82..120 + TYPE_KW@82..86 "type" + WHITESPACE@86..87 " " + NAME@87..90 + IDENT@87..90 "Obj" + WHITESPACE@90..91 " " + EQ@91..92 "=" + WHITESPACE@92..93 " " + FOR_TYPE@93..119 + FOR_KW@93..96 "for" + TYPE_PARAM_LIST@96..100 + L_ANGLE@96..97 "<" + LIFETIME_PARAM@97..99 + LIFETIME@97..99 "\'a" + R_ANGLE@99..100 ">" + WHITESPACE@100..101 " " + PATH_TYPE@101..119 + PATH@101..119 + PATH_SEGMENT@101..119 + NAME_REF@101..110 + IDENT@101..110 "PartialEq" + TYPE_ARG_LIST@110..119 + L_ANGLE@110..111 "<" + TYPE_ARG@111..118 + REFERENCE_TYPE@111..118 + AMP@111..112 "&" + LIFETIME@112..114 "\'a" + WHITESPACE@114..115 " " + PATH_TYPE@115..118 + PATH@115..118 + PATH_SEGMENT@115..118 + NAME_REF@115..118 + IDENT@115..118 "i32" + R_ANGLE@118..119 ">" + SEMICOLON@119..120 ";" + WHITESPACE@120..121 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs index 457e8744f..8ac7b9e10 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs @@ -1,2 +1,3 @@ type A = for<'a> fn() -> (); type B = for<'a> unsafe extern "C" fn(&'a ()) -> (); +type Obj = for<'a> PartialEq<&'a i32>; -- cgit v1.2.3