Change:
<ins> //! Bounds are restrictions applied to some types after they've been converted into the //! `ty` form from the HIR. use rustc_hir::Constness; use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, WithConstness}; use rustc_span::Span; /// Collects together a list of type bounds. These lists of bounds occur in many places /// in Rust's syntax: /// /// ```text /// trait Foo: Bar + Baz { } ///            ^^^^^^^^^ supertrait list bounding the `Self` type parameter /// /// fn foo<T: Bar + Baz>() { } ///           ^^^^^^^^^ bounding the type parameter `T` /// /// impl dyn Bar + Baz ///          ^^^^^^^^^ bounding the forgotten dynamic type /// ``` /// /// Our representation is a bit mixed here -- in some cases, we /// include the self type (e.g., `trait_bounds`) but in others we do not #[derive(Default, PartialEq, Eq, Clone, Debug)] pub struct Bounds<'tcx> { /// A list of region bounds on the (implicit) self type. So if you /// had `T: 'a + 'b` this might would be a list `['a, 'b]` (but /// the `T` is not explicitly included). pub region_bounds: Vec<(ty::Region<'tcx>, Span)>, /// A list of trait bounds. So if you had `T: Debug` this would be /// `T: Debug`. Note that the self-type is explicit here. pub trait_bounds: Vec<(ty::PolyTraitRef<'tcx>, Span, Constness)>, /// A list of projection equality bounds. So if you had `T: /// Iterator<Item = u32>` this would include `<T as /// Iterator>::Item => u32`. Note that the self-type is explicit /// here. pub projection_bounds: Vec<(ty::PolyProjectionPredicate<'tcx>, Span)>, /// `Some` if there is *no* `?Sized` predicate. The `span` /// is the location in the source of the `T` declaration which can /// be cited as the source of the `T: Sized` requirement. pub implicitly_sized: Option<Span>, } impl<'tcx> Bounds<'tcx> { /// Converts a bounds list into a flat set of predicates (like /// where-clauses). Because some of our bounds listings (e.g., /// regions) don't include the self-type, you must supply the /// self-type here (the `param_ty` parameter). pub fn predicates( &self, tcx: TyCtxt<'tcx>, param_ty: Ty<'tcx>, ) -> Vec<(ty::Predicate<'tcx>, Span)> { // If it could be sized, and is, add the `Sized` predicate. let sized_predicate = self.implicitly_sized.and_then(|span| { tcx.lang_items().sized_trait().map(|sized| { let trait_ref = ty::Binder::bind(ty::TraitRef { def_id: sized, substs: tcx.mk_substs_trait(param_ty, &[]), }); (trait_ref.without_const().to_predicate(tcx), span) }) }); sized_predicate .into_iter() .chain( self.region_bounds .iter() .map(|&(region_bound, span)| { // Account for the binder being introduced below; no need to shift `param_ty` // because, at present at least, it either only refers to early-bound regions, // or it's a generic associated type that deliberately has escaping bound vars. let region_bound = ty::fold::shift_region(tcx, region_bound, 1); let outlives = ty::OutlivesPredicate(param_ty, region_bound); (ty::Binder::bind(outlives).to_predicate(tcx), span) }) .chain(self.trait_bounds.iter().map(|&(bound_trait_ref, span, constness)| { let predicate = bound_trait_ref.with_constness(constness).to_predicate(tcx); (predicate, span) })) .chain( self.projection_bounds .iter() .map(|&(projection, span)| (projection.to_predicate(tcx), span)), ), ) .collect() } } </ins>

Discussion:
That file () has almost 3k LOC and just 3 lines of documentation on the file (methods and types are documented though). I'm entirely unsure how to process that file. I think splitting it up into submodules (e.g. start by extracting out all functions just handling error reporting into a separate module). Some of this work can be just mechanical splitting up, but some parts may require you to start understanding at least some of what's going on in the file in order to find a good module structure. cc <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
I'll do it, although I am not familiar with the . At least the mechanical part is no problem. As to the model structure, I am going to dive into that issue so I can better think of a reasonable structure. If it is a problem that I am not familiar with the topic, I will back down, no worries.
That's awesome. Please wait until is merged though (you can subscribe to it so you see when it does get merged), because otherwise you'll just get loads of conflicts.
If you are unsure about the module structure, you can first post a design suggestion here if you want.
assign
You still working on this?
Not quite, my other PR is not yet through and I thought I wait for it. But if you want to do it, just take it. If not I'll be on it soon.
I would like to claim this, if nobody minds
assign It's all yours!
release-assignment
I'd like to work in this if is not on it anymore
generally it's fine if it's 3 months and there is no pr from the author. you can start working on it
Gotcha, thanks
claim