pub fn with_source_map<T, F: FnOnce() -> T>(source_map: Lrc<SourceMap>, f: F) -> T {
    SESSION_GLOBALS.with(|session_globals| {
        *session_globals.source_map.borrow_mut() = Some(source_map);
    });
    struct ClearSourceMap;
    impl Drop for ClearSourceMap {
        fn drop(&mut self) {
            SESSION_GLOBALS.with(|session_globals| {
                session_globals.source_map.borrow_mut().take();
            });
        }
    }

    let _guard = ClearSourceMap;
    f()
}
/// Calls the provided closure, using the provided `SourceMap` to format
/// any spans that are debug-printed during the closure'e exectuino.
///
/// Normally, the global `TyCtxt` is used to retrieve the `SourceMap`
/// (see `rustc_interface::callbacks::span_debug1). However, some parts
/// of the compiler (e.g. `rustc_parse`) may debug-print `Span`s before
/// a `TyCtxt` is available. In this case, we fall back to
/// the `SourceMap` provided to this function. If that is not available,
/// we fall back to printing the raw `Span` field values
Calls the provided closure, using the provided `SourceMap` to format
any spans that are debug-printed during the closure'e exectuino.


Calls the provided closure using the provided ` SourceMap ` to format any spans that are debug - printed during the closure ' e exectuino .
pub fn with_source_map<T, F: FnOnce() -> T>(source_map: Lrc<SourceMap>, f: F) -> T {
    SESSION_GLOBALS.with(|session_globals| {
        *session_globals.source_map.borrow_mut() = Some(source_map);
    });
    struct ClearSourceMap;
    impl Drop for ClearSourceMap {
        fn drop(&mut self) {
            SESSION_GLOBALS.with(|session_globals| {
                session_globals.source_map.borrow_mut().take();
            });
        }
    }
    let _guard = ClearSourceMap;
    f()
}
pub fn with_source_map < T , F : FnOnce ( ) -> T > ( source_map : Lrc < SourceMap > , f : F ) -> T { SESSION_GLOBALS . with ( | session_globals | { * session_globals . source_map . borrow_mut ( ) = Some ( source_map ) ; } ) ; struct ClearSourceMap ; impl Drop for ClearSourceMap { fn drop ( & mut self ) { SESSION_GLOBALS . with ( | session_globals | { session_globals . source_map . borrow_mut ( ) . take ( ) ; } ) ; } } let _guard = ClearSourceMap ; f ( ) }
Calls the provided closure, using the provided `SourceMap` to format
any spans that are debug-printed during the closure'e exectuino.
Calls the provided closure using the provided ` SourceMap ` to format any spans that are debug - printed during the closure ' e exectuino .
source_map
Lrc<SourceMap>
f
F
source_map
Lrc<SourceMap>
f
F