// A compiler experiment for the ordering analysis: pairs of statements, some // with a call into a Rust crate. // // It has no `main` and is not run. A test reads it and checks that no pair with // a foreign call may run at the same time as its neighbour. The compiler knows // nothing about what a foreign call touches, so it must assume everything. The // first function is the control: two file reads, which may overlap. use std::fs fn control() throws { let a = fs::read_to_string("eins.txt", fs::Root::Anywhere) catch { "" } let b = fs::read_to_string("zwei.txt", fs::Root::Anywhere) catch { "" } println(f"{a.len()} {b.len()}") } fn foreign_against_foreign() { let first = hyper_shim::serve_once(18080) let second = hyper_shim::serve_once(18081) println(f"{first} {second}") } fn foreign_against_a_read() throws { let served = hyper_shim::serve_once(18082) let file = fs::read_to_string("eins.txt", fs::Root::Anywhere) catch { "" } println(f"{served} {file.len()}") } fn a_read_against_foreign() throws { let file = fs::read_to_string("zwei.txt", fs::Root::Anywhere) catch { "" } let served = hyper_shim::serve_once(18083) println(f"{file.len()} {served}") }