From 99f6976b202cc8c47b95d6443d23a5745dcf8010 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 8 Aug 2018 17:33:16 +0300 Subject: bouds in types --- src/grammar/types.rs | 5 ++++ .../parser/inline/0095_path_type_with_bounds.rs | 1 + .../parser/inline/0095_path_type_with_bounds.txt | 35 ++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 tests/data/parser/inline/0095_path_type_with_bounds.rs create mode 100644 tests/data/parser/inline/0095_path_type_with_bounds.txt diff --git a/src/grammar/types.rs b/src/grammar/types.rs index 9e63c9b2a..03a087acd 100644 --- a/src/grammar/types.rs +++ b/src/grammar/types.rs @@ -203,5 +203,10 @@ fn path_type(p: &mut Parser) { assert!(paths::is_path_start(p)); let m = p.start(); paths::type_path(p); + // test path_type_with_bounds + // fn foo() -> Box {} + if p.eat(PLUS) { + type_params::bounds_without_colon(p); + } m.complete(p, PATH_TYPE); } diff --git a/tests/data/parser/inline/0095_path_type_with_bounds.rs b/tests/data/parser/inline/0095_path_type_with_bounds.rs new file mode 100644 index 000000000..215210e27 --- /dev/null +++ b/tests/data/parser/inline/0095_path_type_with_bounds.rs @@ -0,0 +1 @@ +fn foo() -> Box {} diff --git a/tests/data/parser/inline/0095_path_type_with_bounds.txt b/tests/data/parser/inline/0095_path_type_with_bounds.txt new file mode 100644 index 000000000..aeda229d5 --- /dev/null +++ b/tests/data/parser/inline/0095_path_type_with_bounds.txt @@ -0,0 +1,35 @@ +FILE@[0; 27) + FN_ITEM@[0; 26) + FN_KW@[0; 2) + WHITESPACE@[2; 3) + NAME@[3; 6) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 8) + L_PAREN@[6; 7) + R_PAREN@[7; 8) + WHITESPACE@[8; 9) + THIN_ARROW@[9; 11) + WHITESPACE@[11; 12) + PATH_TYPE@[12; 23) + PATH@[12; 23) + PATH_SEGMENT@[12; 23) + NAME_REF@[12; 15) + IDENT@[12; 15) "Box" + TYPE_ARG_LIST@[15; 23) + L_ANGLE@[15; 16) + TYPE_ARG@[16; 22) + PATH_TYPE@[16; 22) + PATH@[16; 17) + PATH_SEGMENT@[16; 17) + NAME_REF@[16; 17) + IDENT@[16; 17) "T" + WHITESPACE@[17; 18) + PLUS@[18; 19) + WHITESPACE@[19; 20) + LIFETIME@[20; 22) "'f" + R_ANGLE@[22; 23) + WHITESPACE@[23; 24) + BLOCK_EXPR@[24; 26) + L_CURLY@[24; 25) + R_CURLY@[25; 26) + WHITESPACE@[26; 27) -- cgit v1.2.3