DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B0707: a pipeline that does not end in a consumer

Catalog status: active. Default severity: error. Stable name: pipeline-without-consumer. Family: Syntax and source text.

A pipeline's stages (filter, map) describe elements one at a time; it is the consumer at the end (sum(), count(), all(x => p), any(x => p), reduce(r, i), collect()) that makes a value of them. A pipeline is not a value itself (see pipelines): it cannot be stored or passed on unfinished, so that it is always one loop, proved where it stands.

Example (Varc)

fn main() {
    let scores: [1..=3]Integer = [70, 45, 90];
    let passing = scores.filter(s => s >= 50);
}

What to do

End the pipeline in the consumer you meant: scores.filter(s => s >= 50).count(), or .collect() to keep the elements as an array or container.

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See syntax and source text, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.