]> git.lizzy.rs Git - rust.git/commitdiff
Store a method-from-trait's impl in some cases when it is known.
authorHuon Wilson <dbau.pp+github@gmail.com>
Wed, 31 Dec 2014 16:03:14 +0000 (03:03 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Sat, 24 Jan 2015 02:01:21 +0000 (13:01 +1100)
This allows one to look at an `ExprMethodCall` `foo.bar()` where `bar`
is a method in some trait and (sometimes) extract the `impl` that `bar`
is defined in, e.g.

    trait Foo {
        fn bar(&self);
    }

    impl Foo for uint { // <A>
        fn bar(&self) {}
    }

    fn main() {
        1u.bar(); // impl_def_id == Some(<A>)
    }

This definitely doesn't handle all cases, but is correct when it is
known, meaning it should only be used for certain linting/heuristic
purposes; no safety analysis.


No differences found