]> git.lizzy.rs Git - rust.git/commitdiff
use better span
authorJorge Aparicio <japaricious@gmail.com>
Thu, 15 Jan 2015 01:03:17 +0000 (20:03 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Thu, 15 Jan 2015 01:03:17 +0000 (20:03 -0500)
src/libsyntax/ext/deriving/hash.rs
src/test/compile-fail/issue-21160.rs

index 98b7fae0341bf2f00fa1dd9cab830e642ef82598..889a212a2872911931f1b40e965577e27e289527 100644 (file)
@@ -65,19 +65,19 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
         [ref state_expr] => state_expr,
         _ => cx.span_bug(trait_span, "incorrect number of arguments in `deriving(Hash)`")
     };
-    let hash_path = {
-        let strs = vec![
-            cx.ident_of("std"),
-            cx.ident_of("hash"),
-            cx.ident_of("Hash"),
-            cx.ident_of("hash"),
-        ];
-
-        cx.expr_path(cx.path_global(trait_span, strs))
-    };
     let call_hash = |&: span, thing_expr| {
+        let hash_path = {
+            let strs = vec![
+                cx.ident_of("std"),
+                cx.ident_of("hash"),
+                cx.ident_of("Hash"),
+                cx.ident_of("hash"),
+            ];
+
+            cx.expr_path(cx.path_global(span, strs))
+        };
         let ref_thing = cx.expr_addr_of(span, thing_expr);
-        let expr = cx.expr_call(span, hash_path.clone(), vec!(ref_thing, state_expr.clone()));
+        let expr = cx.expr_call(span, hash_path, vec!(ref_thing, state_expr.clone()));
         cx.stmt_expr(expr)
     };
     let mut stmts = Vec::new();
index 30ed4f439403fb7583c8288becb133c997c2ffec..0ee381669351a6287a3bea5bddd1454b732945c0 100644 (file)
@@ -15,7 +15,7 @@ fn hash<T>(&self, _: T) {}
 }
 
 #[derive(Hash)]
-//~^ error: the trait `core::hash::Hash<__S>` is not implemented for the type `Bar`
 struct Foo(Bar);
+//~^ error: the trait `core::hash::Hash<__S>` is not implemented for the type `Bar`
 
 fn main() {}