Thread simple model of "ErasedLambdas" through proc layouts

But none of these paths are yet exercised.
This commit is contained in:
Ayaz Hafiz 2023-06-23 13:15:12 -05:00
parent 6eae480e36
commit c459757062
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
8 changed files with 79 additions and 11 deletions

View file

@ -481,9 +481,24 @@ impl From<LayoutProblem> for RuntimeError {
}
}
/// When we do not kind functions, we type-erase functions to opaque pointers.
/// The erased function definition, however, continues to hold data about how the erased function
/// behaves.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum OpaqueFunctionData<'a> {
/// This function is not capturing, and needs no extra data regarding closures.
Null,
/// This function is capturing.
Capturing {
/// The concrete type of the closure data expected by a call to the function.
closure_data_layout: InLayout<'a>,
},
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum RawFunctionLayout<'a> {
Function(&'a [InLayout<'a>], LambdaSet<'a>, InLayout<'a>),
ErasedFunction(&'a [InLayout<'a>], OpaqueFunctionData<'a>, InLayout<'a>),
ZeroArgumentThunk(InLayout<'a>),
}