diff options
| author | antoyo <antoyo@users.noreply.github.com> | 2022-05-28 09:24:50 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-28 09:24:50 -0400 |
| commit | 7e0a42b4927a213b8e6ceeec6d842eb0faaf0d26 (patch) | |
| tree | ac5584a1873221aa7f1a46bf6c9bb855dfb256fa | |
| parent | e6dbecdff382691b9f072fedc7cf70cd8ab5a6a4 (diff) | |
| parent | 10a9c0e57f888b56fd396b913e0b0eeca1eb0d0c (diff) | |
| download | rust-7e0a42b4927a213b8e6ceeec6d842eb0faaf0d26.tar.gz rust-7e0a42b4927a213b8e6ceeec6d842eb0faaf0d26.zip | |
Merge pull request #165 from yvt/fix-const-memattr
Define immutable statics with const qualified types
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | src/consts.rs | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Cargo.lock b/Cargo.lock index c5315e2392e..6df2102470f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "gccjit" version = "1.0.0" -source = "git+https://github.com/antoyo/gccjit.rs#6c2af0cf733a26740f01a7c679afc20431165a54" +source = "git+https://github.com/antoyo/gccjit.rs#bdb86fb5092895ff5589726b33250010c64d93f6" dependencies = [ "gccjit_sys", ] @@ -49,7 +49,7 @@ dependencies = [ [[package]] name = "gccjit_sys" version = "0.0.1" -source = "git+https://github.com/antoyo/gccjit.rs#6c2af0cf733a26740f01a7c679afc20431165a54" +source = "git+https://github.com/antoyo/gccjit.rs#bdb86fb5092895ff5589726b33250010c64d93f6" dependencies = [ "libc 0.1.12", ] diff --git a/src/consts.rs b/src/consts.rs index 4b517fd85f0..9517cf8494b 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -47,7 +47,10 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> { } } let global_value = self.static_addr_of_mut(cv, align, kind); - // TODO(antoyo): set global constant. + #[cfg(feature = "master")] + self.global_lvalues.borrow().get(&global_value) + .expect("`static_addr_of_mut` did not add the global to `self.global_lvalues`") + .global_set_readonly(); self.const_globals.borrow_mut().insert(cv, global_value); global_value } @@ -88,7 +91,8 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> { // mutability are placed into read-only memory. if !is_mutable { if self.type_is_freeze(ty) { - // TODO(antoyo): set global constant. + #[cfg(feature = "master")] + global.global_set_readonly(); } } |
