@@ -23,14 +23,15 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation};
2323use  llvm; 
2424use  llvm:: { ModuleRef ,  ContextRef ,  ValueRef } ; 
2525use  llvm:: debuginfo:: { DIFile ,  DIType ,  DIScope ,  DIBuilderRef ,  DISubprogram ,  DIArray ,  DIFlags } ; 
26+ use  rustc:: hir:: TransFnAttrFlags ; 
2627use  rustc:: hir:: def_id:: { DefId ,  CrateNum } ; 
2728use  rustc:: ty:: subst:: Substs ; 
2829
2930use  abi:: Abi ; 
3031use  common:: CodegenCx ; 
3132use  builder:: Builder ; 
3233use  monomorphize:: Instance ; 
33- use  rustc:: ty:: { self ,  ParamEnv ,  Ty } ; 
34+ use  rustc:: ty:: { self ,  ParamEnv ,  Ty ,   InstanceDef } ; 
3435use  rustc:: mir; 
3536use  rustc:: session:: config:: { self ,  FullDebugInfo ,  LimitedDebugInfo ,  NoDebugInfo } ; 
3637use  rustc:: util:: nodemap:: { DefIdMap ,  FxHashMap ,  FxHashSet } ; 
@@ -210,13 +211,12 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
210211        return  FunctionDebugContext :: DebugInfoDisabled ; 
211212    } 
212213
213-     for  attr  in   instance. def . attrs ( cx . tcx ) . iter ( )  { 
214-         if  attr . check_name ( "no_debug" )  { 
214+     if   let   InstanceDef :: Item ( def_id )  =  instance. def  { 
215+         if  cx . tcx . trans_fn_attrs ( def_id ) . flags . contains ( TransFnAttrFlags :: NO_DEBUG )  { 
215216            return  FunctionDebugContext :: FunctionWithoutDebugInfo ; 
216217        } 
217218    } 
218219
219-     let  containing_scope = get_containing_scope ( cx,  instance) ; 
220220    let  span = mir. span ; 
221221
222222    // This can be the case for functions inlined from another crate 
@@ -226,6 +226,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
226226    } 
227227
228228    let  def_id = instance. def_id ( ) ; 
229+     let  containing_scope = get_containing_scope ( cx,  instance) ; 
229230    let  loc = span_start ( cx,  span) ; 
230231    let  file_metadata = file_metadata ( cx,  & loc. file . name ,  def_id. krate ) ; 
231232
0 commit comments