Macro naga::front::wgsl::lower::resolve_inner

source ·
macro_rules! resolve_inner {
    ($ctx:ident, $expr:expr) => { ... };
}
Expand description

Resolves the inner type of a given expression.

Expects a &mut ExpressionContext and a Handle<Expression>.

Returns a &crate::TypeInner.

Ideally, we would simply have a function that takes a &mut ExpressionContext and returns a &TypeResolution. Unfortunately, this leads the borrow checker to conclude that the mutable borrow lasts for as long as we are using the &TypeResolution, so we can’t use the ExpressionContext for anything else - like, say, resolving another operand’s type. Using a macro that expands to two separate calls, only the first of which needs a &mut, lets the borrow checker see that the mutable borrow is over.