Playgrounds rejects valid Rust (due to input processing?)
See original GitHub issueThis code is expected to work but generates a compiler error due to a comment: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=45b03c2e33ff3b6c20af40794c505c92
Compiling playground v0.0.1 (/playground)
error: this file contains an un-closed delimiter
--> src/main.rs:1:1854
|
1 | pub fn main() {
let reserved_names: [&str; 103] = [
"as",
"break",
"const",
(snip)
If rust-playground tries to put all the code on a single line, that’s likely the problem. Thanks for building and maintaining such a useful tool; much appreciated!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Why does code that requires user input not work in the Rust ...
The Playground does not currently accept user input via stdin. The stdin is effectively closed immediately, thus your program gets no input ...
Read more >rust/RELEASES.md at master · rust-lang/rust - GitHub
1: the bugs that are detected by newly added incremental verification are still present in past stable versions, and are not yet fixed...
Read more >Different ways to terminate and pause program in Rust
1. Using exit() function. std::process::exit(). This function returns nothing and terminates the program ...
Read more >Common Newbie Mistakes and Bad Practices in Rust
When you are coming to Rust from another language you bring all your previous experiences with you. Often this is awesome because it...
Read more >Watch out for NaNs - #98 by tczajka - The Rust Programming ...
As a minor related point, serde_json translates floating point values Infinity, -Infinity, and NaN to "None" on output. On input, though, "None" does...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ha, this shows the content is not the whole problem, and unfortunately pasting it in/from github “fixes it”, as I think the issue is in the EOL delimiters. Here’s a repro for me of that last one, but constructed from the initial link.
I think the playground doesn’t see the mac \r in the code as end of lines.
This fails with the same error and works for me locally: