You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #119195 - asquared31415:named_asm_labels_fix, r=Amanieu
Make named_asm_labels lint not trigger on unicode and trigger on format args
Someone showed me some cursed code that used format args to create named labels, and rustc wasn't linting on that. Additionally while fixing that, I noticed that Unicode alphabetic characters were being used as part of labels, when they are not actually permitted in labels.
r? `@Amanieu`
Copy file name to clipboardExpand all lines: tests/ui/asm/named-asm-labels.stderr
+92-11Lines changed: 92 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -245,7 +245,88 @@ LL | ab: nop // ab: does foo
245
245
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
246
246
247
247
error: avoid using named labels in inline assembly
248
-
--> $DIR/named-asm-labels.rs:124:14
248
+
--> $DIR/named-asm-labels.rs:132:19
249
+
|
250
+
LL | asm!("test_{}: nop", in(reg) 10);
251
+
| ^^^^^^^
252
+
|
253
+
= help: only local labels of the form `<number>:` should be used in inline asm
254
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
255
+
256
+
error: avoid using named labels in inline assembly
257
+
--> $DIR/named-asm-labels.rs:134:15
258
+
|
259
+
LL | asm!("test_{}: nop", const 10);
260
+
| ^^^^^^^
261
+
|
262
+
= help: only local labels of the form `<number>:` should be used in inline asm
263
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
264
+
265
+
error: avoid using named labels in inline assembly
266
+
--> $DIR/named-asm-labels.rs:135:15
267
+
|
268
+
LL | asm!("test_{}: nop", sym main);
269
+
| ^^^^^^^
270
+
|
271
+
= help: only local labels of the form `<number>:` should be used in inline asm
272
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
273
+
274
+
error: avoid using named labels in inline assembly
275
+
--> $DIR/named-asm-labels.rs:136:15
276
+
|
277
+
LL | asm!("{}_test: nop", const 10);
278
+
| ^^^^^^^
279
+
|
280
+
= help: only local labels of the form `<number>:` should be used in inline asm
281
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
282
+
283
+
error: avoid using named labels in inline assembly
284
+
--> $DIR/named-asm-labels.rs:137:15
285
+
|
286
+
LL | asm!("test_{}_test: nop", const 10);
287
+
| ^^^^^^^^^^^^
288
+
|
289
+
= help: only local labels of the form `<number>:` should be used in inline asm
290
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
291
+
292
+
error: avoid using named labels in inline assembly
293
+
--> $DIR/named-asm-labels.rs:138:15
294
+
|
295
+
LL | asm!("{}: nop", const 10);
296
+
| ^^
297
+
|
298
+
= help: only local labels of the form `<number>:` should be used in inline asm
299
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
300
+
301
+
error: avoid using named labels in inline assembly
302
+
--> $DIR/named-asm-labels.rs:140:15
303
+
|
304
+
LL | asm!("{uwu}: nop", uwu = const 10);
305
+
| ^^^^^
306
+
|
307
+
= help: only local labels of the form `<number>:` should be used in inline asm
308
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
309
+
310
+
error: avoid using named labels in inline assembly
311
+
--> $DIR/named-asm-labels.rs:141:15
312
+
|
313
+
LL | asm!("{0}: nop", const 10);
314
+
| ^^^
315
+
|
316
+
= help: only local labels of the form `<number>:` should be used in inline asm
317
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
318
+
319
+
error: avoid using named labels in inline assembly
= help: only local labels of the form `<number>:` should be used in inline asm
326
+
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
327
+
328
+
error: avoid using named labels in inline assembly
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
255
336
256
337
warning: avoid using named labels in inline assembly
257
-
--> $DIR/named-asm-labels.rs:134:19
338
+
--> $DIR/named-asm-labels.rs:155:19
258
339
|
259
340
LL | asm!("warned: nop");
260
341
| ^^^^^^
261
342
|
262
343
= help: only local labels of the form `<number>:` should be used in inline asm
263
344
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
264
345
note: the lint level is defined here
265
-
--> $DIR/named-asm-labels.rs:132:16
346
+
--> $DIR/named-asm-labels.rs:153:16
266
347
|
267
348
LL | #[warn(named_asm_labels)]
268
349
| ^^^^^^^^^^^^^^^^
269
350
270
351
error: avoid using named labels in inline assembly
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
278
359
279
360
error: avoid using named labels in inline assembly
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
287
368
288
369
error: avoid using named labels in inline assembly
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
296
377
297
378
error: avoid using named labels in inline assembly
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
305
386
306
387
error: avoid using named labels in inline assembly
307
-
--> $DIR/named-asm-labels.rs:176:15
388
+
--> $DIR/named-asm-labels.rs:197:15
308
389
|
309
390
LL | asm!("closure1: nop");
310
391
| ^^^^^^^^
@@ -313,7 +394,7 @@ LL | asm!("closure1: nop");
313
394
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
314
395
315
396
error: avoid using named labels in inline assembly
316
-
--> $DIR/named-asm-labels.rs:180:15
397
+
--> $DIR/named-asm-labels.rs:201:15
317
398
|
318
399
LL | asm!("closure2: nop");
319
400
| ^^^^^^^^
@@ -322,13 +403,13 @@ LL | asm!("closure2: nop");
322
403
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
323
404
324
405
error: avoid using named labels in inline assembly
325
-
--> $DIR/named-asm-labels.rs:190:19
406
+
--> $DIR/named-asm-labels.rs:211:19
326
407
|
327
408
LL | asm!("closure3: nop");
328
409
| ^^^^^^^^
329
410
|
330
411
= help: only local labels of the form `<number>:` should be used in inline asm
331
412
= note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information
332
413
333
-
error: aborting due to 35 previous errors; 1 warning emitted
414
+
error: aborting due to 44 previous errors; 1 warning emitted
0 commit comments