-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
99 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,60 @@ | ||
error[E0764]: mutable references are not allowed in the final value of constants | ||
--> $DIR/mut_ref_in_final.rs:10:21 | ||
--> $DIR/mut_ref_in_final.rs:13:21 | ||
| | ||
LL | const B: *mut i32 = &mut 4; | ||
| ^^^^^^ | ||
|
||
error: aborting due to previous error | ||
error[E0716]: temporary value dropped while borrowed | ||
--> $DIR/mut_ref_in_final.rs:19:40 | ||
| | ||
LL | const B3: Option<&mut i32> = Some(&mut 42); | ||
| ----------^^- | ||
| | | | | ||
| | | temporary value is freed at the end of this statement | ||
| | creates a temporary which is freed while still in use | ||
| using this value as a constant requires that borrow lasts for `'static` | ||
|
||
error[E0716]: temporary value dropped while borrowed | ||
--> $DIR/mut_ref_in_final.rs:32:43 | ||
| | ||
LL | const B5: Option<&mut i32> = helper2(&mut 42); | ||
| -------------^^- | ||
| | | | | ||
| | | temporary value is freed at the end of this statement | ||
| | creates a temporary which is freed while still in use | ||
| using this value as a constant requires that borrow lasts for `'static` | ||
|
||
error[E0716]: temporary value dropped while borrowed | ||
--> $DIR/mut_ref_in_final.rs:47:65 | ||
| | ||
LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | ||
| -------------------------------^^-- | ||
| | | | | ||
| | | temporary value is freed at the end of this statement | ||
| | creates a temporary which is freed while still in use | ||
| using this value as a constant requires that borrow lasts for `'static` | ||
|
||
error[E0716]: temporary value dropped while borrowed | ||
--> $DIR/mut_ref_in_final.rs:50:67 | ||
| | ||
LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | ||
| -------------------------------^^-- | ||
| | | | | ||
| | | temporary value is freed at the end of this statement | ||
| | creates a temporary which is freed while still in use | ||
| using this value as a static requires that borrow lasts for `'static` | ||
|
||
error[E0716]: temporary value dropped while borrowed | ||
--> $DIR/mut_ref_in_final.rs:53:71 | ||
| | ||
LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | ||
| -------------------------------^^-- | ||
| | | | | ||
| | | temporary value is freed at the end of this statement | ||
| | creates a temporary which is freed while still in use | ||
| using this value as a static requires that borrow lasts for `'static` | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0764`. | ||
Some errors have detailed explanations: E0716, E0764. | ||
For more information about an error, try `rustc --explain E0716`. |
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/test/ui/consts/const-mut-refs/mut_ref_in_final_ok.stderr
This file was deleted.
Oops, something went wrong.