1
Fork 0

Add genness to FnHeader

This commit is contained in:
Eric Holk 2023-11-28 10:15:39 -08:00
parent e281163dc8
commit bc0d10d4b0
No known key found for this signature in database
GPG key ID: 8EA6B43ED4CE0911
4 changed files with 26 additions and 5 deletions

View file

@ -2837,16 +2837,19 @@ pub struct FnHeader {
pub constness: Const,
/// The `extern` keyword and corresponding ABI string, if any
pub ext: Extern,
/// The `gen` keyword, if any
pub genness: Gen,
}
impl FnHeader {
/// Does this function header have any qualifiers or is it empty?
pub fn has_qualifiers(&self) -> bool {
let Self { unsafety, asyncness, constness, ext } = self;
let Self { unsafety, asyncness, constness, ext, genness } = self;
matches!(unsafety, Unsafe::Yes(_))
|| asyncness.is_async()
|| matches!(constness, Const::Yes(_))
|| !matches!(ext, Extern::None)
|| matches!(genness, Gen::Yes { .. })
}
}
@ -2857,6 +2860,7 @@ impl Default for FnHeader {
asyncness: Async::No,
constness: Const::No,
ext: Extern::None,
genness: Gen::No,
}
}
}
@ -3177,7 +3181,7 @@ mod size_asserts {
static_assert_size!(Block, 32);
static_assert_size!(Expr, 72);
static_assert_size!(ExprKind, 40);
static_assert_size!(Fn, 152);
static_assert_size!(Fn, 168);
static_assert_size!(ForeignItem, 96);
static_assert_size!(ForeignItemKind, 24);
static_assert_size!(GenericArg, 24);