812ea9e169
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.
20 lines
661 B
Rust
20 lines
661 B
Rust
// Copyright 2013 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.
|
|
|
|
struct NotEq;
|
|
|
|
#[deriving(Eq)]
|
|
struct Foo (
|
|
NotEq //~ ERROR mismatched types
|
|
//~^ ERROR failed to find an implementation of trait std::cmp::Eq for NotEq
|
|
);
|
|
|
|
pub fn main() {}
|