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.
% 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.
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
Facing issues? Have Questions? Post them here! I am happy to answer!
Author Info:
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
More Posts related to Rust,
- Rust: Cargo Init vs Cargo New Command
- Rust: Write and Run Hello World! Program Example
- How to Split a String using Rust Language
- How to Sort a Vector in Rust with Examples
- Fix: error: could not find `Cargo.toml` in Users or any parent directory
- How to uninstall Rust Language from Mac/Linux/Ubuntu
- How to update Cargo (Rust Lang)
- Fix: rust-analyzer failed to discover workspace [Visual Studio Code]
- How to install Rust using rustup on macOS/Linux/Ubuntu
- Cargo Watch: To Recompile Rust Project Automatically
- Difference between rustc and cargo build commands
- How to Split a String by Space in Rust
- How to know Rust is Installed on Mac?
- Rust: zsh: no such file or directory: ./main
- How to update Rust on Mac/Linux
- List of Rust Cargo Commands
- How to find version of Cargo in Rust
- Fix: error: mismatched closing delimiter } [Rust]
More Posts:
- How to remove or uninstall Java from Ubuntu using apt-get - Linux
- Word count in Notepad++ - NotepadPlusPlus
- Add Custom header and footer to Windows Notepad file - NotepadPlusPlus
- What is the Null Object Equivalent in Python? - Python
- Ping IP/Server Address using Python Example - Python
- How to know current Ubuntu Linux version via terminal command - Ubuntu
- Fix: TextEdit Open Html as Plain Text Code - MacOS
- How to update VIM version on a Mac - vi