rust/tests/ui/issues/issue-3021-d.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
618 B
Rust
Raw Normal View History

trait SipHash {
fn result(&self) -> u64;
fn reset(&self);
}
2015-12-11 07:59:11 +00:00
fn siphash(k0 : u64, k1 : u64) {
2013-03-07 03:09:17 +00:00
struct SipState {
v0: u64,
v1: u64,
}
2015-12-11 07:59:11 +00:00
fn mk_result(st : &SipState) -> u64 {
let v0 = st.v0;
let v1 = st.v1;
2012-08-02 00:30:05 +00:00
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() {}