Issue #1221: A detached task that opens a scope leaks the rustc warning “unused import: ProbePlain” into the program’s output

Open and answer this issue on GitHub.

ready · opened 2026-11-04 · updated 2026-11-04 · 0 comments

Found by the async a3 brief (group runtime, 6331c7ab).

Probe

use std::task

fn main() throws {
    let h = async(detached) fn {
        task::scope fn(s) { s.spawn fn { 1 }; 2 }
    }
    print(h.join())
}

The program prints 2, but the build first prints rustc’s warning unused import: ProbePlain. The generated code imports the probe trait for the scope, and the detached task’s body never uses it. A user’s program should never show a warning about code they did not write.

To build

  1. Emit the ProbePlain import only where the lowered code uses it, or mark the generated import #[allow(unused_imports)] the way the other generated imports are.
  2. Add a test with the probe whose .stderr is empty and whose .stdout is 2.

Back to Open Issues