Content-Length: 24370 | pFad | https://doc.rust-lang.org/std/string/../error/../string/../../std/../error_codes/./E0121.html

E0121 - Error codes index

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0121

The type placeholder _ was used within a type on an item’s signature.

Erroneous code example:

#![allow(unused)]
fn main() {
fn foo() -> _ { 5 } // error

static BAR: _ = "test"; // error
}

In those cases, you need to provide the type explicitly:

#![allow(unused)]
fn main() {
fn foo() -> i32 { 5 } // ok!

static BAR: &str = "test"; // ok!
}

The type placeholder _ can be used outside item’s signature as follows:

#![allow(unused)]
fn main() {
let x = "a4a".split('4')
    .collect::<Vec<_>>(); // No need to precise the Vec's generic type.
}








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://doc.rust-lang.org/std/string/../error/../string/../../std/../error_codes/./E0121.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy