]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/instance.rs
InstanceDef::requires_caller_location limited to items.
[rust.git] / src / librustc / ty / instance.rs
index 9be50d19a5030e45b0e56a959ab9cff5ac1945c6..1ea695e40b25556bfb95601e718266cb9395ca30 100644 (file)
@@ -141,7 +141,12 @@ pub fn requires_local(&self, tcx: TyCtxt<'tcx>) -> bool {
     }
 
     pub fn requires_caller_location(&self, tcx: TyCtxt<'_>) -> bool {
-        tcx.codegen_fn_attrs(self.def_id()).flags.contains(CodegenFnAttrFlags::TRACK_CALLER)
+        match *self {
+            InstanceDef::Item(def_id) => {
+                tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::TRACK_CALLER)
+            }
+            _ => false,
+        }
     }
 }