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 do a Print Screen on Windows 11 to Screencapture - Windows
- Where is Maven .m2 local repository located on Mac - HowTos
- Java: Convert String to InputStream - Java
- JSON Nest Objects Example: JSON Tutorial - Json-Tutorial
- How to clear Microsoft Teams Cache on Mac (macOS) - Teams
- Python: How to create a Dictionary of Lists with Examples - Python
- Android Shared Preferences API tutorial - Android
- How to Export a PowerShell Script/Cmdlet Output to a Text File - Powershell