fn resolve_label(&self, mut label: Ident) -> Option<NodeId> {
        let mut suggestion = None;

        // Preserve the original span so that errors contain "in this macro invocation"
        // information.
        let original_span = label.span;

        for i in (0..self.label_ribs.len()).rev() {
            let rib = &self.label_ribs[i];

            if let MacroDefinition(def) = rib.kind {
                // If an invocation of this macro created `ident`, give up on `ident`
                // and switch to `ident`'s source from the macro definition.
                if def == self.r.macro_def(label.span.ctxt()) {
                    label.span.remove_mark();
                }
            }

            let ident = label.normalize_to_macro_rules();
            if let Some((ident, id)) = rib.bindings.get_key_value(&ident) {
                return if self.is_label_valid_from_rib(i) {
                    Some(*id)
                } else {
                    self.report_error(
                        original_span,
                        ResolutionError::UnreachableLabel {
                            name: label.name,
                            definition_span: ident.span,
                            suggestion,
                        },
                    );

                    None
                };
            }

            // Diagnostics: Check if this rib contains a label with a similar name, keep track of
            // the first such label that is encountered.
            suggestion = suggestion.or_else(|| self.suggestion_for_label_in_rib(i, label));
        }

        self.report_error(
            original_span,
            ResolutionError::UndeclaredLabel { name: label.name, suggestion },
        );
        None
    }
/// Searches the current set of local scopes for labels. Returns the `NodeId` of the resolved
/// label and reports an error if the label is not found or is unreachable.
Searches the current set of local scopes for labels. Returns the `NodeId` of the resolved
label and reports an error if the label is not found or is unreachable.
Searches the current set of local scopes for labels . Returns the ` NodeId ` of the resolved label and reports an error if the label is not found or is unreachable .
fn resolve_label(&self, mut label: Ident) -> Option<NodeId> {
        let mut suggestion = None;
        // Preserve the original span so that errors contain "in this macro invocation"
        // information.
        let original_span = label.span;
        for i in (0..self.label_ribs.len()).rev() {
            let rib = &self.label_ribs[i];
            if let MacroDefinition(def) = rib.kind {
                // If an invocation of this macro created `ident`, give up on `ident`
                // and switch to `ident`'s source from the macro definition.
                if def == self.r.macro_def(label.span.ctxt()) {
                    label.span.remove_mark();
                }
            }
            let ident = label.normalize_to_macro_rules();
            if let Some((ident, id)) = rib.bindings.get_key_value(&ident) {
                return if self.is_label_valid_from_rib(i) {
                    Some(*id)
                } else {
                    self.report_error(
                        original_span,
                        ResolutionError::UnreachableLabel {
                            name: label.name,
                            definition_span: ident.span,
                            suggestion,
                        },
                    );
                    None
                };
            }
            // Diagnostics: Check if this rib contains a label with a similar name, keep track of
            // the first such label that is encountered.
            suggestion = suggestion.or_else(|| self.suggestion_for_label_in_rib(i, label));
        }
        self.report_error(
            original_span,
            ResolutionError::UndeclaredLabel { name: label.name, suggestion },
        );
        None
    }
fn resolve_label ( & self , mut label : Ident ) -> Option < NodeId > { let mut suggestion = None ; // Preserve the original span so that errors contain "in this macro invocation" // information. let original_span = label . span ; for i in ( 0 .. self . label_ribs . len ( ) ) . rev ( ) { let rib = & self . label_ribs [ i ] ; if let MacroDefinition ( def ) = rib . kind { // If an invocation of this macro created `ident`, give up on `ident` // and switch to `ident`'s source from the macro definition. if def == self . r . macro_def ( label . span . ctxt ( ) ) { label . span . remove_mark ( ) ; } } let ident = label . normalize_to_macro_rules ( ) ; if let Some ( ( ident , id ) ) = rib . bindings . get_key_value ( & ident ) { return if self . is_label_valid_from_rib ( i ) { Some ( * id ) } else { self . report_error ( original_span , ResolutionError :: UnreachableLabel { name : label . name , definition_span : ident . span , suggestion , } , ) ; None } ; } // Diagnostics: Check if this rib contains a label with a similar name, keep track of // the first such label that is encountered. suggestion = suggestion . or_else ( | | self . suggestion_for_label_in_rib ( i , label ) ) ; } self . report_error ( original_span , ResolutionError :: UndeclaredLabel { name : label . name , suggestion } , ) ; None }
Searches the current set of local scopes for labels.
Searches the current set of local scopes for labels .
&self
label
Ident
&self
label
Ident