@@ -14,7 +14,6 @@ use std::io::{BufWriter, Write, stdout};
1414use std:: path:: PathBuf ;
1515use std:: rc:: Rc ;
1616
17- use rustc_data_structures:: fx:: FxHashSet ;
1817use rustc_hir:: def_id:: { DefId , DefIdSet } ;
1918use rustc_middle:: ty:: TyCtxt ;
2019use rustc_session:: Session ;
@@ -123,58 +122,6 @@ impl<'tcx> JsonRenderer<'tcx> {
123122 }
124123}
125124
126- fn target ( sess : & rustc_session:: Session ) -> types:: Target {
127- // Build a set of which features are enabled on this target
128- let globally_enabled_features: FxHashSet < & str > =
129- sess. unstable_target_features . iter ( ) . map ( |name| name. as_str ( ) ) . collect ( ) ;
130-
131- // Build a map of target feature stability by feature name
132- use rustc_target:: target_features:: Stability ;
133- let feature_stability: FxHashMap < & str , Stability > = sess
134- . target
135- . rust_target_features ( )
136- . iter ( )
137- . copied ( )
138- . map ( |( name, stability, _) | ( name, stability) )
139- . collect ( ) ;
140-
141- types:: Target {
142- triple : sess. opts . target_triple . tuple ( ) . into ( ) ,
143- target_features : sess
144- . target
145- . rust_target_features ( )
146- . iter ( )
147- . copied ( )
148- . filter ( |( _, stability, _) | {
149- // Describe only target features which the user can toggle
150- stability. toggle_allowed ( ) . is_ok ( )
151- } )
152- . map ( |( name, stability, implied_features) | {
153- types:: TargetFeature {
154- name : name. into ( ) ,
155- unstable_feature_gate : match stability {
156- Stability :: Unstable ( feature_gate) => Some ( feature_gate. as_str ( ) . into ( ) ) ,
157- _ => None ,
158- } ,
159- implies_features : implied_features
160- . iter ( )
161- . copied ( )
162- . filter ( |name| {
163- // Imply only target features which the user can toggle
164- feature_stability
165- . get ( name)
166- . map ( |stability| stability. toggle_allowed ( ) . is_ok ( ) )
167- . unwrap_or ( false )
168- } )
169- . map ( String :: from)
170- . collect ( ) ,
171- globally_enabled : globally_enabled_features. contains ( name) ,
172- }
173- } )
174- . collect ( ) ,
175- }
176- }
177-
178125impl < ' tcx > JsonRenderer < ' tcx > {
179126 pub ( crate ) fn init (
180127 krate : clean:: Crate ,
@@ -317,7 +264,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
317264 // multiple targets: https://github.com/rust-lang/rust/pull/137632
318265 //
319266 // We want to describe a single target, so pass tcx.sess rather than tcx.
320- let target = target ( self . tcx . sess ) ;
267+ let target = conversions :: target ( self . tcx . sess ) ;
321268
322269 debug ! ( "Constructing Output" ) ;
323270 let output_crate = types:: Crate {
0 commit comments