Content-Length: 24129 | pFad | https://doc.rust-lang.org/std/string/../error/../string/../vec/../../../../error_codes/./E0745.html

E0745 - 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 E0745

The address of temporary value was taken.

Erroneous code example:

#![allow(unused)]
fn main() {
fn temp_address() {
    let ptr = &raw const 2; // error!
}
}

In this example, 2 is destroyed right after the assignment, which means that ptr now points to an unavailable location.

To avoid this error, first bind the temporary to a named local variable:

#![allow(unused)]
fn main() {
fn temp_address() {
    let val = 2;
    let ptr = &raw const val; // ok!
}
}








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/../vec/../../../../error_codes/./E0745.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy