@@ -1610,13 +1610,11 @@ pub mod tls {
16101610
16111611 use crate :: dep_graph:: TaskDeps ;
16121612 use crate :: ty:: query;
1613- use errors:: { Diagnostic , TRACK_DIAGNOSTICS } ;
1613+ use errors:: Diagnostic ;
16141614 use rustc_data_structures:: sync:: { self , Lock , Lrc } ;
16151615 use rustc_data_structures:: thin_vec:: ThinVec ;
16161616 use rustc_data_structures:: OnDrop ;
1617- use std:: fmt;
16181617 use std:: mem;
1619- use syntax_pos;
16201618
16211619 #[ cfg( not( parallel_compiler) ) ]
16221620 use std:: cell:: Cell ;
@@ -1692,58 +1690,6 @@ pub mod tls {
16921690 TLV . with ( |tlv| tlv. get ( ) )
16931691 }
16941692
1695- /// This is a callback from libsyntax as it cannot access the implicit state
1696- /// in librustc otherwise.
1697- fn span_debug ( span : syntax_pos:: Span , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1698- with_opt ( |tcx| {
1699- if let Some ( tcx) = tcx {
1700- write ! ( f, "{}" , tcx. sess. source_map( ) . span_to_string( span) )
1701- } else {
1702- syntax_pos:: default_span_debug ( span, f)
1703- }
1704- } )
1705- }
1706-
1707- /// This is a callback from libsyntax as it cannot access the implicit state
1708- /// in librustc otherwise. It is used to when diagnostic messages are
1709- /// emitted and stores them in the current query, if there is one.
1710- fn track_diagnostic ( diagnostic : & Diagnostic ) {
1711- with_context_opt ( |icx| {
1712- if let Some ( icx) = icx {
1713- if let Some ( ref diagnostics) = icx. diagnostics {
1714- let mut diagnostics = diagnostics. lock ( ) ;
1715- diagnostics. extend ( Some ( diagnostic. clone ( ) ) ) ;
1716- }
1717- }
1718- } )
1719- }
1720-
1721- /// Sets up the callbacks from libsyntax on the current thread.
1722- pub fn with_thread_locals < F , R > ( f : F ) -> R
1723- where
1724- F : FnOnce ( ) -> R ,
1725- {
1726- syntax_pos:: SPAN_DEBUG . with ( |span_dbg| {
1727- let original_span_debug = span_dbg. get ( ) ;
1728- span_dbg. set ( span_debug) ;
1729-
1730- let _on_drop = OnDrop ( move || {
1731- span_dbg. set ( original_span_debug) ;
1732- } ) ;
1733-
1734- TRACK_DIAGNOSTICS . with ( |current| {
1735- let original = current. get ( ) ;
1736- current. set ( track_diagnostic) ;
1737-
1738- let _on_drop = OnDrop ( move || {
1739- current. set ( original) ;
1740- } ) ;
1741-
1742- f ( )
1743- } )
1744- } )
1745- }
1746-
17471693 /// Sets `context` as the new current `ImplicitCtxt` for the duration of the function `f`.
17481694 #[ inline]
17491695 pub fn enter_context < ' a , ' tcx , F , R > ( context : & ImplicitCtxt < ' a , ' tcx > , f : F ) -> R
0 commit comments