lookup_error

This commit is contained in:
AF 2023-08-01 20:57:02 +00:00
parent f08b7d3c7a
commit 7dbfc49c54

View File

@ -169,13 +169,19 @@ impl<'a, Ctx: CastCtx<'a>> TypelessMentionable<'a, Ctx> {
} }
} }
fn lookup_error<'a, Ctx: CastCtx<'a>>(
error: ResolutionFailure<'a, Ctx, TypelessMentionable<'a, Ctx>>,
) -> Ctx::LookupError {
match error {
ResolutionError::Lookup(lookup_error) => lookup_error,
ResolutionError::Parse(parse_error) => Ctx::from_cast(CastError::Typeless(parse_error)),
}
}
fn cast_error<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>( fn cast_error<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>(
error: ResolutionFailure<'a, Ctx, TypelessMentionable<'a, Ctx>>, error: ResolutionFailure<'a, Ctx, TypelessMentionable<'a, Ctx>>,
) -> ResolutionFailure<'a, Ctx, A> { ) -> ResolutionFailure<'a, Ctx, A> {
ResolutionError::Lookup(match error { ResolutionError::Lookup(lookup_error::<Ctx>(error))
ResolutionError::Lookup(lookup_error) => lookup_error,
ResolutionError::Parse(parse_error) => Ctx::from_cast(CastError::Typeless(parse_error)),
})
} }
fn cast_resolved<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>( fn cast_resolved<'a, Ctx: CastCtx<'a>, A: Mentionable<'a, Ctx>>(