-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support [x; n] expressions in concat_bytes! #92066
Conversation
Contributes to rust-lang#87555.
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This seems reasonable to me. |
@bors r+ |
📌 Commit 9702348 has been approved by |
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 rust-lang#87555.
FYI @rust-lang/libs-api. ( |
⌛ Testing commit 9702348 with merge c983898ec8192d2621921099e1f0283925a892d1... |
💔 Test failed - checks-actions |
It looks like there was a spurious network error in CI:
|
@bors retry |
⌛ Testing commit 9702348 with merge 682dbb7278cbf1cf1f4b2ea2f2f9468ae84487d8... |
💔 Test failed - checks-actions |
lots of logs are missing :/ |
⌛ Testing commit 9702348 with merge 1d05c70e47d55341dc2bdd4cecf5de6c42d5ba55... |
💔 Test failed - checks-actions |
The job Click to see the possible cause of the failure (guessed by this bot)
|
☀️ Test successful - checks-actions |
Finished benchmarking commit (03360be): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Currently trying to use
concat_bytes!
with a repeating array value like[42; 5]
results in an error: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 withconst X: [u8; 999999999] = [3; 999999999];
.Contributes to #87555.