func quote_type(input: MacroInput, splices: [SyntaxSplice<TypeAnnotation>], context: &QuoteContext) -> SyntaxResult<TypeAnnotation>Quotes type tokens, applies hygiene, and validates the completed annotation.
Type splices remain structural nodes rather than rendered text, preserving their source identity and preventing precedence-sensitive substitution.
View Source
pub func quote_type(input: MacroInput, splices: [SyntaxSplice<TypeAnnotation>], context: &QuoteContext) -> SyntaxResult<TypeAnnotation> {
let result = quote_raw(input: input, splices: raw_type_splices(splices: splices), context: context, category: .type_annotation)
if let .some(failure) = result.failure { return SyntaxResult<TypeAnnotation>(value: .none, failure: .some(failure)) }
if let .some(raw) = result.raw {
let materialized = materialize(raw: raw, group_splices: false)
if let .some(failure) = parse_failure(outcome: parse_type_tokens(source: materialized.source, input: materialized.input), fallback: materialized.input.span) {
return SyntaxResult<TypeAnnotation>(value: .none, failure: .some(failure))
}
return SyntaxResult<TypeAnnotation>(value: .some(Syntax<TypeAnnotation>(raw: raw)), failure: .none)
}
SyntaxResult<TypeAnnotation>(value: .none, failure: .some(SyntaxFailure(code: "syntax.quote.invalid", message: "Invalid type quotation", span: 0..<0)))
}