diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-27 15:04:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-27 15:04:57 +0200 |
| commit | 0bbeeffe57378b9460ec6df4532b8a569003f7f9 (patch) | |
| tree | 81375f28340e900d1b616751535294f4c3e4062a /tests/ui/recursion/recursive-static-definition.rs | |
| parent | 8e7b0b57ea97afd31b05709b3da525036269df57 (diff) | |
| parent | ed4f01ed2e033098f6c5e10a4a0cc740dc04f958 (diff) | |
| download | rust-0bbeeffe57378b9460ec6df4532b8a569003f7f9.tar.gz rust-0bbeeffe57378b9460ec6df4532b8a569003f7f9.zip | |
Rollup merge of #143084 - RalfJung:const-eval-recursive-static-write, r=oli-obk
const-eval: error when initializing a static writes to that static Fixes https://github.com/rust-lang/rust/issues/142404 by also calling the relevant hook for writes, not just reads. To avoid erroring during the actual write of the initial value, we neuter the hook when popping the final stack frame. Calling the hook during writes requires changing its signature since we cannot pass in the entire interpreter any more. While doing this I also realized a gap in https://github.com/rust-lang/rust/pull/142575 for zero-sized copies on the read side, so I fixed that and added a test. r? `@oli-obk`
Diffstat (limited to 'tests/ui/recursion/recursive-static-definition.rs')
| -rw-r--r-- | tests/ui/recursion/recursive-static-definition.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/ui/recursion/recursive-static-definition.rs b/tests/ui/recursion/recursive-static-definition.rs index 55db6a86bf1..4f0624eb162 100644 --- a/tests/ui/recursion/recursive-static-definition.rs +++ b/tests/ui/recursion/recursive-static-definition.rs @@ -1,5 +1,5 @@ pub static FOO: u32 = FOO; -//~^ ERROR encountered static that tried to initialize itself with itself +//~^ ERROR encountered static that tried to access itself during initialization #[derive(Copy, Clone)] pub union Foo { @@ -7,6 +7,6 @@ pub union Foo { } pub static BAR: Foo = BAR; -//~^ ERROR encountered static that tried to initialize itself with itself +//~^ ERROR encountered static that tried to access itself during initialization fn main() {} |
