pub fn span(&self, hir_map: &hir_map::Map) -> Option<Span> {
        match hir_map.find(self.node_id()) {
            Some(hir_map::NodeBlock(ref blk)) => {
                match *self {
                    CodeExtent::CallSiteScope(_) |
                    CodeExtent::ParameterScope(_) |
                    CodeExtent::Misc(_) |
                    CodeExtent::DestructionScope(_) => Some(blk.span),

                    CodeExtent::Remainder(r) => {
                        assert_eq!(r.block, blk.id);
                        // Want span for extent starting after the
                        // indexed statement and ending at end of
                        // `blk`; reuse span of `blk` and shift `lo`
                        // forward to end of indexed statement.
                        //
                        // (This is the special case aluded to in the
                        // doc-comment for this method)
                        let stmt_span = blk.stmts[r.first_statement_index as usize].span;
                        Some(Span { lo: stmt_span.hi, hi: blk.span.hi, ctxt: stmt_span.ctxt })
                    }
                }
            }
            Some(hir_map::NodeExpr(ref expr)) => Some(expr.span),
            Some(hir_map::NodeStmt(ref stmt)) => Some(stmt.span),
            Some(hir_map::NodeItem(ref item)) => Some(item.span),
            Some(_) | None => None,
         }
    }
/// Returns the span of this CodeExtent.  Note that in general the
/// returned span may not correspond to the span of any node id in
/// the AST.
Returns the span of this CodeExtent.  Note that in general the
returned span may not correspond to the span of any node id in
the AST.
Returns the span of this CodeExtent . Note that in general the returned span may not correspond to the span of any node id in the AST .
pub fn span(&self, hir_map: &hir_map::Map) -> Option<Span> {
        match hir_map.find(self.node_id()) {
            Some(hir_map::NodeBlock(ref blk)) => {
                match *self {
                    CodeExtent::CallSiteScope(_) |
                    CodeExtent::ParameterScope(_) |
                    CodeExtent::Misc(_) |
                    CodeExtent::DestructionScope(_) => Some(blk.span),
                    CodeExtent::Remainder(r) => {
                        assert_eq!(r.block, blk.id);
                        // Want span for extent starting after the
                        // indexed statement and ending at end of
                        // `blk`; reuse span of `blk` and shift `lo`
                        // forward to end of indexed statement.
                        //
                        // (This is the special case aluded to in the
                        // doc-comment for this method)
                        let stmt_span = blk.stmts[r.first_statement_index as usize].span;
                        Some(Span { lo: stmt_span.hi, hi: blk.span.hi, ctxt: stmt_span.ctxt })
                    }
                }
            }
            Some(hir_map::NodeExpr(ref expr)) => Some(expr.span),
            Some(hir_map::NodeStmt(ref stmt)) => Some(stmt.span),
            Some(hir_map::NodeItem(ref item)) => Some(item.span),
            Some(_) | None => None,
         }
    }
pub fn span ( & self , hir_map : & hir_map :: Map ) -> Option < Span > { match hir_map . find ( self . node_id ( ) ) { Some ( hir_map :: NodeBlock ( ref blk ) ) => { match * self { CodeExtent :: CallSiteScope ( _ ) | CodeExtent :: ParameterScope ( _ ) | CodeExtent :: Misc ( _ ) | CodeExtent :: DestructionScope ( _ ) => Some ( blk . span ) , CodeExtent :: Remainder ( r ) => { assert_eq ! ( r block blk id ) ; // Want span for extent starting after the // indexed statement and ending at end of // `blk`; reuse span of `blk` and shift `lo` // forward to end of indexed statement. // // (This is the special case aluded to in the // doc-comment for this method) let stmt_span = blk . stmts [ r . first_statement_index as usize ] . span ; Some ( Span { lo : stmt_span . hi , hi : blk . span . hi , ctxt : stmt_span . ctxt } ) } } } Some ( hir_map :: NodeExpr ( ref expr ) ) => Some ( expr . span ) , Some ( hir_map :: NodeStmt ( ref stmt ) ) => Some ( stmt . span ) , Some ( hir_map :: NodeItem ( ref item ) ) => Some ( item . span ) , Some ( _ ) | None => None , } }
Returns the span of this CodeExtent.
Returns the span of this CodeExtent .
&self
hir_map
&hir_map::Map
&self
hir_map
&hir_map::Map