@@ -3,7 +3,6 @@ use crate::ty::subst::SubstsRef;
3
3
use crate :: ty:: { self , TyCtxt } ;
4
4
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
5
5
use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
6
- use std:: cmp;
7
6
use std:: mem;
8
7
9
8
/// The SymbolExportLevel of a symbols specifies from which kinds of crates
@@ -43,43 +42,6 @@ impl<'tcx> ExportedSymbol<'tcx> {
43
42
ExportedSymbol :: NoDefId ( symbol_name) => symbol_name,
44
43
}
45
44
}
46
-
47
- pub fn compare_stable ( & self , tcx : TyCtxt < ' tcx > , other : & ExportedSymbol < ' tcx > ) -> cmp:: Ordering {
48
- match * self {
49
- ExportedSymbol :: NonGeneric ( self_def_id) => match * other {
50
- ExportedSymbol :: NonGeneric ( other_def_id) => {
51
- tcx. def_path_hash ( self_def_id) . cmp ( & tcx. def_path_hash ( other_def_id) )
52
- }
53
- ExportedSymbol :: Generic ( ..) | ExportedSymbol :: NoDefId ( _) => cmp:: Ordering :: Less ,
54
- } ,
55
- ExportedSymbol :: Generic ( self_def_id, self_substs) => match * other {
56
- ExportedSymbol :: NonGeneric ( _) => cmp:: Ordering :: Greater ,
57
- ExportedSymbol :: Generic ( other_def_id, other_substs) => {
58
- // We compare the symbol names because they are cached as query
59
- // results which makes them relatively cheap to access repeatedly.
60
- //
61
- // It might be even faster to build a local cache of stable IDs
62
- // for sorting. Exported symbols are really only sorted once
63
- // in order to make the `exported_symbols` query result stable.
64
- let self_symbol_name =
65
- tcx. symbol_name ( ty:: Instance :: new ( self_def_id, self_substs) ) ;
66
- let other_symbol_name =
67
- tcx. symbol_name ( ty:: Instance :: new ( other_def_id, other_substs) ) ;
68
-
69
- self_symbol_name. cmp ( & other_symbol_name)
70
- }
71
- ExportedSymbol :: NoDefId ( _) => cmp:: Ordering :: Less ,
72
- } ,
73
- ExportedSymbol :: NoDefId ( self_symbol_name) => match * other {
74
- ExportedSymbol :: NonGeneric ( _) | ExportedSymbol :: Generic ( ..) => {
75
- cmp:: Ordering :: Greater
76
- }
77
- ExportedSymbol :: NoDefId ( ref other_symbol_name) => {
78
- self_symbol_name. cmp ( other_symbol_name)
79
- }
80
- } ,
81
- }
82
- }
83
45
}
84
46
85
47
pub fn metadata_symbol_name ( tcx : TyCtxt < ' _ > ) -> String {
0 commit comments