pub fn detect_version() -> Result<RustVersion, VersionDetectionError>
Expand description
Detect the current version by executing rustc
.
This should only be called at build time (usually a build script),
since the rust compiler is likely unavailable at runtime.
It will execute whatever command is present in the RUSTC
environment variable,
so should not be run in an untrusted environment.
Once the version is successfully detected, it will be cached for future runs.
ยงErrors
Returns an error if unable to execute the result compiler or unable to parse the result.