Fix: error: mismatched closing delimiter } [Rust]

fn main() {
    println!("Hello, world!";
}

If you try to do a cargo build for the above code, you will get a mismatched closing delimiter error.

Error:
% cargo build
   Compiling myproj1 v0.1.0 (/Users/c2ctechtv/Desktop/myproj1)
error: mismatched closing delimiter: `}`
 --> src/main.rs:2:13
  |
1 | fn main() {
  |           - closing delimiter possibly meant for this
2 |     println!("Hello, world!";
  |             ^ unclosed delimiter
3 | }
  | ^ mismatched closing delimiter

error: could not compile `myproj1` (bin "myproj1") due to previous error

You may wonder that the error says missing "curly brace }" but it is actually the closing brace ) at line 2.

Closing Braces missing

After adding it the build goes well!

% cargo build
   Compiling myproj1 v0.1.0 (/Users/c2ctech/Desktop/myproj1)
    Finished dev [unoptimized + debuginfo] target(s) in 0.66s

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!