Auto merge of #127382 - estebank:const-let, r=compiler-errors · rust-lang/rust@4a31a6c (original) (raw)
`@@ -313,74 +313,90 @@ LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR);
`
313
313
`error[E0435]: attempt to use a non-constant value in a constant
`
314
314
` --> $DIR/parse-error.rs:39:37
`
315
315
` |
`
316
``
`-
LL | let mut foo = 0;
`
317
``
`` -
| ----------- help: consider using const
instead of let
: const foo
``
318
``
`-
...
`
319
316
`LL | asm!("{}", options(), const foo);
`
320
317
` | ^^^ non-constant value
`
``
318
`+
|
`
``
319
`` +
help: consider using const
instead of let
``
``
320
`+
|
`
``
321
`+
LL | const foo: /* Type */ = 0;
`
``
322
`+
| ~~~~~ ++++++++++++
`
321
323
``
322
324
`error[E0435]: attempt to use a non-constant value in a constant
`
323
325
` --> $DIR/parse-error.rs:47:44
`
324
326
` |
`
325
``
`-
LL | let mut foo = 0;
`
326
``
`` -
| ----------- help: consider using const
instead of let
: const foo
``
327
``
`-
...
`
328
327
`LL | asm!("{}", clobber_abi("C"), const foo);
`
329
328
` | ^^^ non-constant value
`
``
329
`+
|
`
``
330
`` +
help: consider using const
instead of let
``
``
331
`+
|
`
``
332
`+
LL | const foo: /* Type */ = 0;
`
``
333
`+
| ~~~~~ ++++++++++++
`
330
334
``
331
335
`error[E0435]: attempt to use a non-constant value in a constant
`
332
336
` --> $DIR/parse-error.rs:50:55
`
333
337
` |
`
334
``
`-
LL | let mut foo = 0;
`
335
``
`` -
| ----------- help: consider using const
instead of let
: const foo
``
336
``
`-
...
`
337
338
`LL | asm!("{}", options(), clobber_abi("C"), const foo);
`
338
339
` | ^^^ non-constant value
`
``
340
`+
|
`
``
341
`` +
help: consider using const
instead of let
``
``
342
`+
|
`
``
343
`+
LL | const foo: /* Type */ = 0;
`
``
344
`+
| ~~~~~ ++++++++++++
`
339
345
``
340
346
`error[E0435]: attempt to use a non-constant value in a constant
`
341
347
` --> $DIR/parse-error.rs:52:31
`
342
348
` |
`
343
``
`-
LL | let mut foo = 0;
`
344
``
`` -
| ----------- help: consider using const
instead of let
: const foo
``
345
``
`-
...
`
346
349
`LL | asm!("{a}", a = const foo, a = const bar);
`
347
350
` | ^^^ non-constant value
`
``
351
`+
|
`
``
352
`` +
help: consider using const
instead of let
``
``
353
`+
|
`
``
354
`+
LL | const foo: /* Type */ = 0;
`
``
355
`+
| ~~~~~ ++++++++++++
`
348
356
``
349
357
`error[E0435]: attempt to use a non-constant value in a constant
`
350
358
` --> $DIR/parse-error.rs:52:46
`
351
359
` |
`
352
``
`-
LL | let mut bar = 0;
`
353
``
`` -
| ----------- help: consider using const
instead of let
: const bar
``
354
``
`-
...
`
355
360
`LL | asm!("{a}", a = const foo, a = const bar);
`
356
361
` | ^^^ non-constant value
`
``
362
`+
|
`
``
363
`` +
help: consider using const
instead of let
``
``
364
`+
|
`
``
365
`+
LL | const bar: /* Type */ = 0;
`
``
366
`+
| ~~~~~ ++++++++++++
`
357
367
``
358
368
`error[E0435]: attempt to use a non-constant value in a constant
`
359
369
` --> $DIR/parse-error.rs:59:45
`
360
370
` |
`
361
``
`-
LL | let mut bar = 0;
`
362
``
`` -
| ----------- help: consider using const
instead of let
: const bar
``
363
``
`-
...
`
364
371
`LL | asm!("{a}", in("x0") foo, a = const bar);
`
365
372
` | ^^^ non-constant value
`
``
373
`+
|
`
``
374
`` +
help: consider using const
instead of let
``
``
375
`+
|
`
``
376
`+
LL | const bar: /* Type */ = 0;
`
``
377
`+
| ~~~~~ ++++++++++++
`
366
378
``
367
379
`error[E0435]: attempt to use a non-constant value in a constant
`
368
380
` --> $DIR/parse-error.rs:61:45
`
369
381
` |
`
370
``
`-
LL | let mut bar = 0;
`
371
``
`` -
| ----------- help: consider using const
instead of let
: const bar
``
372
``
`-
...
`
373
382
`LL | asm!("{a}", in("x0") foo, a = const bar);
`
374
383
` | ^^^ non-constant value
`
``
384
`+
|
`
``
385
`` +
help: consider using const
instead of let
``
``
386
`+
|
`
``
387
`+
LL | const bar: /* Type */ = 0;
`
``
388
`+
| ~~~~~ ++++++++++++
`
375
389
``
376
390
`error[E0435]: attempt to use a non-constant value in a constant
`
377
391
` --> $DIR/parse-error.rs:63:41
`
378
392
` |
`
379
``
`-
LL | let mut bar = 0;
`
380
``
`` -
| ----------- help: consider using const
instead of let
: const bar
``
381
``
`-
...
`
382
393
`LL | asm!("{1}", in("x0") foo, const bar);
`
383
394
` | ^^^ non-constant value
`
``
395
`+
|
`
``
396
`` +
help: consider using const
instead of let
``
``
397
`+
|
`
``
398
`+
LL | const bar: /* Type */ = 0;
`
``
399
`+
| ~~~~~ ++++++++++++
`
384
400
``
385
401
`error: aborting due to 57 previous errors
`
386
402
``