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:
- What is Terminal Velocity and its Formula? How to calculate it programmatically? - Python
- How to uninstall Rust Language from Mac/Linux/Ubuntu - Rust
- [Fix] Notepad Error: Windows cannot access the specified Device or Path - Windows-11
- Android : java.lang.IllegalArgumentException File contains a path separator - Android
- MongoDB Hello World! Example - 2022
- Fix: Unsupported Java. Your build is currently configured to use Java 17.0.5 and Gradle 7.1. - Gradle
- AADSTS90033: A transient error has occurred. Please try again. [Microsoft 365] - Microsoft
- How to reset Mac Password using Terminal - MacOS