@@ -11,10 +11,10 @@ use itertools::Itertools;
1111use rspirv:: spirv:: { FunctionControl , LinkageType , StorageClass , Word } ;
1212use rustc_abi:: Align ;
1313use rustc_codegen_ssa:: traits:: { PreDefineCodegenMethods , StaticCodegenMethods } ;
14- use rustc_hir:: attrs:: InlineAttr ;
14+ use rustc_hir:: attrs:: { InlineAttr , Linkage } ;
1515use rustc_middle:: bug;
1616use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , CodegenFnAttrs } ;
17- use rustc_middle:: mir:: mono:: { Linkage , MonoItem , Visibility } ;
17+ use rustc_middle:: mir:: mono:: { MonoItem , Visibility } ;
1818use rustc_middle:: ty:: layout:: { FnAbiOf , LayoutOf } ;
1919use rustc_middle:: ty:: { self , Instance , TypeVisitableExt , TypingEnv } ;
2020use rustc_span:: Span ;
@@ -166,29 +166,38 @@ impl<'tcx> CodegenCx<'tcx> {
166166 }
167167 }
168168
169- // Check if this is a From trait implementation
170- if let Some ( impl_def_id) = self . tcx . impl_of_assoc ( def_id)
171- && let Some ( trait_ref) = self . tcx . impl_trait_ref ( impl_def_id)
172- {
173- let trait_def_id = trait_ref. skip_binder ( ) . def_id ;
174-
175- // Check if this is the From trait.
176- let trait_path = self . tcx . def_path_str ( trait_def_id) ;
177- if matches ! (
178- trait_path. as_str( ) ,
179- "core::convert::From" | "std::convert::From"
180- ) {
181- // Extract the source and target types from the trait substitutions
182- let trait_args = trait_ref. skip_binder ( ) . args ;
183- if let ( Some ( target_ty) , Some ( source_ty) ) =
184- ( trait_args. types ( ) . nth ( 0 ) , trait_args. types ( ) . nth ( 1 ) )
185- {
186- self . from_trait_impls
187- . borrow_mut ( )
188- . insert ( def_id, ( source_ty, target_ty) ) ;
189- }
190- }
191- }
169+ // FIXME: This code ICEs
170+ // // Check if this is a From trait implementation
171+ // if let Some(impl_def_id) = self.tcx.impl_of_assoc(def_id)
172+ // && let Some(local_def_id) = def_id.as_local()
173+ // && self
174+ // .tcx
175+ // .hir_expect_item(local_def_id)
176+ // .expect_impl()
177+ // .of_trait
178+ // .is_some()
179+ // // && let Some(trait_ref) = self.tcx.impl_trait_ref(impl_def_id)
180+ // {
181+ // let trait_ref = self.tcx.impl_trait_ref(impl_def_id);
182+ // let trait_def_id = trait_ref.skip_binder().def_id;
183+
184+ // // Check if this is the From trait.
185+ // let trait_path = self.tcx.def_path_str(trait_def_id);
186+ // if matches!(
187+ // trait_path.as_str(),
188+ // "core::convert::From" | "std::convert::From"
189+ // ) {
190+ // // Extract the source and target types from the trait substitutions
191+ // let trait_args = trait_ref.skip_binder().args;
192+ // if let (Some(target_ty), Some(source_ty)) =
193+ // (trait_args.types().nth(0), trait_args.types().nth(1))
194+ // {
195+ // self.from_trait_impls
196+ // .borrow_mut()
197+ // .insert(def_id, (source_ty, target_ty));
198+ // }
199+ // }
200+ // }
192201
193202 if [
194203 self . tcx . lang_items ( ) . panic_fn ( ) ,
0 commit comments