]> git.lizzy.rs Git - rust.git/blobdiff - src/config.rs
Rustup to rustc 1.54.0-nightly (881c1ac40 2021-05-08)
[rust.git] / src / config.rs
index 0cf02e2bbb565ccbd59a880ebe471d102b31030d..e59a0cb0a23237bfe0b4fd0164909db4d8a98e49 100644 (file)
@@ -5,10 +5,14 @@ fn bool_env_var(key: &str) -> bool {
     env::var(key).as_ref().map(|val| &**val) == Ok("1")
 }
 
+/// The mode to use for compilation.
 #[derive(Copy, Clone, Debug)]
 pub enum CodegenMode {
+    /// AOT compile the crate. This is the default.
     Aot,
+    /// JIT compile and execute the crate.
     Jit,
+    /// JIT compile and execute the crate, but only compile functions the first time they are used.
     JitLazy,
 }
 
@@ -25,6 +29,7 @@ fn from_str(s: &str) -> Result<Self, Self::Err> {
     }
 }
 
+/// Configuration of cg_clif as passed in through `-Cllvm-args` and various env vars.
 #[derive(Clone, Debug)]
 pub struct BackendConfig {
     /// Should the crate be AOT compiled or JIT executed.
@@ -76,6 +81,7 @@ fn default() -> Self {
 }
 
 impl BackendConfig {
+    /// Parse the configuration passed in using `-Cllvm-args`.
     pub fn from_opts(opts: &[String]) -> Result<Self, String> {
         fn parse_bool(name: &str, value: &str) -> Result<bool, String> {
             value.parse().map_err(|_| format!("failed to parse value `{}` for {}", value, name))