Don't pass universal_regions unnecessarily.

`TypeChecker` already has it in a field.
This commit is contained in:
Nicholas Nethercote 2024-10-29 09:23:57 +11:00
parent b71fb5edc0
commit 4c8a23ab0d
2 changed files with 5 additions and 6 deletions

View File

@ -19,7 +19,7 @@ use tracing::{debug, instrument};
use super::{Locations, TypeChecker}; use super::{Locations, TypeChecker};
use crate::renumber::RegionCtxt; use crate::renumber::RegionCtxt;
use crate::universal_regions::{DefiningTy, UniversalRegions}; use crate::universal_regions::DefiningTy;
impl<'a, 'tcx> TypeChecker<'a, 'tcx> { impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
/// Check explicit closure signature annotation, /// Check explicit closure signature annotation,
@ -124,11 +124,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
); );
} }
#[instrument(skip(self, body, universal_regions), level = "debug")] #[instrument(skip(self, body), level = "debug")]
pub(super) fn equate_inputs_and_outputs( pub(super) fn equate_inputs_and_outputs(
&mut self, &mut self,
body: &Body<'tcx>, body: &Body<'tcx>,
universal_regions: &UniversalRegions<'tcx>,
normalized_inputs_and_output: &[Ty<'tcx>], normalized_inputs_and_output: &[Ty<'tcx>],
) { ) {
let (&normalized_output_ty, normalized_input_tys) = let (&normalized_output_ty, normalized_input_tys) =
@ -161,7 +160,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if let Some(mir_yield_ty) = body.yield_ty() { if let Some(mir_yield_ty) = body.yield_ty() {
let yield_span = body.local_decls[RETURN_PLACE].source_info.span; let yield_span = body.local_decls[RETURN_PLACE].source_info.span;
self.equate_normalized_input_or_output( self.equate_normalized_input_or_output(
universal_regions.yield_ty.unwrap(), self.universal_regions.yield_ty.unwrap(),
mir_yield_ty, mir_yield_ty,
yield_span, yield_span,
); );
@ -170,7 +169,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
if let Some(mir_resume_ty) = body.resume_ty() { if let Some(mir_resume_ty) = body.resume_ty() {
let yield_span = body.local_decls[RETURN_PLACE].source_info.span; let yield_span = body.local_decls[RETURN_PLACE].source_info.span;
self.equate_normalized_input_or_output( self.equate_normalized_input_or_output(
universal_regions.resume_ty.unwrap(), self.universal_regions.resume_ty.unwrap(),
mir_resume_ty, mir_resume_ty,
yield_span, yield_span,
); );

View File

@ -180,7 +180,7 @@ pub(crate) fn type_check<'a, 'tcx>(
verifier.visit_body(body); verifier.visit_body(body);
checker.typeck_mir(body); checker.typeck_mir(body);
checker.equate_inputs_and_outputs(body, &universal_regions, &normalized_inputs_and_output); checker.equate_inputs_and_outputs(body, &normalized_inputs_and_output);
checker.check_signature_annotation(body); checker.check_signature_annotation(body);
liveness::generate(&mut checker, body, &elements, flow_inits, move_data); liveness::generate(&mut checker, body, &elements, flow_inits, move_data);