Skip to content

Commit

Permalink
Update toolchain to 2024-10-25
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynzech committed Oct 25, 2024
1 parent ab2cb50 commit 56989db
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
28 changes: 23 additions & 5 deletions kani-compiler/src/kani_middle/stubbing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ use tracing::{debug, trace};
use kani_metadata::HarnessMetadata;
use rustc_hir::def_id::DefId;
use rustc_middle::mir::Const;
use rustc_middle::ty::{self, EarlyBinder, ParamEnv, TyCtxt, TypeFoldable};
use rustc_middle::ty::{
self, ClauseKind, EarlyBinder, GenericPredicates, ParamEnv, TyCtxt, TypeFoldable,
};
use rustc_smir::rustc_internal;
use stable_mir::mir::ConstOperand;
use stable_mir::mir::mono::Instance;
Expand Down Expand Up @@ -46,10 +48,26 @@ pub fn harness_stub_map(
///
/// Note that this has no effect at runtime.
pub fn contract_host_param(tcx: TyCtxt, old_def: FnDef, new_def: FnDef) -> Option<usize> {
let old_generics = tcx.generics_of(rustc_internal::internal(tcx, old_def.def_id()));
let new_generics = tcx.generics_of(rustc_internal::internal(tcx, new_def.def_id()));
if old_generics.host_effect_index.is_some() && new_generics.host_effect_index.is_none() {
old_generics.host_effect_index
let find_host_effect_arg = |generic_predicates: GenericPredicates| {
generic_predicates.predicates.iter().enumerate().find_map(|(idx, (clause, _))| {
if let ClauseKind::HostEffect(..) = clause.kind().skip_binder() {
Some(idx)
} else {
None
}
})
};

let old_generics_predicates =
tcx.predicates_of(rustc_internal::internal(tcx, old_def.def_id()));
let new_generics_predicates =
tcx.predicates_of(rustc_internal::internal(tcx, new_def.def_id()));

let old_generics_host_effect_index = find_host_effect_arg(old_generics_predicates);
let new_generics_host_effect_index = find_host_effect_arg(new_generics_predicates);

if old_generics_host_effect_index.is_some() && new_generics_host_effect_index.is_none() {
old_generics_host_effect_index
} else {
None
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

[toolchain]
channel = "nightly-2024-10-24"
channel = "nightly-2024-10-25"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]

0 comments on commit 56989db

Please sign in to comment.