File tree 3 files changed +23
-15
lines changed
3 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ pub struct TraitFlags {
54
54
pub struct AssocTyDefn {
55
55
pub name : Identifier ,
56
56
pub parameter_kinds : Vec < ParameterKind > ,
57
- pub bound : Option < TraitRef > ,
57
+ pub bounds : Vec < TraitBound > ,
58
58
pub where_clauses : Vec < QuantifiedWhereClause > ,
59
59
}
60
60
@@ -177,6 +177,11 @@ impl PolarizedTraitRef {
177
177
}
178
178
}
179
179
180
+ pub struct TraitBound {
181
+ pub trait_name : Identifier ,
182
+ pub args_no_self : Vec < Parameter > ,
183
+ }
184
+
180
185
#[ derive( Copy , Clone , Debug ) ]
181
186
pub struct Identifier {
182
187
pub str : InternedString ,
Original file line number Diff line number Diff line change @@ -72,25 +72,23 @@ TraitDefn: TraitDefn = {
72
72
};
73
73
74
74
AssocTyDefn: AssocTyDefn = {
75
- "type" <name:Id> <p:Angle<ParameterKind>> <b:(":" <Id> <Angle<Parameter >>)?>
75
+ "type" <name:Id> <p:Angle<ParameterKind>> <b:(":" <Plus<TraitBound >>)?>
76
76
<w:QuantifiedWhereClauses> ";" =>
77
77
{
78
- let bound = match b {
79
- Some((t, a)) => {
80
- let mut args = vec![Parameter::Ty(Ty::Id{ name })];
81
- args.extend(a);
82
- Some(TraitRef {
83
- trait_name: t,
84
- args: args,
85
- })
86
- }
87
- None => None
88
- };
89
78
AssocTyDefn {
90
79
name: name,
91
80
parameter_kinds: p,
92
81
where_clauses: w,
93
- bound,
82
+ bounds: b.unwrap_or(vec![]),
83
+ }
84
+ }
85
+ };
86
+
87
+ TraitBound: TraitBound = {
88
+ <t:Id> <a:Angle<Parameter>> => {
89
+ TraitBound {
90
+ trait_name: t,
91
+ args_no_self: a,
94
92
}
95
93
}
96
94
};
@@ -301,6 +299,11 @@ SemiColon<T>: Vec<T> = {
301
299
<Separator<";", T>>
302
300
};
303
301
302
+ #[inline]
303
+ Plus<T>: Vec<T> = {
304
+ <Separator<"+", T>>
305
+ };
306
+
304
307
Angle<T>: Vec<T> = {
305
308
"<" <Comma<T>> ">",
306
309
() => vec![],
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ fn gat_parse() {
311
311
trait Sized {}
312
312
313
313
trait Foo {
314
- type Item<'a, T>: Clone where Self: Sized;
314
+ type Item<'a, T>: Sized + Clone where Self: Sized;
315
315
}
316
316
317
317
trait Bar {
You can’t perform that action at this time.
0 commit comments