]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/collect.rs
Rollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr
[rust.git] / compiler / rustc_typeck / src / collect.rs
index 504b5a330f00c0b391f98f748c13360261ba70ad..f5418c9e01e4928a0a6f1d86f398e4be369bfba3 100644 (file)
@@ -1693,25 +1693,27 @@ pub fn const_evaluatable_predicates_of<'tcx>(
 ) -> impl Iterator<Item = (ty::Predicate<'tcx>, Span)> {
     #[derive(Default)]
     struct ConstCollector<'tcx> {
-        ct: SmallVec<[(ty::WithOptConstParam<DefId>, SubstsRef<'tcx>); 4]>,
+        ct: SmallVec<[(ty::WithOptConstParam<DefId>, SubstsRef<'tcx>, Span); 4]>,
+        curr_span: Span,
     }
 
     impl<'tcx> TypeVisitor<'tcx> for ConstCollector<'tcx> {
         fn visit_const(&mut self, ct: &'tcx Const<'tcx>) -> bool {
             if let ty::ConstKind::Unevaluated(def, substs, None) = ct.val {
-                self.ct.push((def, substs));
+                self.ct.push((def, substs, self.curr_span));
             }
             false
         }
     }
 
     let mut collector = ConstCollector::default();
-    for (pred, _span) in predicates.predicates.iter() {
+    for &(pred, span) in predicates.predicates.iter() {
+        collector.curr_span = span;
         pred.visit_with(&mut collector);
     }
     warn!("const_evaluatable_predicates_of({:?}) = {:?}", def_id, collector.ct);
-    collector.ct.into_iter().map(move |(def_id, subst)| {
-        (ty::PredicateAtom::ConstEvaluatable(def_id, subst).to_predicate(tcx), DUMMY_SP)
+    collector.ct.into_iter().map(move |(def_id, subst, span)| {
+        (ty::PredicateAtom::ConstEvaluatable(def_id, subst).to_predicate(tcx), span)
     })
 }