about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src/assert/context.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-10 15:52:24 +0000
committerbors <bors@rust-lang.org>2024-02-10 15:52:24 +0000
commit6cc4843512d613f51ec81aba689180c31b0b28b6 (patch)
tree032317f05e63866f8eea1a3927c3dc5a8fdcded4 /compiler/rustc_builtin_macros/src/assert/context.rs
parent5f40394baa07b6fb50bc70dedd8b780524b20934 (diff)
parent4def37386c181e9afb0dfc7f6c137f3730e5fca1 (diff)
downloadrust-6cc4843512d613f51ec81aba689180c31b0b28b6.tar.gz
rust-6cc4843512d613f51ec81aba689180c31b0b28b6.zip
Auto merge of #119614 - RalfJung:const-refs-to-static, r=oli-obk
unstably allow constants to refer to statics and read from immutable statics

I am not aware of any fundamental reason why we cannot allow constants to mention statics. What we really need is that constants do not *read from* statics that can change their value:
- This would break the principle that "constants behave as-if their expression was inlined everywhere and executed at runtime". This is enforced by halting const-eval interpretation when a read from a mutable global occurs.
- When building a valtree we want to be sure that the constant and everything it refers to is truly immutable. This is enforced by aborting valtree construction when a read from a mutable global occurs.

r? `@oli-obk` -- if you are okay with experimenting with this feature, I will create a tracking issue.
Based on and blocked on https://github.com/rust-lang/rust/pull/119044; only the last commit is new.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/assert/context.rs')
0 files changed, 0 insertions, 0 deletions