Skip to content

Commit

Permalink
Update toolchain and fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
celinval committed Nov 25, 2023
1 parent de0c793 commit ac9bd83
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
15 changes: 6 additions & 9 deletions kani-compiler/src/kani_middle/reachability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,11 @@ where
.iter()
.filter_map(|item| {
// Only collect monomorphic items.
Instance::try_from(*item)
.ok()
.map(|instance| {
let def_id = rustc_internal::internal(item);
predicate(tcx, def_id)
.then_some(InternalMonoItem::Fn(rustc_internal::internal(&instance)))
})
.flatten()
Instance::try_from(*item).ok().and_then(|instance| {
let def_id = rustc_internal::internal(item);
predicate(tcx, def_id)
.then_some(InternalMonoItem::Fn(rustc_internal::internal(&instance)))
})
})
.collect::<Vec<_>>()
})
Expand Down Expand Up @@ -500,7 +497,7 @@ fn to_fingerprint(tcx: TyCtxt, item: &InternalMonoItem) -> Fingerprint {
}

/// Return whether we should include the item into codegen.
fn should_codegen_locally<'tcx>(instance: &Instance) -> bool {
fn should_codegen_locally(instance: &Instance) -> bool {
!instance.is_foreign_item()
}

Expand Down
33 changes: 15 additions & 18 deletions kani-compiler/src/kani_middle/stubbing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,24 @@ impl<'tcx> MirVisitor for StubConstChecker<'tcx> {
Const::Val(..) | Const::Ty(..) => {}
Const::Unevaluated(un_eval, _) => {
// Thread local fall into this category.
match self.tcx.const_eval_resolve(ParamEnv::reveal_all(), un_eval, None) {
if self.tcx.const_eval_resolve(ParamEnv::reveal_all(), un_eval, None).is_err() {
// The `monomorphize` call should have evaluated that constant already.
Err(_) => {
let tcx = self.tcx;
let mono_const = &un_eval;
let implementor = match mono_const.args.as_slice() {
[one] => one.as_type().unwrap(),
_ => unreachable!(),
};
let trait_ = tcx.trait_of_item(mono_const.def).unwrap();
let msg = format!(
"Type `{implementor}` does not implement trait `{}`. \
let tcx = self.tcx;
let mono_const = &un_eval;
let implementor = match mono_const.args.as_slice() {
[one] => one.as_type().unwrap(),
_ => unreachable!(),
};
let trait_ = tcx.trait_of_item(mono_const.def).unwrap();
let msg = format!(
"Type `{implementor}` does not implement trait `{}`. \
This is likely because `{}` is used as a stub but its \
generic bounds are not being met.",
tcx.def_path_str(trait_),
self.source.name()
);
tcx.sess.span_err(rustc_internal::internal(location.span()), msg);
self.is_valid = false;
}
_ => {}
tcx.def_path_str(trait_),
self.source.name()
);
tcx.sess.span_err(rustc_internal::internal(location.span()), msg);
self.is_valid = false;
}
}
};
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-2023-11-21"
channel = "nightly-2023-11-25"
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

0 comments on commit ac9bd83

Please sign in to comment.