+ /// Learn the associated types from the trait in the current context.
+ pub fn learn_associated_types<'b, 'c>(&mut self, t: &'a syn::ItemTrait, types: &'b TypeResolver<'a, 'c>) {
+ for item in t.items.iter() {
+ match item {
+ &syn::TraitItem::Type(ref t) => {
+ if t.default.is_some() || t.generics.lt_token.is_some() { unimplemented!(); }
+ let mut bounds_iter = t.bounds.iter();
+ match bounds_iter.next().unwrap() {
+ syn::TypeParamBound::Trait(tr) => {
+ assert_simple_bound(&tr);
+ if let Some(mut path) = types.maybe_resolve_path(&tr.path, None) {
+ if types.skip_path(&path) { continue; }
+ let new_ident = if path != "std::ops::Deref" {
+ path = "crate::".to_string() + &path;
+ Some(&tr.path)
+ } else { None };
+ self.typed_generics.last_mut().unwrap().insert(&t.ident, (path, new_ident));
+ } else { unimplemented!(); }
+ },
+ _ => unimplemented!(),
+ }
+ if bounds_iter.next().is_some() { unimplemented!(); }
+ },
+ _ => {},
+ }
+ }
+ }
+