@@ -2704,49 +2704,52 @@ pub impl Parser {
2704
2704
2705
2705
let mut result = opt_vec:: Empty ;
2706
2706
loop {
2707
- if self . eat ( & token:: BINOP ( token:: AND ) ) {
2708
- if self . eat_keyword ( & ~"static ") {
2709
- result. push ( RegionTyParamBound ) ;
2710
- } else {
2711
- self . span_err ( * self . span ,
2712
- ~"`& static ` is the only permissible \
2713
- region bound here") ;
2707
+ match * self . token {
2708
+ token:: LIFETIME ( lifetime) => {
2709
+ if str:: eq_slice ( * self . id_to_str ( lifetime) , "static" ) {
2710
+ result. push ( RegionTyParamBound ) ;
2711
+ } else {
2712
+ self . span_err ( * self . span ,
2713
+ ~"`' static` is the only permissible \
2714
+ region bound here") ;
2715
+ }
2716
+ self . bump ( ) ;
2714
2717
}
2715
- } else if is_ident ( & * self . token ) {
2716
- let maybe_bound = match * self . token {
2717
- token:: IDENT ( copy sid, _) => {
2718
- match * self . id_to_str ( sid) {
2719
- ~"send" |
2720
- ~"copy" |
2721
- ~"const " |
2722
- ~"owned" => {
2723
- self . obsolete (
2724
- * self . span ,
2725
- ObsoleteLowerCaseKindBounds ) ;
2726
-
2727
- // Bogus value, but doesn't matter, since
2728
- // is an error
2729
- Some ( TraitTyParamBound (
2730
- self . mk_ty_path ( sid) ) )
2718
+ token:: IDENT ( * ) => {
2719
+ let maybe_bound = match * self . token {
2720
+ token:: IDENT ( copy sid, _) => {
2721
+ match * self . id_to_str ( sid) {
2722
+ ~"send" |
2723
+ ~"copy" |
2724
+ ~"const " |
2725
+ ~"owned" => {
2726
+ self . obsolete (
2727
+ * self . span ,
2728
+ ObsoleteLowerCaseKindBounds ) ;
2729
+
2730
+ // Bogus value, but doesn't matter, since
2731
+ // is an error
2732
+ Some ( TraitTyParamBound (
2733
+ self . mk_ty_path ( sid) ) )
2734
+ }
2735
+ _ => None
2731
2736
}
2732
- _ => None
2733
2737
}
2734
- }
2735
- _ => fail ! ( )
2736
- } ;
2738
+ _ => fail ! ( )
2739
+ } ;
2737
2740
2738
- match maybe_bound {
2739
- Some ( bound) => {
2740
- self . bump ( ) ;
2741
- result. push ( bound) ;
2742
- }
2743
- None => {
2744
- let ty = self . parse_ty ( false ) ;
2745
- result. push ( TraitTyParamBound ( ty) ) ;
2741
+ match maybe_bound {
2742
+ Some ( bound) => {
2743
+ self . bump ( ) ;
2744
+ result. push ( bound) ;
2745
+ }
2746
+ None => {
2747
+ let ty = self . parse_ty ( false ) ;
2748
+ result. push ( TraitTyParamBound ( ty) ) ;
2749
+ }
2746
2750
}
2747
2751
}
2748
- } else {
2749
- break ;
2752
+ _ => break ,
2750
2753
}
2751
2754
2752
2755
if self . eat ( & token:: BINOP ( token:: PLUS ) ) {
0 commit comments