loosen stack bounds

This commit is contained in:
AF 2023-07-29 10:39:30 +00:00
parent 0615c07e42
commit 886f6b2117

View File

@ -6,7 +6,7 @@ use crate::rstd::external_points::*;
use crate::rstd::{inlining::*, nullable::*, point::*, *};
/// Node containing a (nullable) reference to the next node and an element.
pub struct StackNode<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx>> {
pub struct StackNode<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> {
/// Reference comes first due to being inlineable.
pub rest: Stack<'a, Ctx, A>,
/// Unlike the original implementation in Python, doesn't default to using Point.
@ -29,7 +29,7 @@ impl<F> StackNodeFactory<F> {
}
}
impl<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx>> Serializable for StackNode<'a, Ctx, A> {
impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> Serializable for StackNode<'a, Ctx, A> {
fn serialize(&self, serializer: &mut dyn Serializer) {
self.rest.serialize(serializer);
self.element.serialize(serializer);
@ -90,7 +90,7 @@ where
}
}
impl<'a, Ctx: Context<'a>, A: StackCompatible<'a, Ctx>> MentionableBase<'a, Ctx>
impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> MentionableBase<'a, Ctx>
for StackNode<'a, Ctx, A>
{
type Fctr = StackNodeFactory<A::Fctr>;
@ -148,10 +148,7 @@ impl<F> StackNodeFactory<F> {
}
}
impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> FactoryBase<'a, Ctx> for StackNodeFactory<F>
where
F::Mtbl: StackCompatible<'a, Ctx>,
{
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> FactoryBase<'a, Ctx> for StackNodeFactory<F> {
type Mtbl = StackNode<'a, Ctx, F::Mtbl>;
type ParseError = StackParseError<ParseError<'a, Ctx, F>>;