Skip to content

Commit

Permalink
Replace rustc_middle_ty::Const::try_eval_target_usize
Browse files Browse the repository at this point in the history
The method is removed, so replace try_eval_target_usize
with a normalization (with param_env so it works generically) and
conversion.
  • Loading branch information
nbdd0121 committed Oct 22, 2024
1 parent 9f5949f commit 6c25def
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/preempt_count/adjustment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ memoize!(

ty::Array(elem_ty, size) => {
let size = size
.try_eval_target_usize(cx.tcx, param_env)
.normalize_internal(cx.tcx, param_env)
.try_to_target_usize(cx.tcx)
.ok_or(Error::TooGeneric);
if size == Ok(0) {
return Ok(0);
Expand Down
6 changes: 4 additions & 2 deletions src/preempt_count/expectation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ impl<'tcx> AnalysisCtxt<'tcx> {

let elem_adj = self.drop_adjustment(param_and_elem_ty)?;
let size = size
.try_eval_target_usize(self.tcx, param_env)
.normalize_internal(self.tcx, param_env)
.try_to_target_usize(self.tcx)
.ok_or(Error::TooGeneric)?;
let Ok(size) = i32::try_from(size) else {
return Ok(());
Expand Down Expand Up @@ -743,7 +744,8 @@ memoize!(

ty::Array(elem_ty, size) => {
let size = size
.try_eval_target_usize(cx.tcx, param_env)
.normalize_internal(cx.tcx, param_env)
.try_to_target_usize(cx.tcx)
.ok_or(Error::TooGeneric);
if size == Ok(0) {
return Ok(ExpectationRange::top());
Expand Down

0 comments on commit 6c25def

Please sign in to comment.