diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/issues/issue-3021-d.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/issues/issue-3021-d.rs')
-rw-r--r-- | tests/ui/issues/issue-3021-d.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-3021-d.rs b/tests/ui/issues/issue-3021-d.rs new file mode 100644 index 000000000..1fb0002b2 --- /dev/null +++ b/tests/ui/issues/issue-3021-d.rs @@ -0,0 +1,28 @@ +trait SipHash { + fn result(&self) -> u64; + fn reset(&self); +} + +fn siphash(k0 : u64, k1 : u64) { + struct SipState { + v0: u64, + v1: u64, + } + + fn mk_result(st : &SipState) -> u64 { + + let v0 = st.v0; + let v1 = st.v1; + return v0 ^ v1; + } + + impl SipHash for SipState { + fn reset(&self) { + self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment + self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment + } + fn result(&self) -> u64 { return mk_result(self); } + } +} + +fn main() {} |