]> git.lizzy.rs Git - rust.git/commit
Auto merge of #26694 - eddyb:method-nan, r=arielb1
authorbors <bors@rust-lang.org>
Sat, 4 Jul 2015 18:49:28 +0000 (18:49 +0000)
committerbors <bors@rust-lang.org>
Sat, 4 Jul 2015 18:49:28 +0000 (18:49 +0000)
commit42e545ffa73836525d10e1c658b622ddb12b7f93
tree5073694b309554caddbd9e84303978768d5699ce
parentb381449dfffef27e8b28a6f0867a8c238eef7188
parentd256eb1c5ddd6740140b6538a018a0171f45fdae
Auto merge of #26694 - eddyb:method-nan, r=arielb1

`MethodCallee` now has no information about the method, other than its `DefId`.
The previous bits of information can be recovered as follows:
```rust
let method_item = tcx.impl_or_trait_item(callee.def_id);
let container = method_item.container();
```
The method is inherent if `container` is a `ty::ImplContainer`:
* the `impl` the method comes from is `container.id()`

The method is a trait method if `container` is a `ty::TraitContainer:
* the `trait` the method is part of is `container.id()`
* a `ty::TraitRef` can be constructed by putting together:
 * `container.id()` as the `trait` ID
 * `callee.substs.clone().method_to_trait()` as the `trait` substs (including `Self`)
* the above `trait_ref` is a valid `T: Trait<A, B, C>` predicate
* selecting `trait_ref` could result in one of the following:
 * `traits::VtableImpl(data)`: static dispatch to `data.impl_def_id`
 * `traits::VtableObject(data)`: dynamic dispatch, with the vtable index:
`traits::get_vtable_index_of_object_method(tcx, data, callee.def_id)`
 * other variants of `traits::Vtable`: various other `impl` sources
src/librustc/middle/effect.rs