Determine whether lambda set is represented as an arg

This commit is contained in:
Ayaz Hafiz 2022-08-10 10:08:15 -07:00
parent fc4979e2ce
commit 62dde549e6
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -840,13 +840,17 @@ impl<'a> LambdaSet<'a> {
}
pub fn is_represented(&self) -> Option<Layout<'a>> {
match self.representation {
Layout::Struct {
field_layouts: &[], ..
if self.has_unwrapped_capture_repr() {
Some(*self.representation)
} else if self.has_multi_dispatch_repr() {
None
} else {
match self.representation {
Layout::Struct {
field_layouts: &[], ..
} => None,
repr => Some(*repr),
}
| Layout::Builtin(Builtin::Bool)
| Layout::Builtin(Builtin::Int(..)) => None,
repr => Some(*repr),
}
}