@@ -1647,26 +1647,29 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1647
1647
let longer_fr_scc = self . constraint_sccs . scc ( longer_fr) ;
1648
1648
debug ! ( "check_bound_universal_region: longer_fr_scc={:?}" , longer_fr_scc, ) ;
1649
1649
1650
- // If we have some bound universal region `'a`, then the only
1651
- // elements it can contain is itself -- we don't know anything
1652
- // else about it!
1653
- let Some ( error_element) = ( {
1654
- self . scc_values . elements_contained_in ( longer_fr_scc) . find ( |element| match element {
1655
- RegionElement :: Location ( _) => true ,
1656
- RegionElement :: RootUniversalRegion ( _) => true ,
1657
- RegionElement :: PlaceholderRegion ( placeholder1) => placeholder != * placeholder1,
1658
- } )
1659
- } ) else {
1660
- return ;
1661
- } ;
1662
- debug ! ( "check_bound_universal_region: error_element = {:?}" , error_element) ;
1650
+ for error_element in self . scc_values . elements_contained_in ( longer_fr_scc) {
1651
+ match error_element {
1652
+ RegionElement :: Location ( _) | RegionElement :: RootUniversalRegion ( _) => { }
1653
+ // If we have some bound universal region `'a`, then the only
1654
+ // elements it can contain is itself -- we don't know anything
1655
+ // else about it!
1656
+ RegionElement :: PlaceholderRegion ( placeholder1) => {
1657
+ if placeholder == placeholder1 {
1658
+ continue ;
1659
+ }
1660
+ }
1661
+ }
1663
1662
1664
- // Find the region that introduced this `error_element`.
1665
- errors_buffer. push ( RegionErrorKind :: BoundUniversalRegionError {
1666
- longer_fr,
1667
- error_element,
1668
- placeholder,
1669
- } ) ;
1663
+ errors_buffer. push ( RegionErrorKind :: BoundUniversalRegionError {
1664
+ longer_fr,
1665
+ error_element,
1666
+ placeholder,
1667
+ } ) ;
1668
+
1669
+ // Stop after the first error, it gets too noisy otherwise, and does not provide more information.
1670
+ break ;
1671
+ }
1672
+ debug ! ( "check_bound_universal_region: all bounds satisfied" ) ;
1670
1673
}
1671
1674
1672
1675
#[ instrument( level = "debug" , skip( self , infcx, errors_buffer) ) ]
0 commit comments