Add stable Instance::body() and RustcInternal trait

The `Instance::body()` returns a monomorphized body.

For that, we had to implement visitor that monomorphize types and
constants. We are also introducing the RustcInternal trait that will
allow us to convert back from Stable to Internal.

Note that this trait is not yet visible for our users as it depends on
Tables. We should probably add a new trait that can be exposed.
This commit is contained in:
Celina G. Val
2023-10-19 17:06:53 -07:00
parent cc705b8012
commit 6ed2a76bcc
10 changed files with 218 additions and 7 deletions

View File

@@ -4,6 +4,7 @@
//! - [CompilerError]: This represents errors that can be raised when invoking the compiler.
//! - [Error]: Generic error that represents the reason why a request that could not be fulfilled.
use std::convert::From;
use std::fmt::{Debug, Display, Formatter};
use std::{error, fmt};
@@ -31,6 +32,12 @@ impl Error {
}
}
impl From<&str> for Error {
fn from(value: &str) -> Self {
Self(value.into())
}
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
Display::fmt(&self.0, f)