diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-06 23:26:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-06 23:26:54 +0100 |
| commit | 2bd35c065cb097d1ea6480c372ab9b5eea358cee (patch) | |
| tree | a72085358f010d6572bf3010c36a4ab6fe28b077 /src/librustc_error_codes | |
| parent | ae1b871cca56613b1af1a5121dd24ac810ff4b89 (diff) | |
| parent | e01ad6a01abce35f59543bf38a280a05eb7f6929 (diff) | |
| download | rust-2bd35c065cb097d1ea6480c372ab9b5eea358cee.tar.gz rust-2bd35c065cb097d1ea6480c372ab9b5eea358cee.zip | |
Rollup merge of #66606 - christianpoveda:mut-refs-in-const-fn, r=oli-obk
Add feature gate for mut refs in const fn r? @oli-obk
Diffstat (limited to 'src/librustc_error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes.rs | 1 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0017.md | 20 |
2 files changed, 0 insertions, 21 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 9e4b704170b..9c1bec39b29 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -18,7 +18,6 @@ E0010: include_str!("./error_codes/E0010.md"), E0013: include_str!("./error_codes/E0013.md"), E0014: include_str!("./error_codes/E0014.md"), E0015: include_str!("./error_codes/E0015.md"), -E0017: include_str!("./error_codes/E0017.md"), E0019: include_str!("./error_codes/E0019.md"), E0023: include_str!("./error_codes/E0023.md"), E0025: include_str!("./error_codes/E0025.md"), diff --git a/src/librustc_error_codes/error_codes/E0017.md b/src/librustc_error_codes/error_codes/E0017.md deleted file mode 100644 index d5e6857b4d6..00000000000 --- a/src/librustc_error_codes/error_codes/E0017.md +++ /dev/null @@ -1,20 +0,0 @@ -References in statics and constants may only refer to immutable values. - -Erroneous code example: - -```compile_fail,E0017 -static X: i32 = 1; -const C: i32 = 2; - -// these three are not allowed: -const CR: &mut i32 = &mut C; -static STATIC_REF: &'static mut i32 = &mut X; -static CONST_REF: &'static mut i32 = &mut C; -``` - -Statics are shared everywhere, and if they refer to mutable data one might -violate memory safety since holding multiple mutable references to shared data -is not allowed. - -If you really want global mutable state, try using `static mut` or a global -`UnsafeCell`. |
