Skip to main content

target_check

Function target_check 

Source
fn target_check(
    compare: &Compare<'_>,
    f: &ExprForLoop,
    pattern: &[(Ident, bool)],
    prefix: &[Node],
    rest: &[Stmt],
    scope: &LoopScope,
    config: &Config,
) -> Result<Option<TokenStream>, String>
Expand description

The runtime check that the items of a prefetched loop name different files.

Prefetching runs the prefix of later items before the rest of earlier ones, which is safe when each item touches its own files. When the files depend on the item (fs::write(dir.join(name))), the generated code first evaluates every such path for every item and runs the loop as written when two items share one and either writes it. Ok(None): nothing to check; Err(why): a path cannot be evaluated ahead, so distinct items are assumed, as before.