@@ -26,7 +26,7 @@ use lint::{self, Lint};
2626use ich:: { StableHashingContext , NodeIdHashingMode } ;
2727use infer:: canonical:: { CanonicalVarInfo , CanonicalVarInfos } ;
2828use infer:: outlives:: free_region_map:: FreeRegionMap ;
29- use middle:: cstore:: { CrateStore , LinkMeta } ;
29+ use middle:: cstore:: { CrateStoreDyn , LinkMeta } ;
3030use middle:: cstore:: EncodedMetadata ;
3131use middle:: lang_items;
3232use middle:: resolve_lifetime:: { self , ObjectLifetimeDefault } ;
@@ -852,7 +852,7 @@ pub struct GlobalCtxt<'tcx> {
852852 global_arenas : & ' tcx GlobalArenas < ' tcx > ,
853853 global_interners : CtxtInterners < ' tcx > ,
854854
855- cstore : & ' tcx dyn CrateStore ,
855+ cstore : & ' tcx CrateStoreDyn ,
856856
857857 pub sess : & ' tcx Session ,
858858
@@ -1188,7 +1188,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
11881188 /// value (types, substs, etc.) can only be used while `ty::tls` has a valid
11891189 /// reference to the context, to allow formatting values that need it.
11901190 pub fn create_and_enter < F , R > ( s : & ' tcx Session ,
1191- cstore : & ' tcx dyn CrateStore ,
1191+ cstore : & ' tcx CrateStoreDyn ,
11921192 local_providers : ty:: maps:: Providers < ' tcx > ,
11931193 extern_providers : ty:: maps:: Providers < ' tcx > ,
11941194 arenas : & ' tcx AllArenas < ' tcx > ,
@@ -1800,9 +1800,11 @@ pub mod tls {
18001800 /// in librustc otherwise. It is used to when diagnostic messages are
18011801 /// emitted and stores them in the current query, if there is one.
18021802 fn track_diagnostic ( diagnostic : & Diagnostic ) {
1803- with_context ( |context| {
1804- if let Some ( ref query) = context. query {
1805- query. diagnostics . lock ( ) . push ( diagnostic. clone ( ) ) ;
1803+ with_context_opt ( |icx| {
1804+ if let Some ( icx) = icx {
1805+ if let Some ( ref query) = icx. query {
1806+ query. diagnostics . lock ( ) . push ( diagnostic. clone ( ) ) ;
1807+ }
18061808 }
18071809 } )
18081810 }
0 commit comments