pub fn resolve_ty_and_def_ufcs<'b>(&self,
                                       qpath: &'b hir::QPath,
                                       node_id: ast::NodeId,
                                       span: Span)
                                       -> (Def, Option<Ty<'tcx>>, &'b [hir::PathSegment])
    {
        let (ty, item_segment) = match *qpath {
            hir::QPath::Resolved(ref opt_qself, ref path) => {
                return (path.def,
                        opt_qself.as_ref().map(|qself| self.to_ty(qself)),
                        &path.segments[..]);
            }
            hir::QPath::TypeRelative(ref qself, ref segment) => {
                (self.to_ty(qself), segment)
            }
        };
        let item_name = item_segment.name;
        let def = match self.resolve_ufcs(span, item_name, ty, node_id) {
            Ok(def) => def,
            Err(error) => {
                let def = match error {
                    method::MethodError::PrivateMatch(def) => def,
                    _ => Def::Err,
                };
                if item_name != keywords::Invalid.name() {
                    self.report_method_error(span, ty, item_name, None, error, None);
                }
                def
            }
        };

        // Write back the new resolution.
        self.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
        (def, Some(ty), slice::ref_slice(&**item_segment))
    }
// Resolve associated value path into a base type and associated constant or method definition.
// The newly resolved definition is written into `type_relative_path_defs`.
Resolve associated value path into a base type and associated constant or method definition.
The newly resolved definition is written into `type_relative_path_defs`.
Resolve associated value path into a base type and associated constant or method definition . The newly resolved definition is written into ` type_relative_path_defs ` .
pub fn resolve_ty_and_def_ufcs<'b>(&self,
                                       qpath: &'b hir::QPath,
                                       node_id: ast::NodeId,
                                       span: Span)
                                       -> (Def, Option<Ty<'tcx>>, &'b [hir::PathSegment])
    {
        let (ty, item_segment) = match *qpath {
            hir::QPath::Resolved(ref opt_qself, ref path) => {
                return (path.def,
                        opt_qself.as_ref().map(|qself| self.to_ty(qself)),
                        &path.segments[..]);
            }
            hir::QPath::TypeRelative(ref qself, ref segment) => {
                (self.to_ty(qself), segment)
            }
        };
        let item_name = item_segment.name;
        let def = match self.resolve_ufcs(span, item_name, ty, node_id) {
            Ok(def) => def,
            Err(error) => {
                let def = match error {
                    method::MethodError::PrivateMatch(def) => def,
                    _ => Def::Err,
                };
                if item_name != keywords::Invalid.name() {
                    self.report_method_error(span, ty, item_name, None, error, None);
                }
                def
            }
        };
        // Write back the new resolution.
        self.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
        (def, Some(ty), slice::ref_slice(&**item_segment))
    }
pub fn resolve_ty_and_def_ufcs < ' b > ( & self , qpath : & ' b hir :: QPath , node_id : ast :: NodeId , span : Span ) -> ( Def , Option < Ty < ' tcx > > , & ' b [ hir :: PathSegment ] ) { let ( ty , item_segment ) = match * qpath { hir :: QPath :: Resolved ( ref opt_qself , ref path ) => { return ( path . def , opt_qself . as_ref ( ) . map ( | qself | self . to_ty ( qself ) ) , & path . segments [ .. ] ) ; } hir :: QPath :: TypeRelative ( ref qself , ref segment ) => { ( self . to_ty ( qself ) , segment ) } } ; let item_name = item_segment . name ; let def = match self . resolve_ufcs ( span , item_name , ty , node_id ) { Ok ( def ) => def , Err ( error ) => { let def = match error { method :: MethodError :: PrivateMatch ( def ) => def , _ => Def :: Err , } ; if item_name != keywords :: Invalid . name ( ) { self . report_method_error ( span , ty , item_name , None , error , None ) ; } def } } ; // Write back the new resolution. self . tables . borrow_mut ( ) . type_relative_path_defs . insert ( node_id , def ) ; ( def , Some ( ty ) , slice :: ref_slice ( & * * item_segment ) ) }
Resolve associated value path into a base type and associated constant or method definition.
Resolve associated value path into a base type and associated constant or method definition .
&self
qpath
&'b hir::QPath
node_id
ast::NodeId
span
Span
&self
qpath
&'b hir::QPath
node_id
ast::NodeId
span
Span