Arrange methods on HirTyLowerer more logically
This makes it easier to read the trait definition for newcomers: Sorted from least “complex” to most “complex” followed by trivial “plumbing” and grouped by area. * Move `allow_infer` above all `*_infer` methods * It's the least complex method of those * Allows the `*_infer` to be placed right next to each other * Move `probe_ty_param_bounds` further down right next to `lower_assoc_ty` and `probe_adt` * It's more complex than the `infer` methods, it should come “later” * Now all required lowering functions are grouped together * Move the “plumbing” function `set_tainted_by_errors` further down below any actual lowering methods. * Provided method should come last
This commit is contained in:
parent
6d5a93949a
commit
72472c831c
3 changed files with 72 additions and 72 deletions
|
@ -372,23 +372,14 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
|
|||
self.item_def_id.to_def_id()
|
||||
}
|
||||
|
||||
fn probe_ty_param_bounds(
|
||||
&self,
|
||||
span: Span,
|
||||
def_id: LocalDefId,
|
||||
assoc_name: Ident,
|
||||
) -> ty::GenericPredicates<'tcx> {
|
||||
self.tcx.at(span).type_param_predicates((self.item_def_id, def_id, assoc_name))
|
||||
fn allow_infer(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn re_infer(&self, _: Option<&ty::GenericParamDef>, _: Span) -> Option<ty::Region<'tcx>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn allow_infer(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn ty_infer(&self, _: Option<&ty::GenericParamDef>, span: Span) -> Ty<'tcx> {
|
||||
Ty::new_error_with_message(self.tcx(), span, "bad placeholder type")
|
||||
}
|
||||
|
@ -403,6 +394,15 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
|
|||
ty::Const::new_error_with_message(self.tcx(), ty, span, "bad placeholder constant")
|
||||
}
|
||||
|
||||
fn probe_ty_param_bounds(
|
||||
&self,
|
||||
span: Span,
|
||||
def_id: LocalDefId,
|
||||
assoc_name: Ident,
|
||||
) -> ty::GenericPredicates<'tcx> {
|
||||
self.tcx.at(span).type_param_predicates((self.item_def_id, def_id, assoc_name))
|
||||
}
|
||||
|
||||
fn lower_assoc_ty(
|
||||
&self,
|
||||
span: Span,
|
||||
|
@ -496,10 +496,6 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
|
|||
ty.ty_adt_def()
|
||||
}
|
||||
|
||||
fn set_tainted_by_errors(&self, err: ErrorGuaranteed) {
|
||||
self.tainted_by_errors.set(Some(err));
|
||||
}
|
||||
|
||||
fn record_ty(&self, _hir_id: hir::HirId, _ty: Ty<'tcx>, _span: Span) {
|
||||
// There's no place to record types from signatures?
|
||||
}
|
||||
|
@ -507,6 +503,10 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
|
|||
fn infcx(&self) -> Option<&InferCtxt<'tcx>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn set_tainted_by_errors(&self, err: ErrorGuaranteed) {
|
||||
self.tainted_by_errors.set(Some(err));
|
||||
}
|
||||
}
|
||||
|
||||
/// Synthesize a new lifetime name that doesn't clash with any of the lifetimes already present.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue