Skip to content

Commit 28b0d40

Browse files
author
Jorge Aparicio
committed
use better span
1 parent 86948ad commit 28b0d40

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/libsyntax/ext/deriving/hash.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
6565
[ref state_expr] => state_expr,
6666
_ => cx.span_bug(trait_span, "incorrect number of arguments in `deriving(Hash)`")
6767
};
68-
let hash_path = {
69-
let strs = vec![
70-
cx.ident_of("std"),
71-
cx.ident_of("hash"),
72-
cx.ident_of("Hash"),
73-
cx.ident_of("hash"),
74-
];
75-
76-
cx.expr_path(cx.path_global(trait_span, strs))
77-
};
7868
let call_hash = |&: span, thing_expr| {
69+
let hash_path = {
70+
let strs = vec![
71+
cx.ident_of("std"),
72+
cx.ident_of("hash"),
73+
cx.ident_of("Hash"),
74+
cx.ident_of("hash"),
75+
];
76+
77+
cx.expr_path(cx.path_global(span, strs))
78+
};
7979
let ref_thing = cx.expr_addr_of(span, thing_expr);
80-
let expr = cx.expr_call(span, hash_path.clone(), vec!(ref_thing, state_expr.clone()));
80+
let expr = cx.expr_call(span, hash_path, vec!(ref_thing, state_expr.clone()));
8181
cx.stmt_expr(expr)
8282
};
8383
let mut stmts = Vec::new();

src/test/compile-fail/issue-21160.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl Bar {
1515
}
1616

1717
#[derive(Hash)]
18-
//~^ error: the trait `core::hash::Hash<__S>` is not implemented for the type `Bar`
1918
struct Foo(Bar);
19+
//~^ error: the trait `core::hash::Hash<__S>` is not implemented for the type `Bar`
2020

2121
fn main() {}

0 commit comments

Comments
 (0)