about summary refs log tree commit diff
path: root/src/test/compile-fail/deriving-span-Hash-struct.rs
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2014-02-21 21:33:23 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2014-02-21 21:33:23 -0800
commitd223dd1e57cc412aa2eff28e6604f86b9f013083 (patch)
treeaa8d3f01f77b0a74c024d1632df29d5a95f4724e /src/test/compile-fail/deriving-span-Hash-struct.rs
parent0135b521ad38615e9a07aac54d9c22627af57ca4 (diff)
downloadrust-d223dd1e57cc412aa2eff28e6604f86b9f013083.tar.gz
rust-d223dd1e57cc412aa2eff28e6604f86b9f013083.zip
std: rewrite Hash to make it more generic
This patch merges IterBytes and Hash traits, which clears up the
confusion of using `#[deriving(IterBytes)]` to support hashing.
Instead, it now is much easier to use the new `#[deriving(Hash)]`
for making a type hashable with a stream hash.

Furthermore, it supports custom non-stream-based hashers, such as
if a value's hash was cached in a database.

This does not yet replace the old IterBytes-hash with this new
version.
Diffstat (limited to 'src/test/compile-fail/deriving-span-Hash-struct.rs')
-rw-r--r--src/test/compile-fail/deriving-span-Hash-struct.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/compile-fail/deriving-span-Hash-struct.rs b/src/test/compile-fail/deriving-span-Hash-struct.rs
new file mode 100644
index 00000000000..f20da9a9d16
--- /dev/null
+++ b/src/test/compile-fail/deriving-span-Hash-struct.rs
@@ -0,0 +1,25 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
+
+#[feature(struct_variant)];
+extern crate extra;
+
+use std::hash::Hash;
+
+struct Error;
+
+#[deriving(Hash)]
+struct Struct {
+    x: Error //~ ERROR
+}
+
+fn main() {}