diff --git a/naga/src/front/wgsl/lower/construction.rs b/naga/src/front/wgsl/lower/construction.rs index c7e4106460..96cc45bfa5 100644 --- a/naga/src/front/wgsl/lower/construction.rs +++ b/naga/src/front/wgsl/lower/construction.rs @@ -448,7 +448,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { ctx.try_automatic_conversions_slice( &mut components, &Tr::Value(component_ty), - span, + ty_span, )?; expr = crate::Expression::Compose { ty, components }; } @@ -497,7 +497,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { // Array constructor, explicit type (components, Constructor::Type((ty, &crate::TypeInner::Array { base, .. }))) => { let mut components = components.into_components_vec(); - ctx.try_automatic_conversions_slice(&mut components, &Tr::Handle(base), span)?; + ctx.try_automatic_conversions_slice(&mut components, &Tr::Handle(base), ty_span)?; expr = crate::Expression::Compose { ty, components }; } diff --git a/naga/tests/wgsl_errors.rs b/naga/tests/wgsl_errors.rs index 56ca313464..b74f805f0d 100644 --- a/naga/tests/wgsl_errors.rs +++ b/naga/tests/wgsl_errors.rs @@ -213,9 +213,8 @@ fn constructor_parameter_type_mismatch() { ┌─ wgsl:3:21 │ 3 │ _ = mat2x2(array(0, 1), vec2(2, 3)); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ this expression has type array<{AbstractInt}, 2> + │ ^^^^^^^^^^^ ^^^^^^^^^^^ this expression has type array<{AbstractInt}, 2> + │ │ │ a value of type vec2 is required here "#,