add naive_layout_of
query
This commit is contained in:
parent
e2a7ba2771
commit
cb8b1d1bc9
19 changed files with 294 additions and 49 deletions
|
@ -111,6 +111,11 @@ impl EraseType
|
|||
>()];
|
||||
}
|
||||
|
||||
impl EraseType for Result<ty::layout::TyAndNaiveLayout<'_>, &ty::layout::LayoutError<'_>> {
|
||||
type Result =
|
||||
[u8; size_of::<Result<ty::layout::TyAndNaiveLayout<'_>, &ty::layout::LayoutError<'_>>>()];
|
||||
}
|
||||
|
||||
impl EraseType for Result<ty::Const<'_>, mir::interpret::LitToConstError> {
|
||||
type Result = [u8; size_of::<Result<ty::Const<'static>, mir::interpret::LitToConstError>>()];
|
||||
}
|
||||
|
|
|
@ -1394,6 +1394,17 @@ rustc_queries! {
|
|||
desc { "computing layout of `{}`", key.value }
|
||||
}
|
||||
|
||||
/// Computes the naive layout estimate of a type. Note that this implicitly
|
||||
/// executes in "reveal all" mode, and will normalize the input type.
|
||||
///
|
||||
/// Unlike `layout_of`, this doesn't recurse behind reference types.
|
||||
query naive_layout_of(
|
||||
key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>
|
||||
) -> Result<ty::layout::TyAndNaiveLayout<'tcx>, &'tcx ty::layout::LayoutError<'tcx>> {
|
||||
depth_limit
|
||||
desc { "computing layout (naive) of `{}`", key.value }
|
||||
}
|
||||
|
||||
/// Compute a `FnAbi` suitable for indirect calls, i.e. to `fn` pointers.
|
||||
///
|
||||
/// NB: this doesn't handle virtual calls - those should use `fn_abi_of_instance`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue