parse_ty_bare_fn: improve docs

This commit is contained in:
Mazdak Farrokhzad 2019-12-08 12:40:20 +01:00
parent d0105600d1
commit d6f37c66c7

View File

@ -250,20 +250,15 @@ fn token_is_bare_fn_keyword(&mut self) -> bool {
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)?;