@@ -5,7 +5,7 @@ use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
5
5
use rustc:: middle:: exported_symbols:: { metadata_symbol_name, ExportedSymbol , SymbolExportLevel } ;
6
6
use rustc:: session:: config:: { self , Sanitizer } ;
7
7
use rustc:: ty:: query:: Providers ;
8
- use rustc:: ty:: subst:: SubstsRef ;
8
+ use rustc:: ty:: subst:: { GenericArgKind , SubstsRef } ;
9
9
use rustc:: ty:: Instance ;
10
10
use rustc:: ty:: { SymbolName , TyCtxt } ;
11
11
use rustc_codegen_utils:: symbol_names;
@@ -248,19 +248,31 @@ fn exported_symbols_provider_local(
248
248
continue ;
249
249
}
250
250
251
- if let & MonoItem :: Fn ( Instance { def : InstanceDef :: Item ( def_id) , substs } ) = mono_item {
252
- if substs. non_erasable_generics ( ) . next ( ) . is_some ( ) {
253
- symbols
254
- . push ( ( ExportedSymbol :: Generic ( def_id, substs) , SymbolExportLevel :: Rust ) ) ;
251
+ match * mono_item {
252
+ MonoItem :: Fn ( Instance { def : InstanceDef :: Item ( def_id) , substs } ) => {
253
+ if substs. non_erasable_generics ( ) . next ( ) . is_some ( ) {
254
+ let symbol = ExportedSymbol :: Generic ( def_id, substs) ;
255
+ symbols. push ( ( symbol, SymbolExportLevel :: Rust ) ) ;
256
+ }
257
+ }
258
+ MonoItem :: Fn ( Instance { def : InstanceDef :: DropGlue ( def_id, Some ( ty) ) , substs } ) => {
259
+ // A little sanity-check
260
+ debug_assert_eq ! (
261
+ substs. non_erasable_generics( ) . next( ) ,
262
+ Some ( GenericArgKind :: Type ( ty) )
263
+ ) ;
264
+ let symbol = ExportedSymbol :: Generic ( def_id, substs) ;
265
+ symbols. push ( ( symbol, SymbolExportLevel :: Rust ) ) ;
266
+ }
267
+ _ => {
268
+ // Any other symbols don't qualify for sharing
255
269
}
256
270
}
257
271
}
258
272
}
259
273
260
274
// Sort so we get a stable incr. comp. hash.
261
- symbols. sort_unstable_by ( |& ( ref symbol1, ..) , & ( ref symbol2, ..) | {
262
- symbol1. compare_stable ( tcx, symbol2)
263
- } ) ;
275
+ symbols. sort_by_cached_key ( |s| s. 0 . symbol_name_for_local_instance ( tcx) ) ;
264
276
265
277
Arc :: new ( symbols)
266
278
}
0 commit comments