@@ -5,7 +5,7 @@ use rustc_data_structures::binary_search_util;
55use rustc_data_structures:: frozen:: Frozen ;
66use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
77use rustc_data_structures:: graph:: scc:: Sccs ;
8- use rustc_hir:: def_id:: DefId ;
8+ use rustc_hir:: def_id:: { DefId , CRATE_DEF_ID } ;
99use rustc_hir:: CRATE_HIR_ID ;
1010use rustc_index:: vec:: IndexVec ;
1111use rustc_infer:: infer:: canonical:: QueryOutlivesConstraint ;
@@ -2000,8 +2000,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
20002000 let cause_code = path
20012001 . iter ( )
20022002 . find_map ( |constraint| {
2003- if let ConstraintCategory :: Predicate ( def_id, predicate_span) = constraint. category {
2004- Some ( ObligationCauseCode :: BindingObligation ( def_id, predicate_span) )
2003+ if let ConstraintCategory :: Predicate ( predicate_span) = constraint. category {
2004+ // We currentl'y doesn't store the `DefId` in the `ConstraintCategory`
2005+ // for perforamnce reasons. The error reporting code used by NLL only
2006+ // uses the span, so this doesn't cause any problems at the moment.
2007+ Some ( ObligationCauseCode :: BindingObligation (
2008+ CRATE_DEF_ID . to_def_id ( ) ,
2009+ predicate_span,
2010+ ) )
20052011 } else {
20062012 None
20072013 }
@@ -2106,7 +2112,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
21062112 | ConstraintCategory :: Boring
21072113 | ConstraintCategory :: BoringNoLocation
21082114 | ConstraintCategory :: Internal
2109- | ConstraintCategory :: Predicate ( _, _ ) => false ,
2115+ | ConstraintCategory :: Predicate ( _) => false ,
21102116 ConstraintCategory :: TypeAnnotation
21112117 | ConstraintCategory :: Return ( _)
21122118 | ConstraintCategory :: Yield => true ,
@@ -2118,7 +2124,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
21182124 | ConstraintCategory :: Boring
21192125 | ConstraintCategory :: BoringNoLocation
21202126 | ConstraintCategory :: Internal
2121- | ConstraintCategory :: Predicate ( _, _ ) => false ,
2127+ | ConstraintCategory :: Predicate ( _) => false ,
21222128 _ => true ,
21232129 }
21242130 }
0 commit comments