Parse error relating to `where` clause in associated type
kmicklas opened this issue · comments
Here is a minimal example which rustc
accepts.
trait T {
type AT;
fn foo();
}
impl T for S {
type AT = u8 where 'static: 'static;
fn foo() {
drop(3)
}
}
#[derive()]
pub struct S {}
fn main() {}
The interesting line which makes it go all wrong seems to be
type AT = u8 where 'static: 'static;
however the remaining code causes some cascading failures.
Here is the output of tree-sitter parse
, with the grammar as of 17a6b15:
Warning: You have not configured any parser directories!
Please run `tree-sitter init-config` and edit the resulting
configuration file to indicate where we should look for
language grammars.
(source_file [0, 0] - [18, 0]
(trait_item [0, 0] - [4, 1]
name: (type_identifier [0, 6] - [0, 7])
body: (declaration_list [0, 8] - [4, 1]
(associated_type [1, 4] - [1, 12]
name: (type_identifier [1, 9] - [1, 11]))
(function_signature_item [3, 4] - [3, 13]
name: (identifier [3, 7] - [3, 10])
parameters: (parameters [3, 10] - [3, 12]))))
(ERROR [6, 0] - [17, 12]
(identifier [6, 5] - [6, 6])
(type_identifier [6, 11] - [6, 12])
(identifier [7, 9] - [7, 11])
(ERROR [7, 14] - [9, 14]
(primitive_type [7, 14] - [7, 16])
(lifetime [7, 23] - [7, 30]
(identifier [7, 24] - [7, 30]))
(lifetime [7, 32] - [7, 39]
(identifier [7, 33] - [7, 39]))
(function_type [9, 7] - [9, 12]
trait: (type_identifier [9, 7] - [9, 10])
parameters: (parameters [9, 10] - [9, 12])))
(identifier [10, 8] - [10, 12])
(ERROR [10, 13] - [12, 1]
(integer_literal [10, 13] - [10, 14]))
(attribute_item [14, 0] - [14, 11]
(attribute [14, 2] - [14, 10]
(identifier [14, 2] - [14, 8])
arguments: (token_tree [14, 8] - [14, 10])))
(ERROR [15, 0] - [17, 2]
(struct_pattern [15, 0] - [15, 15]
type: (type_identifier [15, 0] - [15, 3])
(ERROR [15, 4] - [15, 12]
(identifier [15, 4] - [15, 10])
(identifier [15, 11] - [15, 12])))
(identifier [17, 0] - [17, 2]))
(struct_pattern [17, 3] - [17, 12]
type: (type_identifier [17, 3] - [17, 7])
(ERROR [17, 7] - [17, 9]
(parameters [17, 7] - [17, 9])))))
test.rs 0 ms (ERROR [6, 0] - [17, 12])