-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct other tests related to const_mut_refs
- Loading branch information
Showing
9 changed files
with
97 additions
and
20 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,12 @@ | ||
error[E0017]: references in statics may only refer to immutable values | ||
error[E0658]: references in statics may only refer to immutable values | ||
--> $DIR/check-static-immutable-mut-slices.rs:3:37 | ||
| | ||
LL | static TEST: &'static mut [isize] = &mut []; | ||
| ^^^^^^^ statics require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0017`. | ||
For more information about this error, try `rustc --explain E0658`. |
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,40 +1,52 @@ | ||
error[E0017]: references in constants may only refer to immutable values | ||
error[E0658]: references in constants may only refer to immutable values | ||
--> $DIR/E0017.rs:5:30 | ||
| | ||
LL | const CR: &'static mut i32 = &mut C; | ||
| ^^^^^^ constants require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error[E0019]: static contains unimplemented expression type | ||
--> $DIR/E0017.rs:6:39 | ||
| | ||
LL | static STATIC_REF: &'static mut i32 = &mut X; | ||
| ^^^^^^ | ||
|
||
error[E0017]: references in statics may only refer to immutable values | ||
error[E0658]: references in statics may only refer to immutable values | ||
--> $DIR/E0017.rs:6:39 | ||
| | ||
LL | static STATIC_REF: &'static mut i32 = &mut X; | ||
| ^^^^^^ statics require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error[E0596]: cannot borrow immutable static item `X` as mutable | ||
--> $DIR/E0017.rs:6:39 | ||
| | ||
LL | static STATIC_REF: &'static mut i32 = &mut X; | ||
| ^^^^^^ cannot borrow as mutable | ||
|
||
error[E0017]: references in statics may only refer to immutable values | ||
error[E0658]: references in statics may only refer to immutable values | ||
--> $DIR/E0017.rs:9:38 | ||
| | ||
LL | static CONST_REF: &'static mut i32 = &mut C; | ||
| ^^^^^^ statics require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error[E0017]: references in statics may only refer to immutable values | ||
error[E0658]: references in statics may only refer to immutable values | ||
--> $DIR/E0017.rs:10:52 | ||
| | ||
LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; | ||
| ^^^^^^ statics require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
Some errors have detailed explanations: E0017, E0019, E0596. | ||
For more information about an error, try `rustc --explain E0017`. | ||
Some errors have detailed explanations: E0019, E0596, E0658. | ||
For more information about an error, try `rustc --explain E0019`. |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
static X: i32 = 1; | ||
const C: i32 = 2; | ||
|
||
const CR: &'static mut i32 = &mut C; //~ ERROR E0658 | ||
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658 | ||
//~| ERROR cannot borrow | ||
//~| ERROR E0019 | ||
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0658 | ||
|
||
fn main() {} |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
error[E0658]: references in constants may only refer to immutable values | ||
--> $DIR/E0388.rs:4:30 | ||
| | ||
LL | const CR: &'static mut i32 = &mut C; | ||
| ^^^^^^ constants require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error[E0019]: static contains unimplemented expression type | ||
--> $DIR/E0388.rs:5:39 | ||
| | ||
LL | static STATIC_REF: &'static mut i32 = &mut X; | ||
| ^^^^^^ | ||
|
||
error[E0658]: references in statics may only refer to immutable values | ||
--> $DIR/E0388.rs:5:39 | ||
| | ||
LL | static STATIC_REF: &'static mut i32 = &mut X; | ||
| ^^^^^^ statics require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error[E0596]: cannot borrow immutable static item `X` as mutable | ||
--> $DIR/E0388.rs:5:39 | ||
| | ||
LL | static STATIC_REF: &'static mut i32 = &mut X; | ||
| ^^^^^^ cannot borrow as mutable | ||
|
||
error[E0658]: references in statics may only refer to immutable values | ||
--> $DIR/E0388.rs:8:38 | ||
| | ||
LL | static CONST_REF: &'static mut i32 = &mut C; | ||
| ^^^^^^ statics require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
Some errors have detailed explanations: E0019, E0596, E0658. | ||
For more information about an error, try `rustc --explain E0019`. |
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,22 +1,28 @@ | ||
error[E0017]: references in constants may only refer to immutable values | ||
error[E0658]: references in constants may only refer to immutable values | ||
--> $DIR/issue-17718-const-bad-values.rs:1:34 | ||
| | ||
LL | const C1: &'static mut [usize] = &mut []; | ||
| ^^^^^^^ constants require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error[E0013]: constants cannot refer to statics, use a constant instead | ||
--> $DIR/issue-17718-const-bad-values.rs:5:46 | ||
| | ||
LL | const C2: &'static mut usize = unsafe { &mut S }; | ||
| ^ | ||
|
||
error[E0017]: references in constants may only refer to immutable values | ||
error[E0658]: references in constants may only refer to immutable values | ||
--> $DIR/issue-17718-const-bad-values.rs:5:41 | ||
| | ||
LL | const C2: &'static mut usize = unsafe { &mut S }; | ||
| ^^^^^^ constants require immutable values | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/57349 | ||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0013, E0017. | ||
Some errors have detailed explanations: E0013, E0658. | ||
For more information about an error, try `rustc --explain E0013`. |
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