aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2020-04-03 20:12:10 +0100
committerAleksey Kladov <[email protected]>2020-04-09 12:05:41 +0100
commit74e3b48806cb1b6d583178c6f24c7183626f4327 (patch)
tree125bcd4aaf11388acf17e0a8afa7d08597305a0e /crates/ra_syntax
parent689661c95968cb438f8bd1f10ce0ee096287741b (diff)
Parse correctly fn f<T>() where T: Fn() -> u8 + Send {}
We used to parse it as T: Fn() -> (u8 + Send), which is different from the rustc behavior of T: (Fn() -> u8) + Send
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast61
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs1
2 files changed, 62 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast
new file mode 100644
index 000000000..1b0acf47c
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast
@@ -0,0 +1,61 @@
1SOURCE_FILE@[0; 40)
2 FN_DEF@[0; 39)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 4)
6 IDENT@[3; 4) "f"
7 TYPE_PARAM_LIST@[4; 7)
8 L_ANGLE@[4; 5) "<"
9 TYPE_PARAM@[5; 6)
10 NAME@[5; 6)
11 IDENT@[5; 6) "T"
12 R_ANGLE@[6; 7) ">"
13 PARAM_LIST@[7; 9)
14 L_PAREN@[7; 8) "("
15 R_PAREN@[8; 9) ")"
16 WHITESPACE@[9; 10) " "
17 WHERE_CLAUSE@[10; 36)
18 WHERE_KW@[10; 15) "where"
19 WHITESPACE@[15; 16) " "
20 WHERE_PRED@[16; 36)
21 PATH_TYPE@[16; 17)
22 PATH@[16; 17)
23 PATH_SEGMENT@[16; 17)
24 NAME_REF@[16; 17)
25 IDENT@[16; 17) "T"
26 COLON@[17; 18) ":"
27 WHITESPACE@[18; 19) " "
28 TYPE_BOUND_LIST@[19; 36)
29 TYPE_BOUND@[19; 29)
30 PATH_TYPE@[19; 29)
31 PATH@[19; 29)
32 PATH_SEGMENT@[19; 29)
33 NAME_REF@[19; 21)
34 IDENT@[19; 21) "Fn"
35 PARAM_LIST@[21; 23)
36 L_PAREN@[21; 22) "("
37 R_PAREN@[22; 23) ")"
38 WHITESPACE@[23; 24) " "
39 RET_TYPE@[24; 29)
40 THIN_ARROW@[24; 26) "->"
41 WHITESPACE@[26; 27) " "
42 PATH_TYPE@[27; 29)
43 PATH@[27; 29)
44 PATH_SEGMENT@[27; 29)
45 NAME_REF@[27; 29)
46 IDENT@[27; 29) "u8"
47 WHITESPACE@[29; 30) " "
48 PLUS@[30; 31) "+"
49 WHITESPACE@[31; 32) " "
50 TYPE_BOUND@[32; 36)
51 PATH_TYPE@[32; 36)
52 PATH@[32; 36)
53 PATH_SEGMENT@[32; 36)
54 NAME_REF@[32; 36)
55 IDENT@[32; 36) "Send"
56 WHITESPACE@[36; 37) " "
57 BLOCK_EXPR@[37; 39)
58 BLOCK@[37; 39)
59 L_CURLY@[37; 38) "{"
60 R_CURLY@[38; 39) "}"
61 WHITESPACE@[39; 40) "\n"
diff --git a/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs
new file mode 100644
index 000000000..29f3655e0
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rs
@@ -0,0 +1 @@
fn f<T>() where T: Fn() -> u8 + Send {}