diff --git a/src/grammar/types.rs b/src/grammar/types.rs index 9e63c9b2a6a..03a087acd6d 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 00000000000..215210e277a --- /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 00000000000..aeda229d5c0 --- /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)