<p dir="auto">I want to be able to recompile only dependencies (rather than everything in a crate), like SML's compilation manager or GHC's <code class="notranslate">--make</code> mode. I don't really care about the approach so long as it works and the outcome is that adding one <code class="notranslate">#debug</code> call in one file doesn't trigger recompilation of 100 other files in the same crate :-) I am volunteering to work on this after 0.3, but suggestions are welcome. Patrick suggested a good place to start would be to generate a (visualizable) graph of item dependencies, which makes sense to me.</p>
<p dir="auto">rustc 1.0.0-nightly (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/2b01a37ec38db9301239f0c0abcf3c695055b0ff/hovercard" href="https://github.com/rust-lang/rust/commit/2b01a37ec38db9301239f0c0abcf3c695055b0ff"><tt>2b01a37</tt></a> 2015-02-21) (built 2015-02-22)</p>
<p dir="auto">I try to compile file:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="use std::sync::{Arc, Mutex};

fn main() {
}

fn compile_ok() -&gt; Result&lt;(), ()&gt; {
    let hash_lock = Arc::new(Mutex::new(&quot;test&quot;.to_string()));
    let result = match hash_lock.lock() {
        Ok(_) =&gt; Ok(()),
        Err(_) =&gt; Ok(())
    };
    result
}

fn compile_fail() -&gt; Result&lt;(), ()&gt; {
    let hash_lock = Arc::new(Mutex::new(&quot;test&quot;.to_string()));
    match hash_lock.lock() {
        Ok(_) =&gt; Ok(()),
        Err(_) =&gt; Ok(())
    }
}"><pre class="notranslate"><code class="notranslate">use std::sync::{Arc, Mutex};

fn main() {
}

fn compile_ok() -&gt; Result&lt;(), ()&gt; {
    let hash_lock = Arc::new(Mutex::new("test".to_string()));
    let result = match hash_lock.lock() {
        Ok(_) =&gt; Ok(()),
        Err(_) =&gt; Ok(())
    };
    result
}

fn compile_fail() -&gt; Result&lt;(), ()&gt; {
    let hash_lock = Arc::new(Mutex::new("test".to_string()));
    match hash_lock.lock() {
        Ok(_) =&gt; Ok(()),
        Err(_) =&gt; Ok(())
    }
}
</code></pre></div>
<p dir="auto">And get error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sample.rs:17:8: 17:17 error: `hash_lock` does not live long enough
sample.rs:17    match hash_lock.lock() {
                      ^~~~~~~~~
sample.rs:15:37: 21:2 note: reference must be valid for the destruction scope surrounding block at 15:36...
sample.rs:15 fn compile_fail() -&gt; Result&lt;(), ()&gt; {
sample.rs:16    let hash_lock = Arc::new(Mutex::new(&quot;test&quot;.to_string()));
sample.rs:17    match hash_lock.lock() {
sample.rs:18        Ok(_) =&gt; Ok(()),
sample.rs:19        Err(_) =&gt; Ok(())
sample.rs:20    }
             ...
sample.rs:16:58: 21:2 note: ...but borrowed value is only valid for the block suffix following statement 0 at 16:57
sample.rs:16    let hash_lock = Arc::new(Mutex::new(&quot;test&quot;.to_string()));
sample.rs:17    match hash_lock.lock() {
sample.rs:18        Ok(_) =&gt; Ok(()),
sample.rs:19        Err(_) =&gt; Ok(())
sample.rs:20    }
sample.rs:21 }
error: aborting due to previous error"><pre class="notranslate"><code class="notranslate">sample.rs:17:8: 17:17 error: `hash_lock` does not live long enough
sample.rs:17    match hash_lock.lock() {
                      ^~~~~~~~~
sample.rs:15:37: 21:2 note: reference must be valid for the destruction scope surrounding block at 15:36...
sample.rs:15 fn compile_fail() -&gt; Result&lt;(), ()&gt; {
sample.rs:16    let hash_lock = Arc::new(Mutex::new("test".to_string()));
sample.rs:17    match hash_lock.lock() {
sample.rs:18        Ok(_) =&gt; Ok(()),
sample.rs:19        Err(_) =&gt; Ok(())
sample.rs:20    }
             ...
sample.rs:16:58: 21:2 note: ...but borrowed value is only valid for the block suffix following statement 0 at 16:57
sample.rs:16    let hash_lock = Arc::new(Mutex::new("test".to_string()));
sample.rs:17    match hash_lock.lock() {
sample.rs:18        Ok(_) =&gt; Ok(()),
sample.rs:19        Err(_) =&gt; Ok(())
sample.rs:20    }
sample.rs:21 }
error: aborting due to previous error
</code></pre></div>