Skip to content

Commit bdb5590

Browse files
authored
Rollup merge of #136190 - taiki-e:dedup, r=compiler-errors
Remove duplicated code in RISC-V asm bad-reg test I added this test in #132516, but I accidentally repeated the same check twice. https://github.com/rust-lang/rust/blob/aa6f5ab18e67cb815f73e0d53d217bc54b0da924/tests/ui/asm/riscv/bad-reg.rs#L39-L42
2 parents da7980b + cfb8be5 commit bdb5590

7 files changed

+90
-128
lines changed

tests/ui/asm/riscv/bad-reg.riscv32e.stderr

+30-36
Original file line numberDiff line numberDiff line change
@@ -22,191 +22,185 @@ error: invalid register `gp`: the global pointer cannot be used as an operand fo
2222
LL | asm!("", out("gp") _);
2323
| ^^^^^^^^^^^
2424

25-
error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm
26-
--> $DIR/bad-reg.rs:41:18
27-
|
28-
LL | asm!("", out("gp") _);
29-
| ^^^^^^^^^^^
30-
3125
error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm
32-
--> $DIR/bad-reg.rs:43:18
26+
--> $DIR/bad-reg.rs:41:18
3327
|
3428
LL | asm!("", out("tp") _);
3529
| ^^^^^^^^^^^
3630

3731
error: invalid register `zero`: the zero register cannot be used as an operand for inline asm
38-
--> $DIR/bad-reg.rs:45:18
32+
--> $DIR/bad-reg.rs:43:18
3933
|
4034
LL | asm!("", out("zero") _);
4135
| ^^^^^^^^^^^^^
4236

4337
error: register class `vreg` can only be used as a clobber, not as an input or output
44-
--> $DIR/bad-reg.rs:96:18
38+
--> $DIR/bad-reg.rs:94:18
4539
|
4640
LL | asm!("", in("v0") x);
4741
| ^^^^^^^^^^
4842

4943
error: register class `vreg` can only be used as a clobber, not as an input or output
50-
--> $DIR/bad-reg.rs:99:18
44+
--> $DIR/bad-reg.rs:97:18
5145
|
5246
LL | asm!("", out("v0") x);
5347
| ^^^^^^^^^^^
5448

5549
error: register class `vreg` can only be used as a clobber, not as an input or output
56-
--> $DIR/bad-reg.rs:102:26
50+
--> $DIR/bad-reg.rs:100:26
5751
|
5852
LL | asm!("/* {} */", in(vreg) x);
5953
| ^^^^^^^^^^
6054

6155
error: register class `vreg` can only be used as a clobber, not as an input or output
62-
--> $DIR/bad-reg.rs:105:26
56+
--> $DIR/bad-reg.rs:103:26
6357
|
6458
LL | asm!("/* {} */", out(vreg) _);
6559
| ^^^^^^^^^^^
6660

6761
error: cannot use register `x16`: register can't be used with the `e` target feature
68-
--> $DIR/bad-reg.rs:48:18
62+
--> $DIR/bad-reg.rs:46:18
6963
|
7064
LL | asm!("", out("x16") _);
7165
| ^^^^^^^^^^^^
7266

7367
error: cannot use register `x17`: register can't be used with the `e` target feature
74-
--> $DIR/bad-reg.rs:50:18
68+
--> $DIR/bad-reg.rs:48:18
7569
|
7670
LL | asm!("", out("x17") _);
7771
| ^^^^^^^^^^^^
7872

7973
error: cannot use register `x18`: register can't be used with the `e` target feature
80-
--> $DIR/bad-reg.rs:52:18
74+
--> $DIR/bad-reg.rs:50:18
8175
|
8276
LL | asm!("", out("x18") _);
8377
| ^^^^^^^^^^^^
8478

8579
error: cannot use register `x19`: register can't be used with the `e` target feature
86-
--> $DIR/bad-reg.rs:54:18
80+
--> $DIR/bad-reg.rs:52:18
8781
|
8882
LL | asm!("", out("x19") _);
8983
| ^^^^^^^^^^^^
9084

9185
error: cannot use register `x20`: register can't be used with the `e` target feature
92-
--> $DIR/bad-reg.rs:56:18
86+
--> $DIR/bad-reg.rs:54:18
9387
|
9488
LL | asm!("", out("x20") _);
9589
| ^^^^^^^^^^^^
9690

9791
error: cannot use register `x21`: register can't be used with the `e` target feature
98-
--> $DIR/bad-reg.rs:58:18
92+
--> $DIR/bad-reg.rs:56:18
9993
|
10094
LL | asm!("", out("x21") _);
10195
| ^^^^^^^^^^^^
10296

10397
error: cannot use register `x22`: register can't be used with the `e` target feature
104-
--> $DIR/bad-reg.rs:60:18
98+
--> $DIR/bad-reg.rs:58:18
10599
|
106100
LL | asm!("", out("x22") _);
107101
| ^^^^^^^^^^^^
108102

109103
error: cannot use register `x23`: register can't be used with the `e` target feature
110-
--> $DIR/bad-reg.rs:62:18
104+
--> $DIR/bad-reg.rs:60:18
111105
|
112106
LL | asm!("", out("x23") _);
113107
| ^^^^^^^^^^^^
114108

115109
error: cannot use register `x24`: register can't be used with the `e` target feature
116-
--> $DIR/bad-reg.rs:64:18
110+
--> $DIR/bad-reg.rs:62:18
117111
|
118112
LL | asm!("", out("x24") _);
119113
| ^^^^^^^^^^^^
120114

121115
error: cannot use register `x25`: register can't be used with the `e` target feature
122-
--> $DIR/bad-reg.rs:66:18
116+
--> $DIR/bad-reg.rs:64:18
123117
|
124118
LL | asm!("", out("x25") _);
125119
| ^^^^^^^^^^^^
126120

127121
error: cannot use register `x26`: register can't be used with the `e` target feature
128-
--> $DIR/bad-reg.rs:68:18
122+
--> $DIR/bad-reg.rs:66:18
129123
|
130124
LL | asm!("", out("x26") _);
131125
| ^^^^^^^^^^^^
132126

133127
error: cannot use register `x27`: register can't be used with the `e` target feature
134-
--> $DIR/bad-reg.rs:70:18
128+
--> $DIR/bad-reg.rs:68:18
135129
|
136130
LL | asm!("", out("x27") _);
137131
| ^^^^^^^^^^^^
138132

139133
error: cannot use register `x28`: register can't be used with the `e` target feature
140-
--> $DIR/bad-reg.rs:72:18
134+
--> $DIR/bad-reg.rs:70:18
141135
|
142136
LL | asm!("", out("x28") _);
143137
| ^^^^^^^^^^^^
144138

145139
error: cannot use register `x29`: register can't be used with the `e` target feature
146-
--> $DIR/bad-reg.rs:74:18
140+
--> $DIR/bad-reg.rs:72:18
147141
|
148142
LL | asm!("", out("x29") _);
149143
| ^^^^^^^^^^^^
150144

151145
error: cannot use register `x30`: register can't be used with the `e` target feature
152-
--> $DIR/bad-reg.rs:76:18
146+
--> $DIR/bad-reg.rs:74:18
153147
|
154148
LL | asm!("", out("x30") _);
155149
| ^^^^^^^^^^^^
156150

157151
error: cannot use register `x31`: register can't be used with the `e` target feature
158-
--> $DIR/bad-reg.rs:78:18
152+
--> $DIR/bad-reg.rs:76:18
159153
|
160154
LL | asm!("", out("x31") _);
161155
| ^^^^^^^^^^^^
162156

163157
error: register class `freg` requires at least one of the following target features: d, f
164-
--> $DIR/bad-reg.rs:82:26
158+
--> $DIR/bad-reg.rs:80:26
165159
|
166160
LL | asm!("/* {} */", in(freg) f);
167161
| ^^^^^^^^^^
168162

169163
error: register class `freg` requires at least one of the following target features: d, f
170-
--> $DIR/bad-reg.rs:84:26
164+
--> $DIR/bad-reg.rs:82:26
171165
|
172166
LL | asm!("/* {} */", out(freg) _);
173167
| ^^^^^^^^^^^
174168

175169
error: register class `freg` requires at least one of the following target features: d, f
176-
--> $DIR/bad-reg.rs:86:26
170+
--> $DIR/bad-reg.rs:84:26
177171
|
178172
LL | asm!("/* {} */", in(freg) d);
179173
| ^^^^^^^^^^
180174

181175
error: register class `freg` requires at least one of the following target features: d, f
182-
--> $DIR/bad-reg.rs:89:26
176+
--> $DIR/bad-reg.rs:87:26
183177
|
184178
LL | asm!("/* {} */", out(freg) d);
185179
| ^^^^^^^^^^^
186180

187181
error: type `i32` cannot be used with this register class
188-
--> $DIR/bad-reg.rs:96:27
182+
--> $DIR/bad-reg.rs:94:27
189183
|
190184
LL | asm!("", in("v0") x);
191185
| ^
192186
|
193187
= note: register class `vreg` supports these types:
194188

195189
error: type `i32` cannot be used with this register class
196-
--> $DIR/bad-reg.rs:99:28
190+
--> $DIR/bad-reg.rs:97:28
197191
|
198192
LL | asm!("", out("v0") x);
199193
| ^
200194
|
201195
= note: register class `vreg` supports these types:
202196

203197
error: type `i32` cannot be used with this register class
204-
--> $DIR/bad-reg.rs:102:35
198+
--> $DIR/bad-reg.rs:100:35
205199
|
206200
LL | asm!("/* {} */", in(vreg) x);
207201
| ^
208202
|
209203
= note: register class `vreg` supports these types:
210204

211-
error: aborting due to 34 previous errors
205+
error: aborting due to 33 previous errors
212206

tests/ui/asm/riscv/bad-reg.riscv32gc.stderr

+10-16
Original file line numberDiff line numberDiff line change
@@ -22,71 +22,65 @@ error: invalid register `gp`: the global pointer cannot be used as an operand fo
2222
LL | asm!("", out("gp") _);
2323
| ^^^^^^^^^^^
2424

25-
error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm
26-
--> $DIR/bad-reg.rs:41:18
27-
|
28-
LL | asm!("", out("gp") _);
29-
| ^^^^^^^^^^^
30-
3125
error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm
32-
--> $DIR/bad-reg.rs:43:18
26+
--> $DIR/bad-reg.rs:41:18
3327
|
3428
LL | asm!("", out("tp") _);
3529
| ^^^^^^^^^^^
3630

3731
error: invalid register `zero`: the zero register cannot be used as an operand for inline asm
38-
--> $DIR/bad-reg.rs:45:18
32+
--> $DIR/bad-reg.rs:43:18
3933
|
4034
LL | asm!("", out("zero") _);
4135
| ^^^^^^^^^^^^^
4236

4337
error: register class `vreg` can only be used as a clobber, not as an input or output
44-
--> $DIR/bad-reg.rs:96:18
38+
--> $DIR/bad-reg.rs:94:18
4539
|
4640
LL | asm!("", in("v0") x);
4741
| ^^^^^^^^^^
4842

4943
error: register class `vreg` can only be used as a clobber, not as an input or output
50-
--> $DIR/bad-reg.rs:99:18
44+
--> $DIR/bad-reg.rs:97:18
5145
|
5246
LL | asm!("", out("v0") x);
5347
| ^^^^^^^^^^^
5448

5549
error: register class `vreg` can only be used as a clobber, not as an input or output
56-
--> $DIR/bad-reg.rs:102:26
50+
--> $DIR/bad-reg.rs:100:26
5751
|
5852
LL | asm!("/* {} */", in(vreg) x);
5953
| ^^^^^^^^^^
6054

6155
error: register class `vreg` can only be used as a clobber, not as an input or output
62-
--> $DIR/bad-reg.rs:105:26
56+
--> $DIR/bad-reg.rs:103:26
6357
|
6458
LL | asm!("/* {} */", out(vreg) _);
6559
| ^^^^^^^^^^^
6660

6761
error: type `i32` cannot be used with this register class
68-
--> $DIR/bad-reg.rs:96:27
62+
--> $DIR/bad-reg.rs:94:27
6963
|
7064
LL | asm!("", in("v0") x);
7165
| ^
7266
|
7367
= note: register class `vreg` supports these types:
7468

7569
error: type `i32` cannot be used with this register class
76-
--> $DIR/bad-reg.rs:99:28
70+
--> $DIR/bad-reg.rs:97:28
7771
|
7872
LL | asm!("", out("v0") x);
7973
| ^
8074
|
8175
= note: register class `vreg` supports these types:
8276

8377
error: type `i32` cannot be used with this register class
84-
--> $DIR/bad-reg.rs:102:35
78+
--> $DIR/bad-reg.rs:100:35
8579
|
8680
LL | asm!("/* {} */", in(vreg) x);
8781
| ^
8882
|
8983
= note: register class `vreg` supports these types:
9084

91-
error: aborting due to 14 previous errors
85+
error: aborting due to 13 previous errors
9286

0 commit comments

Comments
 (0)