Add raw address of expressions to the AST and HIR
This commit is contained in:
parent
9420ff4c0e
commit
a8efd31f2b
22 changed files with 308 additions and 139 deletions
|
|
@ -409,6 +409,7 @@ E0741: include_str!("./error_codes/E0741.md"),
|
|||
E0742: include_str!("./error_codes/E0742.md"),
|
||||
E0743: include_str!("./error_codes/E0743.md"),
|
||||
E0744: include_str!("./error_codes/E0744.md"),
|
||||
E0745: include_str!("./error_codes/E0745.md"),
|
||||
;
|
||||
// E0006, // merged with E0005
|
||||
// E0008, // cannot bind by-move into a pattern guard
|
||||
|
|
|
|||
20
src/librustc_error_codes/error_codes/E0745.md
Normal file
20
src/librustc_error_codes/error_codes/E0745.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Cannot take address of temporary value.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0745
|
||||
# #![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.
|
||||
|
||||
```ignore
|
||||
# #![feature(raw_ref_op)]
|
||||
fn temp_address() {
|
||||
let val = 2;
|
||||
let ptr = &raw const val;
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue