add naive_layout_of query

This commit is contained in:
Moulins 2023-06-19 15:29:31 +02:00
parent e2a7ba2771
commit cb8b1d1bc9
19 changed files with 294 additions and 49 deletions

View file

@ -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`