Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 356 Bytes

File metadata and controls

20 lines (16 loc) · 356 Bytes

Cannot take address of temporary value.

Erroneous code example:

# #![feature(raw_ref_op)]
fn temp_address() {
    let ptr = &raw const 2;   // ERROR
}

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

# #![feature(raw_ref_op)]
fn temp_address() {
    let val = 2;
    let ptr = &raw const val;
}