about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/iter_bytes.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-11-07 18:49:01 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2013-11-08 20:57:34 +1100
commit812ea9e169d6edcc138e334e7e2b2cb5f7ba66b3 (patch)
treebc573c50474ccf53fc5dfbb21c8217beee36d604 /src/libsyntax/ext/deriving/iter_bytes.rs
parent57d1ed819b9e32a8e915ced9b5e130c299a46bca (diff)
downloadrust-812ea9e169d6edcc138e334e7e2b2cb5f7ba66b3.tar.gz
rust-812ea9e169d6edcc138e334e7e2b2cb5f7ba66b3.zip
syntax::ext: Make type errors in deriving point to the field itself.
This rearranges the deriving code so that #[deriving] a trait on a field
that doesn't implement that trait will point to the field in question,
e.g.

    struct NotEq; // doesn't implement Eq

    #[deriving(Eq)]
    struct Foo {
        ok: int,
        also_ok: ~str,
        bad: NotEq // error points here.
    }

Unfortunately, this means the error is disconnected from the `deriving`
itself but there's no current way to pass that information through to
rustc except via the spans, at the moment.

Fixes #7724.
Diffstat (limited to 'src/libsyntax/ext/deriving/iter_bytes.rs')
-rw-r--r--src/libsyntax/ext/deriving/iter_bytes.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/ext/deriving/iter_bytes.rs b/src/libsyntax/ext/deriving/iter_bytes.rs
index 0f4e57b0889..82f449fc116 100644
--- a/src/libsyntax/ext/deriving/iter_bytes.rs
+++ b/src/libsyntax/ext/deriving/iter_bytes.rs
@@ -81,8 +81,8 @@ fn iter_bytes_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @
         _ => cx.span_bug(span, "Impossible substructure in `deriving(IterBytes)`")
     }
 
-    for &(_, field, _) in fields.iter() {
-        exprs.push(call_iterbytes(field));
+    for &FieldInfo { self_, _ } in fields.iter() {
+        exprs.push(call_iterbytes(self_));
     }
 
     if exprs.len() == 0 {