1
Fork 0

use better span

This commit is contained in:
Jorge Aparicio 2015-01-14 20:03:17 -05:00
parent 86948adfde
commit 28b0d4029e
2 changed files with 12 additions and 12 deletions

View 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();

View file

@ -15,7 +15,7 @@ impl Bar {
}
#[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() {}