File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/librustc_parse/parser Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -79,8 +79,7 @@ impl<'a> Parser<'a> {
7979 // Never type `!`
8080 TyKind :: Never
8181 } else if self . eat ( & token:: BinOp ( token:: Star ) ) {
82- // Raw pointer
83- TyKind :: Ptr ( self . parse_ptr ( ) ?)
82+ self . parse_ty_ptr ( ) ?
8483 } else if self . eat ( & token:: OpenDelim ( token:: Bracket ) ) {
8584 // Array or slice
8685 let t = self . parse_ty ( ) ?;
@@ -251,7 +250,8 @@ impl<'a> Parser<'a> {
251250 Ok ( TyKind :: TraitObject ( bounds, TraitObjectSyntax :: None ) )
252251 }
253252
254- fn parse_ptr ( & mut self ) -> PResult < ' a , MutTy > {
253+ /// Parses a raw pointer type: `*[const | mut] $type`.
254+ fn parse_ty_ptr ( & mut self ) -> PResult < ' a , TyKind > {
255255 let mutbl = self . parse_const_or_mut ( ) . unwrap_or_else ( || {
256256 let span = self . prev_span ;
257257 let msg = "expected mut or const in raw pointer type" ;
@@ -261,8 +261,8 @@ impl<'a> Parser<'a> {
261261 . emit ( ) ;
262262 Mutability :: Immutable
263263 } ) ;
264- let t = self . parse_ty_no_plus ( ) ?;
265- Ok ( MutTy { ty : t , mutbl } )
264+ let ty = self . parse_ty_no_plus ( ) ?;
265+ Ok ( TyKind :: Ptr ( MutTy { ty, mutbl } ) )
266266 }
267267
268268 fn maybe_parse_fixed_length_of_vec ( & mut self ) -> PResult < ' a , Option < P < ast:: Expr > > > {
You can’t perform that action at this time.
0 commit comments