Skip to content

Commit

Permalink
Remove Candidate::source_info
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiasko committed Nov 5, 2021
1 parent 7bc827b commit 59edb9d
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions compiler/rustc_const_eval/src/transform/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Local, TempState>,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 59edb9d

Please sign in to comment.