@@ -963,30 +963,7 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
963
963
/// bounds that must hold on the elided self type. These are derived
964
964
/// from the declarations of `SomeTrait`, `Send`, and friends -- if
965
965
/// they declare `trait SomeTrait : 'static`, for example, then
966
- /// `'static` would appear in the list. The hard work is done by
967
- /// `infer::required_region_bounds`, see that for more information.
968
- pub fn object_region_bounds < ' tcx > (
969
- tcx : TyCtxt < ' tcx > ,
970
- existential_predicates : & ' tcx ty:: List < ty:: PolyExistentialPredicate < ' tcx > > ,
971
- ) -> Vec < ty:: Region < ' tcx > > {
972
- let predicates = existential_predicates. iter ( ) . filter_map ( |predicate| {
973
- if let ty:: ExistentialPredicate :: Projection ( _) = predicate. skip_binder ( ) {
974
- None
975
- } else {
976
- Some ( predicate. with_self_ty ( tcx, tcx. types . trait_object_dummy_self ) )
977
- }
978
- } ) ;
979
-
980
- required_region_bounds ( tcx, tcx. types . trait_object_dummy_self , predicates)
981
- }
982
-
983
- /// Given a set of predicates that apply to an object type, returns
984
- /// the region bounds that the (erased) `Self` type must
985
- /// outlive. Precisely *because* the `Self` type is erased, the
986
- /// parameter `erased_self_ty` must be supplied to indicate what type
987
- /// has been used to represent `Self` in the predicates
988
- /// themselves. This should really be a unique type; `FreshTy(0)` is a
989
- /// popular choice.
966
+ /// `'static` would appear in the list.
990
967
///
991
968
/// N.B., in some cases, particularly around higher-ranked bounds,
992
969
/// this function returns a kind of conservative approximation.
@@ -996,13 +973,14 @@ pub fn object_region_bounds<'tcx>(
996
973
///
997
974
/// Requires that trait definitions have been processed so that we can
998
975
/// elaborate predicates and walk supertraits.
999
- #[ instrument( skip( tcx, predicates) , level = "debug" , ret) ]
1000
- pub ( crate ) fn required_region_bounds < ' tcx > (
976
+ pub fn object_region_bounds < ' tcx > (
1001
977
tcx : TyCtxt < ' tcx > ,
1002
- erased_self_ty : Ty < ' tcx > ,
1003
- predicates : impl Iterator < Item = ty:: Clause < ' tcx > > ,
978
+ existential_predicates : & ' tcx ty:: List < ty:: PolyExistentialPredicate < ' tcx > > ,
1004
979
) -> Vec < ty:: Region < ' tcx > > {
1005
- assert ! ( !erased_self_ty. has_escaping_bound_vars( ) ) ;
980
+ let erased_self_ty = tcx. types . trait_object_dummy_self ;
981
+
982
+ let predicates =
983
+ existential_predicates. iter ( ) . map ( |predicate| predicate. with_self_ty ( tcx, erased_self_ty) ) ;
1006
984
1007
985
traits:: elaborate ( tcx, predicates)
1008
986
. filter_map ( |pred| {
0 commit comments