A compiler directive is an annotation that we add to the code that tells the compiler how to parse the code. The word directive means an instruction or a command. So a compiler directive is an instruction to the compiler.
It’s metadata that we add that customizes how the compiler thinks and operates. We can apply these directives to individual lines, to functions, or even to entire Rust files. And there’s many different directives available.