Skip to content

Commit

Permalink
parse_ty_bare_fn: improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Dec 20, 2019
1 parent 0ebd421 commit d977e5b
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/librustc_parse/parser/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,20 +250,15 @@ impl<'a> Parser<'a> {
self.check_keyword(kw::Extern)
}

/// Parses a `TyKind::BareFn` type.
/// Parses a function pointer type (`TyKind::BareFn`).
/// ```
/// [unsafe] [extern "ABI"] fn (S) -> T
/// ^~~~~^ ^~~~^ ^~^ ^
/// | | | |
/// | | | Return type
/// Function Style ABI Parameter types
/// ```
fn parse_ty_bare_fn(&mut self, generic_params: Vec<GenericParam>) -> PResult<'a, TyKind> {
/*
[unsafe] [extern "ABI"] fn (S) -> T
^~~~^ ^~~~^ ^~^ ^
| | | |
| | | Return type
| | Argument types
| |
| ABI
Function Style
*/

let unsafety = self.parse_unsafety();
let ext = self.parse_extern()?;
self.expect_keyword(kw::Fn)?;
Expand Down

0 comments on commit d977e5b

Please sign in to comment.