blob: 8298450f741fbe91c8bcc602544bf07e28259710 [file] [log] [blame]
//! Handle the conversion of different internal errors into a stable version.
//!
//! Currently we encode everything as [stable_mir::Error], which is represented as a string.
use crate::rustc_smir::{Stable, Tables};
use rustc_middle::mir::interpret::AllocError;
use rustc_middle::ty::layout::LayoutError;
impl<'tcx> Stable<'tcx> for LayoutError<'tcx> {
type T = stable_mir::Error;
fn stable(&self, _tables: &mut Tables<'_>) -> Self::T {
stable_mir::Error::new(format!("{self:?}"))
}
}
impl<'tcx> Stable<'tcx> for AllocError {
type T = stable_mir::Error;
fn stable(&self, _tables: &mut Tables<'_>) -> Self::T {
stable_mir::Error::new(format!("{self:?}"))
}
}