Nordlöw
Nordlöw

Reputation: 12138

Does Rust have a way to perform syntax and semantic analysis without generating code?

Compilers such as gcc, clang and gccgo all have the switch -fsyntax-only used in single-buffer syntax checkers such as Flycheck. These only perform syntactic and, I assume, semantic analysis, thereby skipping code generation. Does Rust have something similar?

Upvotes: 2

Views: 331

Answers (1)

Matthieu M.
Matthieu M.

Reputation: 300149

The cargo check command instructs cargo to do just that.

It will check the syntax, types and borrows without generating any code.

Upvotes: 6

Related Questions