From 59edb9d38280eed96a3012f3ea2a46cb8c254218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 5 Nov 2021 00:00:00 +0000 Subject: [PATCH] Remove `Candidate::source_info` --- compiler/rustc_const_eval/src/transform/promote_consts.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs index da0c10dc4ee..a92b20f5cb5 100644 --- a/compiler/rustc_const_eval/src/transform/promote_consts.rs +++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs @@ -97,12 +97,6 @@ pub struct Candidate { location: Location, } -impl Candidate { - fn source_info(&self, body: &Body<'_>) -> SourceInfo { - *body.source_info(self.location) - } -} - struct Collector<'a, 'tcx> { ccx: &'a ConstCx<'a, 'tcx>, temps: IndexVec, @@ -969,7 +963,7 @@ pub fn promote_candidates<'tcx>( // Declare return place local so that `mir::Body::new` doesn't complain. let initial_locals = iter::once(LocalDecl::new(tcx.types.never, body.span)).collect(); - let mut scope = body.source_scopes[candidate.source_info(body).scope].clone(); + let mut scope = body.source_scopes[body.source_info(candidate.location).scope].clone(); scope.parent_scope = None; let promoted = Body::new(