diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-04-30 23:05:27 +0200 |
|---|---|---|
| committer | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-07-01 21:16:25 +0200 |
| commit | 3019c1cb2a6e3f599fd0d71a7ddc5f2f8b46385c (patch) | |
| tree | c032f8d7aedd19b4b583fd272a7a846dca525ae9 /compiler/rustc_const_eval/src/util | |
| parent | 6162f6f12339aa81fe16b8a64644ead497e411b2 (diff) | |
| download | rust-3019c1cb2a6e3f599fd0d71a7ddc5f2f8b46385c.tar.gz rust-3019c1cb2a6e3f599fd0d71a7ddc5f2f8b46385c.zip | |
Put `LayoutError` behind reference to shrink result
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
Diffstat (limited to 'compiler/rustc_const_eval/src/util')
| -rw-r--r-- | compiler/rustc_const_eval/src/util/check_validity_requirement.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/util/check_validity_requirement.rs b/compiler/rustc_const_eval/src/util/check_validity_requirement.rs index f56798d4c32..2d1970791ca 100644 --- a/compiler/rustc_const_eval/src/util/check_validity_requirement.rs +++ b/compiler/rustc_const_eval/src/util/check_validity_requirement.rs @@ -21,7 +21,7 @@ pub fn check_validity_requirement<'tcx>( tcx: TyCtxt<'tcx>, kind: ValidityRequirement, param_env_and_ty: ParamEnvAnd<'tcx, Ty<'tcx>>, -) -> Result<bool, LayoutError<'tcx>> { +) -> Result<bool, &'tcx LayoutError<'tcx>> { let layout = tcx.layout_of(param_env_and_ty)?; // There is nothing strict or lax about inhabitedness. @@ -43,7 +43,7 @@ fn might_permit_raw_init_strict<'tcx>( ty: TyAndLayout<'tcx>, tcx: TyCtxt<'tcx>, kind: ValidityRequirement, -) -> Result<bool, LayoutError<'tcx>> { +) -> Result<bool, &'tcx LayoutError<'tcx>> { let machine = CompileTimeInterpreter::new(CanAccessStatics::No, CheckAlignment::Error); let mut cx = InterpCx::new(tcx, rustc_span::DUMMY_SP, ParamEnv::reveal_all(), machine); @@ -75,7 +75,7 @@ fn might_permit_raw_init_lax<'tcx>( this: TyAndLayout<'tcx>, cx: &LayoutCx<'tcx, TyCtxt<'tcx>>, init_kind: ValidityRequirement, -) -> Result<bool, LayoutError<'tcx>> { +) -> Result<bool, &'tcx LayoutError<'tcx>> { let scalar_allows_raw_init = move |s: Scalar| -> bool { match init_kind { ValidityRequirement::Inhabited => { |
