What is the correct term for _ in a type hint?

Viewed 1689

In type hints in Rust it is possible to use partial types in annotations like this:

let myvec: Vec<_> = vec![1, 2, 3];

What is the correct terminology for the underscore in the partial type annotation? I'm interested in both the Rust terminology as well as more academic type theory terminology.

4 Answers

Seems like the grammar refers to it as an "inferred type". Per the documentation:

Inferred type

Syntax:

InferredType : _

The inferred type asks the compiler to infer the type if possible based on the surrounding information available. It cannot be used in item signatures. It is often used in generic arguments:

let x: Vec<_> = (0..10).collect();
Related