pub struct FmtCtx<'a> {
pub translated: Option<&'a TranslatedCrate>,
pub generics: VecDeque<Cow<'a, GenericParams>>,
pub locals: Option<&'a Locals>,
}
Expand description
For formatting.
Note that we use the ULLBC definitions, even when formatting LLBC definitions. It doesn’t really matter, as all we use is the name of the definitions.
Remark: we take shared borrows to the top-level declarations, but clone the generics, because we may dive into different contexts and may need to update those. We can think of a smarter way of doing this, but for now it is simple and efficient enough.
Fields§
§translated: Option<&'a TranslatedCrate>
§generics: VecDeque<Cow<'a, GenericParams>>
Generics form a stack, where each binder introduces a new level. For DeBruijn indices to work, we keep the innermost parameters at the start of the vector.
locals: Option<&'a Locals>
Implementations§
source§impl<'a> FmtCtx<'a>
impl<'a> FmtCtx<'a>
pub fn new() -> Self
pub fn format_decl_id(&self, id: AnyTransId) -> String
pub fn get_item( &self, id: AnyTransId, ) -> Result<AnyTransItem<'_>, Option<&Name>>
fn format_any_decl(&self, id: AnyTransId) -> String
Trait Implementations§
source§impl<'a> DeclFormatter<FunDeclId> for FmtCtx<'a>
impl<'a> DeclFormatter<FunDeclId> for FmtCtx<'a>
fn format_decl(&self, id: FunDeclId) -> String
source§impl<'a> DeclFormatter<GlobalDeclId> for FmtCtx<'a>
impl<'a> DeclFormatter<GlobalDeclId> for FmtCtx<'a>
fn format_decl(&self, id: GlobalDeclId) -> String
source§impl<'a> DeclFormatter<TraitDeclId> for FmtCtx<'a>
impl<'a> DeclFormatter<TraitDeclId> for FmtCtx<'a>
fn format_decl(&self, id: TraitDeclId) -> String
source§impl<'a> DeclFormatter<TraitImplId> for FmtCtx<'a>
impl<'a> DeclFormatter<TraitImplId> for FmtCtx<'a>
fn format_decl(&self, id: TraitImplId) -> String
source§impl<'a> DeclFormatter<TypeDeclId> for FmtCtx<'a>
impl<'a> DeclFormatter<TypeDeclId> for FmtCtx<'a>
fn format_decl(&self, id: TypeDeclId) -> String
source§impl<'a> Formatter<&FunDecl> for FmtCtx<'a>
impl<'a> Formatter<&FunDecl> for FmtCtx<'a>
fn format_object(&self, def: &FunDecl) -> String
source§impl<'a> Formatter<&FunSig> for FmtCtx<'a>
impl<'a> Formatter<&FunSig> for FmtCtx<'a>
fn format_object(&self, x: &FunSig) -> String
source§impl<'a> Formatter<&GExprBody<Block>> for FmtCtx<'a>
impl<'a> Formatter<&GExprBody<Block>> for FmtCtx<'a>
fn format_object(&self, body: &ExprBody) -> String
source§impl<'a> Formatter<&GExprBody<Vector<BlockId, BlockData>>> for FmtCtx<'a>
impl<'a> Formatter<&GExprBody<Vector<BlockId, BlockData>>> for FmtCtx<'a>
fn format_object(&self, body: &ExprBody) -> String
source§impl<'a> Formatter<&GlobalDecl> for FmtCtx<'a>
impl<'a> Formatter<&GlobalDecl> for FmtCtx<'a>
fn format_object(&self, def: &GlobalDecl) -> String
source§impl<'a> Formatter<&ImplElem> for FmtCtx<'a>
impl<'a> Formatter<&ImplElem> for FmtCtx<'a>
fn format_object(&self, elem: &ImplElem) -> String
source§impl<'a> Formatter<&RegionVar> for FmtCtx<'a>
impl<'a> Formatter<&RegionVar> for FmtCtx<'a>
fn format_object(&self, var: &RegionVar) -> String
source§impl<'a> Formatter<&TraitDecl> for FmtCtx<'a>
impl<'a> Formatter<&TraitDecl> for FmtCtx<'a>
fn format_object(&self, def: &TraitDecl) -> String
source§impl<'a> Formatter<&TraitImpl> for FmtCtx<'a>
impl<'a> Formatter<&TraitImpl> for FmtCtx<'a>
fn format_object(&self, def: &TraitImpl) -> String
source§impl<'a> Formatter<&TypeDecl> for FmtCtx<'a>
impl<'a> Formatter<&TypeDecl> for FmtCtx<'a>
fn format_object(&self, def: &TypeDecl) -> String
source§impl<'a> Formatter<(DeBruijnId, RegionId)> for FmtCtx<'a>
impl<'a> Formatter<(DeBruijnId, RegionId)> for FmtCtx<'a>
fn format_object(&self, (grid, id): (DeBruijnId, RegionId)) -> String
source§impl<'a> Formatter<(TypeDeclId, Option<VariantId>, FieldId)> for FmtCtx<'a>
impl<'a> Formatter<(TypeDeclId, Option<VariantId>, FieldId)> for FmtCtx<'a>
For struct/enum values: retrieve a field name
fn format_object(&self, id: (TypeDeclId, Option<VariantId>, FieldId)) -> String
source§impl<'a> Formatter<(TypeDeclId, VariantId)> for FmtCtx<'a>
impl<'a> Formatter<(TypeDeclId, VariantId)> for FmtCtx<'a>
For enum values: List::Cons
fn format_object(&self, id: (TypeDeclId, VariantId)) -> String
source§impl<'a> Formatter<AnyTransId> for FmtCtx<'a>
impl<'a> Formatter<AnyTransId> for FmtCtx<'a>
fn format_object(&self, id: AnyTransId) -> String
source§impl<'a> Formatter<BodyId> for FmtCtx<'a>
impl<'a> Formatter<BodyId> for FmtCtx<'a>
fn format_object(&self, id: BodyId) -> String
source§impl<'a> Formatter<ConstGenericVarId> for FmtCtx<'a>
impl<'a> Formatter<ConstGenericVarId> for FmtCtx<'a>
fn format_object(&self, id: ConstGenericVarId) -> String
source§impl<'a> Formatter<FunDeclId> for FmtCtx<'a>
impl<'a> Formatter<FunDeclId> for FmtCtx<'a>
fn format_object(&self, id: FunDeclId) -> String
source§impl<'a> Formatter<GlobalDeclId> for FmtCtx<'a>
impl<'a> Formatter<GlobalDeclId> for FmtCtx<'a>
fn format_object(&self, id: GlobalDeclId) -> String
source§impl<'a> Formatter<TraitClauseId> for FmtCtx<'a>
impl<'a> Formatter<TraitClauseId> for FmtCtx<'a>
fn format_object(&self, id: TraitClauseId) -> String
source§impl<'a> Formatter<TraitDeclId> for FmtCtx<'a>
impl<'a> Formatter<TraitDeclId> for FmtCtx<'a>
fn format_object(&self, id: TraitDeclId) -> String
source§impl<'a> Formatter<TraitImplId> for FmtCtx<'a>
impl<'a> Formatter<TraitImplId> for FmtCtx<'a>
fn format_object(&self, id: TraitImplId) -> String
source§impl<'a> Formatter<TypeDeclId> for FmtCtx<'a>
impl<'a> Formatter<TypeDeclId> for FmtCtx<'a>
fn format_object(&self, id: TypeDeclId) -> String
source§impl<'a> Formatter<TypeVarId> for FmtCtx<'a>
impl<'a> Formatter<TypeVarId> for FmtCtx<'a>
fn format_object(&self, id: TypeVarId) -> String
source§impl<'a, 'b> PushBoundRegions<'a> for FmtCtx<'b>
impl<'a, 'b> PushBoundRegions<'a> for FmtCtx<'b>
source§impl<'a, 'b> SetGenerics<'a> for FmtCtx<'b>
impl<'a, 'b> SetGenerics<'a> for FmtCtx<'b>
type C = FmtCtx<'a>
fn set_generics(&'a self, generics: &'a GenericParams) -> Self::C
Auto Trait Implementations§
impl<'a> Freeze for FmtCtx<'a>
impl<'a> RefUnwindSafe for FmtCtx<'a>
impl<'a> Send for FmtCtx<'a>
impl<'a> Sync for FmtCtx<'a>
impl<'a> Unpin for FmtCtx<'a>
impl<'a> UnwindSafe for FmtCtx<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<C> IntoFormatter for Cwhere
C: AstFormatter,
impl<C> IntoFormatter for Cwhere
C: AstFormatter,
§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more