Skip to content

Commit 065b526

Browse files
committed
compiletest: normalize rustc error lines and columns
1 parent 879b2f0 commit 065b526

File tree

65 files changed

+1909
-1843
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1909
-1843
lines changed

tests/compiletests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,5 @@ contents of `path/to/test.rs.stderr`.
8383
* remove rustc error src paths:
8484
* `// normalize-stderr-test "\S*/lib/rustlib/" -> "$$SYSROOT/lib/rustlib/"` normalize path to crates delivered with rustc, such as `core`
8585
* `// normalize-stderr-test "\S*/crates/spirv-std/src/" -> "$$SPIRV_STD_SRC/"` normalize path to the `spirv-std` crate
86+
* `// normalize-stderr-test "\.rs:\d+:\d+" -> ".rs:""` remove the line and column from error messages, eg. `--> path/to/some.rs:8:6`
87+
* `// normalize-stderr-test "(\n)\d* *([ -])([\|\+\-\=])" -> "$1 $2$3""` remove the line number prefixing the source code snippet, does not touch `...`

tests/compiletests/ui/arch/debug_printf_type_checking.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// build-fail
22
// normalize-stderr-test "\S*/crates/spirv-std/src/" -> "$$SPIRV_STD_SRC/"
33
// compile-flags: -Ctarget-feature=+ext:SPV_KHR_non_semantic_info
4+
// normalize-stderr-test "\.rs:\d+:\d+" -> ".rs:"
5+
// normalize-stderr-test "(\n)\d* *([ -])([\|\+\-\=])" -> "$1 $2$3"
46

57
use spirv_std::spirv;
68
use spirv_std::{glam::Vec2, macros::debug_printf};

tests/compiletests/ui/arch/debug_printf_type_checking.stderr

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,123 @@
11
error: Unterminated format specifier: missing type after precision
2-
--> $DIR/debug_printf_type_checking.rs:11:23
3-
|
4-
11 | debug_printf!("%1");
5-
| ^^^^
2+
--> $DIR/debug_printf_type_checking.rs:
3+
|
4+
| debug_printf!("%1");
5+
| ^^^^
66

77
error: Unterminated format specifier: missing type after decimal point
8-
--> $DIR/debug_printf_type_checking.rs:12:23
9-
|
10-
12 | debug_printf!("%1.");
11-
| ^^^^^
8+
--> $DIR/debug_printf_type_checking.rs:
9+
|
10+
| debug_printf!("%1.");
11+
| ^^^^^
1212

1313
error: Unrecognised format specifier: '.'
14-
--> $DIR/debug_printf_type_checking.rs:13:23
15-
|
16-
13 | debug_printf!("%.");
17-
| ^^^^
14+
--> $DIR/debug_printf_type_checking.rs:
15+
|
16+
| debug_printf!("%.");
17+
| ^^^^
1818

1919
error: Unrecognised format specifier: '.'
20-
--> $DIR/debug_printf_type_checking.rs:14:23
21-
|
22-
14 | debug_printf!("%.1");
23-
| ^^^^^
20+
--> $DIR/debug_printf_type_checking.rs:
21+
|
22+
| debug_printf!("%.1");
23+
| ^^^^^
2424

2525
error: Unterminated format specifier: missing type after fraction precision
26-
--> $DIR/debug_printf_type_checking.rs:15:23
27-
|
28-
15 | debug_printf!("%1.1");
29-
| ^^^^^^
26+
--> $DIR/debug_printf_type_checking.rs:
27+
|
28+
| debug_printf!("%1.1");
29+
| ^^^^^^
3030

3131
error: Missing vector dimensions specifier
32-
--> $DIR/debug_printf_type_checking.rs:16:23
33-
|
34-
16 | debug_printf!("%1.1v");
35-
| ^^^^^^^
32+
--> $DIR/debug_printf_type_checking.rs:
33+
|
34+
| debug_printf!("%1.1v");
35+
| ^^^^^^^
3636

3737
error: Invalid width for vector: 5
38-
--> $DIR/debug_printf_type_checking.rs:17:23
39-
|
40-
17 | debug_printf!("%1.1v5");
41-
| ^^^^^^^^
38+
--> $DIR/debug_printf_type_checking.rs:
39+
|
40+
| debug_printf!("%1.1v5");
41+
| ^^^^^^^^
4242

4343
error: Missing vector type specifier
44-
--> $DIR/debug_printf_type_checking.rs:18:23
45-
|
46-
18 | debug_printf!("%1.1v2");
47-
| ^^^^^^^^
44+
--> $DIR/debug_printf_type_checking.rs:
45+
|
46+
| debug_printf!("%1.1v2");
47+
| ^^^^^^^^
4848

4949
error: Unrecognised vector type specifier: 'r'
50-
--> $DIR/debug_printf_type_checking.rs:19:23
51-
|
52-
19 | debug_printf!("%1.1v2r");
53-
| ^^^^^^^^^
50+
--> $DIR/debug_printf_type_checking.rs:
51+
|
52+
| debug_printf!("%1.1v2r");
53+
| ^^^^^^^^^
5454

5555
error: Unrecognised format specifier: 'r'
56-
--> $DIR/debug_printf_type_checking.rs:20:23
57-
|
58-
20 | debug_printf!("%r", 11_i32);
59-
| ^^^^
56+
--> $DIR/debug_printf_type_checking.rs:
57+
|
58+
| debug_printf!("%r", 11_i32);
59+
| ^^^^
6060

6161
error[E0308]: mismatched types
62-
--> $DIR/debug_printf_type_checking.rs:21:29
62+
--> $DIR/debug_printf_type_checking.rs:
6363
|
64-
21 | debug_printf!("%f", 11_u32);
64+
| debug_printf!("%f", 11_u32);
6565
| --------------------^^^^^^-
6666
| | |
6767
| | expected `f32`, found `u32`
6868
| arguments to this function are incorrect
6969
|
7070
help: the return type of this call is `u32` due to the type of the argument passed
71-
--> $DIR/debug_printf_type_checking.rs:21:9
71+
--> $DIR/debug_printf_type_checking.rs:
7272
|
73-
21 | debug_printf!("%f", 11_u32);
73+
| debug_printf!("%f", 11_u32);
7474
| ^^^^^^^^^^^^^^^^^^^^------^
7575
| |
7676
| this argument influences the return type of `debug_printf_assert_is_type`
7777
note: function defined here
78-
--> $SPIRV_STD_SRC/lib.rs:134:8
78+
--> $SPIRV_STD_SRC/lib.rs:
7979
|
80-
134 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
80+
| pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
8181
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
8282
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)
8383
help: change the type of the numeric literal from `u32` to `f32`
8484
|
85-
21 - debug_printf!("%f", 11_u32);
86-
21 + debug_printf!("%f", 11_f32);
85+
- debug_printf!("%f", 11_u32);
86+
+ debug_printf!("%f", 11_f32);
8787
|
8888

8989
error[E0308]: mismatched types
90-
--> $DIR/debug_printf_type_checking.rs:22:29
90+
--> $DIR/debug_printf_type_checking.rs:
9191
|
92-
22 | debug_printf!("%u", 11.0_f32);
92+
| debug_printf!("%u", 11.0_f32);
9393
| --------------------^^^^^^^^-
9494
| | |
9595
| | expected `u32`, found `f32`
9696
| arguments to this function are incorrect
9797
|
9898
help: the return type of this call is `f32` due to the type of the argument passed
99-
--> $DIR/debug_printf_type_checking.rs:22:9
99+
--> $DIR/debug_printf_type_checking.rs:
100100
|
101-
22 | debug_printf!("%u", 11.0_f32);
101+
| debug_printf!("%u", 11.0_f32);
102102
| ^^^^^^^^^^^^^^^^^^^^--------^
103103
| |
104104
| this argument influences the return type of `debug_printf_assert_is_type`
105105
note: function defined here
106-
--> $SPIRV_STD_SRC/lib.rs:134:8
106+
--> $SPIRV_STD_SRC/lib.rs:
107107
|
108-
134 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
108+
| pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
109109
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
110110
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)
111111
help: change the type of the numeric literal from `f32` to `u32`
112112
|
113-
22 - debug_printf!("%u", 11.0_f32);
114-
22 + debug_printf!("%u", 11u32);
113+
- debug_printf!("%u", 11.0_f32);
114+
+ debug_printf!("%u", 11u32);
115115
|
116116

117117
error[E0277]: the trait bound `{float}: Vector<f32, 2>` is not satisfied
118-
--> $DIR/debug_printf_type_checking.rs:23:9
118+
--> $DIR/debug_printf_type_checking.rs:
119119
|
120-
23 | debug_printf!("%v2f", 11.0);
120+
| debug_printf!("%v2f", 11.0);
121121
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Vector<f32, 2>` is not implemented for `{float}`
122122
|
123123
= help: the following other types implement trait `Vector<T, N>`:
@@ -131,35 +131,35 @@ error[E0277]: the trait bound `{float}: Vector<f32, 2>` is not satisfied
131131
`IVec3` implements `Vector<i32, 3>`
132132
and 8 others
133133
note: required by a bound in `debug_printf_assert_is_vector`
134-
--> $SPIRV_STD_SRC/lib.rs:141:8
134+
--> $SPIRV_STD_SRC/lib.rs:
135135
|
136-
139 | pub fn debug_printf_assert_is_vector<
136+
| pub fn debug_printf_assert_is_vector<
137137
| ----------------------------- required by a bound in this function
138-
140 | TY: crate::scalar::Scalar,
139-
141 | V: crate::vector::Vector<TY, SIZE>,
138+
| TY: crate::scalar::Scalar,
139+
| V: crate::vector::Vector<TY, SIZE>,
140140
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `debug_printf_assert_is_vector`
141141
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)
142142

143143
error[E0308]: mismatched types
144-
--> $DIR/debug_printf_type_checking.rs:24:29
144+
--> $DIR/debug_printf_type_checking.rs:
145145
|
146-
24 | debug_printf!("%f", Vec2::splat(33.3));
146+
| debug_printf!("%f", Vec2::splat(33.3));
147147
| --------------------^^^^^^^^^^^^^^^^^-
148148
| | |
149149
| | expected `f32`, found `Vec2`
150150
| arguments to this function are incorrect
151151
|
152152
help: the return type of this call is `Vec2` due to the type of the argument passed
153-
--> $DIR/debug_printf_type_checking.rs:24:9
153+
--> $DIR/debug_printf_type_checking.rs:
154154
|
155-
24 | debug_printf!("%f", Vec2::splat(33.3));
155+
| debug_printf!("%f", Vec2::splat(33.3));
156156
| ^^^^^^^^^^^^^^^^^^^^-----------------^
157157
| |
158158
| this argument influences the return type of `debug_printf_assert_is_type`
159159
note: function defined here
160-
--> $SPIRV_STD_SRC/lib.rs:134:8
160+
--> $SPIRV_STD_SRC/lib.rs:
161161
|
162-
134 | pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
162+
| pub fn debug_printf_assert_is_type<T>(ty: T) -> T {
163163
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
164164
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)
165165

tests/compiletests/ui/arch/subgroup/subgroup_cluster_size_0_fail.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// build-pass
22
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformArithmetic,+GroupNonUniformClustered,+ext:SPV_KHR_vulkan_memory_model
33
// normalize-stderr-test "\S*/crates/spirv-std/src/" -> "$$SPIRV_STD_SRC/"
4+
// normalize-stderr-test "\.rs:\d+:\d+" -> ".rs:"
5+
// normalize-stderr-test "(\n)\d* *([ -])([\|\+\-\=])" -> "$1 $2$3"
46

57
use glam::UVec3;
68
use spirv_std::arch::{GroupOperation, SubgroupMask};

tests/compiletests/ui/arch/subgroup/subgroup_cluster_size_0_fail.stderr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
error[E0080]: evaluation panicked: `ClusterSize` must be at least 1
2-
--> $SPIRV_STD_SRC/arch/subgroup.rs:826:1
2+
--> $SPIRV_STD_SRC/arch/subgroup.rs:
33
|
4-
826 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5-
827 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
6-
828 | |
7-
829 | | Result Type must be a scalar or vector of integer type.
4+
| / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5+
| | An integer add group operation of all `value` operands contributed by active invocations in the group.
6+
| |
7+
| | Result Type must be a scalar or vector of integer type.
88
... |
9-
842 | | * `ClusterSize` must not be greater than the size of the group
10-
843 | | ");
9+
| | * `ClusterSize` must not be greater than the size of the group
10+
| | ");
1111
| |__^ evaluation of `spirv_std::arch::subgroup_clustered_i_add::<0, u32, u32>::{constant#0}` failed here
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

1515
note: erroneous constant encountered
16-
--> $SPIRV_STD_SRC/arch/subgroup.rs:826:1
16+
--> $SPIRV_STD_SRC/arch/subgroup.rs:
1717
|
18-
826 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19-
827 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
20-
828 | |
21-
829 | | Result Type must be a scalar or vector of integer type.
18+
| / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19+
| | An integer add group operation of all `value` operands contributed by active invocations in the group.
20+
| |
21+
| | Result Type must be a scalar or vector of integer type.
2222
... |
23-
842 | | * `ClusterSize` must not be greater than the size of the group
24-
843 | | ");
23+
| | * `ClusterSize` must not be greater than the size of the group
24+
| | ");
2525
| |__^
2626
|
2727
= note: this note originates in the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)
2828

2929
note: the above error was encountered while instantiating `fn spirv_std::arch::subgroup_clustered_i_add::<0, u32, u32>`
30-
--> $DIR/subgroup_cluster_size_0_fail.rs:10:5
31-
|
32-
10 | spirv_std::arch::subgroup_clustered_i_add::<0, _>(value)
33-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
--> $DIR/subgroup_cluster_size_0_fail.rs:
31+
|
32+
| spirv_std::arch::subgroup_clustered_i_add::<0, _>(value)
33+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434

3535
error: aborting due to 1 previous error
3636

tests/compiletests/ui/arch/subgroup/subgroup_cluster_size_non_power_of_two_fail.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// build-pass
22
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformArithmetic,+GroupNonUniformClustered,+ext:SPV_KHR_vulkan_memory_model
33
// normalize-stderr-test "\S*/crates/spirv-std/src/" -> "$$SPIRV_STD_SRC/"
4+
// normalize-stderr-test "\.rs:\d+:\d+" -> ".rs:"
5+
// normalize-stderr-test "(\n)\d* *([ -])([\|\+\-\=])" -> "$1 $2$3"
46

57
use glam::UVec3;
68
use spirv_std::arch::{GroupOperation, SubgroupMask};

tests/compiletests/ui/arch/subgroup/subgroup_cluster_size_non_power_of_two_fail.stderr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
error[E0080]: evaluation panicked: `ClusterSize` must be a power of 2
2-
--> $SPIRV_STD_SRC/arch/subgroup.rs:826:1
2+
--> $SPIRV_STD_SRC/arch/subgroup.rs:
33
|
4-
826 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5-
827 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
6-
828 | |
7-
829 | | Result Type must be a scalar or vector of integer type.
4+
| / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
5+
| | An integer add group operation of all `value` operands contributed by active invocations in the group.
6+
| |
7+
| | Result Type must be a scalar or vector of integer type.
88
... |
9-
842 | | * `ClusterSize` must not be greater than the size of the group
10-
843 | | ");
9+
| | * `ClusterSize` must not be greater than the size of the group
10+
| | ");
1111
| |__^ evaluation of `spirv_std::arch::subgroup_clustered_i_add::<5, u32, u32>::{constant#0}` failed here
1212
|
1313
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

1515
note: erroneous constant encountered
16-
--> $SPIRV_STD_SRC/arch/subgroup.rs:826:1
16+
--> $SPIRV_STD_SRC/arch/subgroup.rs:
1717
|
18-
826 | / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19-
827 | | An integer add group operation of all `value` operands contributed by active invocations in the group.
20-
828 | |
21-
829 | | Result Type must be a scalar or vector of integer type.
18+
| / macro_subgroup_op_clustered!(impl Integer, "OpGroupNonUniformIAdd", subgroup_clustered_i_add; r"
19+
| | An integer add group operation of all `value` operands contributed by active invocations in the group.
20+
| |
21+
| | Result Type must be a scalar or vector of integer type.
2222
... |
23-
842 | | * `ClusterSize` must not be greater than the size of the group
24-
843 | | ");
23+
| | * `ClusterSize` must not be greater than the size of the group
24+
| | ");
2525
| |__^
2626
|
2727
= note: this note originates in the macro `macro_subgroup_op_clustered` (in Nightly builds, run with -Z macro-backtrace for more info)
2828

2929
note: the above error was encountered while instantiating `fn spirv_std::arch::subgroup_clustered_i_add::<5, u32, u32>`
30-
--> $DIR/subgroup_cluster_size_non_power_of_two_fail.rs:10:5
31-
|
32-
10 | spirv_std::arch::subgroup_clustered_i_add::<5, _>(value)
33-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
--> $DIR/subgroup_cluster_size_non_power_of_two_fail.rs:
31+
|
32+
| spirv_std::arch::subgroup_clustered_i_add::<5, _>(value)
33+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434

3535
error: aborting due to 1 previous error
3636

tests/compiletests/ui/glam/invalid_vector_type.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// build-fail
2+
// normalize-stderr-test "\.rs:\d+:\d+" -> ".rs:"
3+
// normalize-stderr-test "(\n)\d* *([ -])([\|\+\-\=])" -> "$1 $2$3"
24

35
use core::num::NonZeroU32;
46
use spirv_std::glam::Vec2;

0 commit comments

Comments
 (0)