fn resolve_qpath_anywhere(
        &mut self,
        id: NodeId,
        qself: Option<&QSelf>,
        path: &[Segment],
        primary_ns: Namespace,
        span: Span,
        defer_to_typeck: bool,
        crate_lint: CrateLint,
    ) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>> {
        let mut fin_res = None;

        for (i, &ns) in [primary_ns, TypeNS, ValueNS].iter().enumerate() {
            if i == 0 || ns != primary_ns {
                match self.resolve_qpath(id, qself, path, ns, span, crate_lint)? {
                    Some(partial_res)
                        if partial_res.unresolved_segments() == 0 || defer_to_typeck =>
                    {
                        return Ok(Some(partial_res));
                    }
                    partial_res => {
                        if fin_res.is_none() {
                            fin_res = partial_res;
                        }
                    }
                }
            }
        }

        assert!(primary_ns != MacroNS);

        if qself.is_none() {
            let path_seg = |seg: &Segment| PathSegment::from_ident(seg.ident);
            let path = Path { segments: path.iter().map(path_seg).collect(), span, tokens: None };
            if let Ok((_, res)) =
                self.r.resolve_macro_path(&path, None, &self.parent_scope, false, false)
            {
                return Ok(Some(PartialRes::new(res)));
            }
        }

        Ok(fin_res)
    }
// Resolve in alternative namespaces if resolution in the primary namespace fails.
Resolve in alternative namespaces if resolution in the primary namespace fails.
Resolve in alternative namespaces if resolution in the primary namespace fails .
fn resolve_qpath_anywhere(
        &mut self,
        id: NodeId,
        qself: Option<&QSelf>,
        path: &[Segment],
        primary_ns: Namespace,
        span: Span,
        defer_to_typeck: bool,
        crate_lint: CrateLint,
    ) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>> {
        let mut fin_res = None;
        for (i, &ns) in [primary_ns, TypeNS, ValueNS].iter().enumerate() {
            if i == 0 || ns != primary_ns {
                match self.resolve_qpath(id, qself, path, ns, span, crate_lint)? {
                    Some(partial_res)
                        if partial_res.unresolved_segments() == 0 || defer_to_typeck =>
                    {
                        return Ok(Some(partial_res));
                    }
                    partial_res => {
                        if fin_res.is_none() {
                            fin_res = partial_res;
                        }
                    }
                }
            }
        }
        assert!(primary_ns != MacroNS);
        if qself.is_none() {
            let path_seg = |seg: &Segment| PathSegment::from_ident(seg.ident);
            let path = Path { segments: path.iter().map(path_seg).collect(), span, tokens: None };
            if let Ok((_, res)) =
                self.r.resolve_macro_path(&path, None, &self.parent_scope, false, false)
            {
                return Ok(Some(PartialRes::new(res)));
            }
        }
        Ok(fin_res)
    }
fn resolve_qpath_anywhere ( & mut self , id : NodeId , qself : Option < & QSelf > , path : & [ Segment ] , primary_ns : Namespace , span : Span , defer_to_typeck : bool , crate_lint : CrateLint , ) -> Result < Option < PartialRes > , Spanned < ResolutionError < ' a > > > { let mut fin_res = None ; for ( i , & ns ) in [ primary_ns , TypeNS , ValueNS ] . iter ( ) . enumerate ( ) { if i == 0 || ns != primary_ns { match self . resolve_qpath ( id , qself , path , ns , span , crate_lint ) ? { Some ( partial_res ) if partial_res . unresolved_segments ( ) == 0 || defer_to_typeck => { return Ok ( Some ( partial_res ) ) ; } partial_res => { if fin_res . is_none ( ) { fin_res = partial_res ; } } } } } assert ! ( primary_ns MacroNS ) ; if qself . is_none ( ) { let path_seg = | seg : & Segment | PathSegment :: from_ident ( seg . ident ) ; let path = Path { segments : path . iter ( ) . map ( path_seg ) . collect ( ) , span , tokens : None } ; if let Ok ( ( _ , res ) ) = self . r . resolve_macro_path ( & path , None , & self . parent_scope , false , false ) { return Ok ( Some ( PartialRes :: new ( res ) ) ) ; } } Ok ( fin_res ) }
Resolve in alternative namespaces if resolution in the primary namespace fails.
Resolve in alternative namespaces if resolution in the primary namespace fails .
&mut self
id
NodeId
qself
Option<&QSelf>
path
&[Segment]
primary_ns
Namespace
span
Span
defer_to_typeck
bool
crate_lint
CrateLint
&mut self
id
NodeId
qself
Option<&QSelf>
path
&[Segment]
primary_ns
Namespace
span
Span
defer_to_typeck
bool
crate_lint
CrateLint