diff options
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0745.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0745.md b/src/librustc_error_codes/error_codes/E0745.md new file mode 100644 index 00000000000..7c478a1e0c8 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0745.md @@ -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; +} +``` |
