rust/compiler/rustc_builtin_macros/src
bors 03360be6b7 Auto merge of #92066 - Smittyvb:concat_bytes-repeat, r=nagisa
Support [x; n] expressions in concat_bytes!

Currently trying to use `concat_bytes!` with a repeating array value like `[42; 5]` results in an error:
```
error: expected a byte literal
 --> src/main.rs:3:27
  |
3 |     let x = concat_bytes!([3; 4]);
  |                           ^^^^^^
  |
  = note: only byte literals (like `b"foo"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()`
```

This makes it so repeating array syntax can be used the same way normal arrays can be. The RFC doesn't explicitly mention repeat expressions, but it seems reasonable to allow them as well, since normal arrays are allowed.

It is possible to make the compiler get stuck compiling forever with `concat_bytes!([3; 999999999])`, but I don't think that's much of an issue since you can do that already with `const X: [u8; 999999999] = [3; 999999999];`.

Contributes to #87555.
2022-01-02 12:38:41 +00:00
..
deriving Remove redundant [..]s 2021-12-09 00:01:29 +01:00
format_foreign update tests 2021-12-31 12:51:27 -05:00
asm.rs rustc_builtin_macros: make asm mod public for rustfmt 2021-12-21 11:52:40 -06:00
assert.rs Use correct edition for panic in [debug_]assert!() etc. 2021-10-07 14:27:08 +02:00
cfg_accessible.rs expand: Tell built-in macros whether we are currently in forced expansion mode 2020-11-19 19:25:20 +03:00
cfg_eval.rs Add a lint for duplicated attributes. 2021-12-15 23:43:13 +01:00
cfg.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
cmdline_attrs.rs Unconditionally capture tokens for attributes. 2020-10-21 18:57:29 -04:00
compile_error.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
concat_bytes.rs Clarify that repeat count must be positive 2021-12-27 12:31:40 -05:00
concat_idents.rs Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
concat.rs Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
derive.rs Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
env.rs Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
format_foreign.rs [rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape 2021-12-31 12:42:15 -05:00
format.rs Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
global_allocator.rs ast: Fix naming conventions in AST structures 2021-11-07 21:38:17 +08:00
lib.rs rustc_builtin_macros: make asm mod public for rustfmt 2021-12-21 11:52:40 -06:00
llvm_asm.rs Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkov 2020-12-30 20:56:58 +00:00
log_syntax.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
panic.rs Use correct edition for panic in [debug_]assert!() etc. 2021-10-07 14:27:08 +02:00
proc_macro_harness.rs Compute proc_macros in resolutions. 2021-09-01 20:13:16 +02:00
source_util.rs Compute a better lint_node_id during expansion 2021-07-17 23:03:56 -05:00
standard_library_imports.rs rustc_span: Ident::invalid -> Ident::empty 2021-10-17 23:20:30 +03:00
test_harness.rs expand: Turn ast::Crate into a first class expansion target 2021-11-28 15:48:55 +08:00
test.rs Add a lint for duplicated attributes. 2021-12-15 23:43:13 +01:00
trace_macros.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
util.rs Add a lint for duplicated attributes. 2021-12-15 23:43:13 +01:00