Make CtonError parameterized on the result type.

This makes it more consistent with other custom `Result` types.
This commit is contained in:
Dan Gohman
2018-06-07 15:06:31 -07:00
parent 13f22065a2
commit 02e34d1bf7
8 changed files with 32 additions and 32 deletions

View File

@@ -2,7 +2,7 @@
use ir::stackslot::{StackOffset, StackSize, StackSlotKind};
use ir::StackSlots;
use result::CtonError;
use result::{CtonError, CtonResult};
use std::cmp::{max, min};
/// Compute the stack frame layout.
@@ -15,7 +15,7 @@ use std::cmp::{max, min};
/// Returns the total stack frame size which is also saved in `frame.frame_size`.
///
/// If the stack frame is too big, returns an `ImplLimitExceeded` error.
pub fn layout_stack(frame: &mut StackSlots, alignment: StackSize) -> Result<StackSize, CtonError> {
pub fn layout_stack(frame: &mut StackSlots, alignment: StackSize) -> CtonResult<StackSize> {
// Each object and the whole stack frame must fit in 2 GB such that any relative offset within
// the frame fits in a `StackOffset`.
let max_size = StackOffset::max_value() as StackSize;