Skip to content

Commit

Permalink
Upgrade toolchain to nightly-2024-01-17 (#2976)
Browse files Browse the repository at this point in the history
Fixes were done to address the following upstream changes:

- rust-lang/rust#119606
- rust-lang/rust#119751
- rust-lang/rust#120025
- rust-lang/rust#116520

Resolves #2971 

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
  • Loading branch information
celinval committed Jan 18, 2024
1 parent fd12a28 commit b349137
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
6 changes: 5 additions & 1 deletion kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,11 @@ impl<'tcx> GotocCtx<'tcx> {
kind: ty::BoundRegionKind::BrEnv,
};
let env_region = ty::Region::new_bound(self.tcx, ty::INNERMOST, br);
let env_ty = self.tcx.closure_env_ty(def_id, args, env_region).unwrap();
let env_ty = self.tcx.closure_env_ty(
Ty::new_closure(self.tcx, def_id, args),
args.as_closure().kind(),
env_region,
);

let sig = sig.skip_binder();

Expand Down
2 changes: 1 addition & 1 deletion kani-compiler/src/codegen_cprover_gotoc/utils/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use tracing::debug;
// Use a thread-local global variable to track the current codegen item for debugging.
// If Kani panics during codegen, we can grab this item to include the problematic
// codegen item in the panic trace.
thread_local!(static CURRENT_CODEGEN_ITEM: RefCell<(Option<String>, Option<Location>)> = RefCell::new((None, None)));
thread_local!(static CURRENT_CODEGEN_ITEM: RefCell<(Option<String>, Option<Location>)> = const { RefCell::new((None, None)) });

pub fn init() {
// Install panic hook
Expand Down
14 changes: 7 additions & 7 deletions kani-compiler/src/kani_middle/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,12 @@ impl<'tcx> KaniAttributes<'tcx> {
"Use of unstable feature `{}`: {}",
unstable_attr.feature, unstable_attr.reason
))
.span_note(
.with_span_note(
self.tcx.def_span(self.item),
format!("the function `{fn_name}` is unstable:"),
)
.note(format!("see issue {} for more information", unstable_attr.issue))
.help(format!("use `-Z {}` to enable using this function.", unstable_attr.feature))
.with_note(format!("see issue {} for more information", unstable_attr.issue))
.with_help(format!("use `-Z {}` to enable using this function.", unstable_attr.feature))
.emit()
}

Expand Down Expand Up @@ -422,7 +422,7 @@ impl<'tcx> KaniAttributes<'tcx> {
self.item_name(),
),
)
.span_note(self.tcx.def_span(id), "Try adding a contract to this function.")
.with_span_note(self.tcx.def_span(id), "Try adding a contract to this function.")
.emit();
return;
};
Expand All @@ -448,7 +448,7 @@ impl<'tcx> KaniAttributes<'tcx> {
self.item_name(),
),
)
.span_note(
.with_span_note(
self.tcx.def_span(def_id),
format!(
"Try adding a contract to this function or use the unsound `{}` attribute instead.",
Expand Down Expand Up @@ -624,7 +624,7 @@ impl<'a> UnstableAttrParseError<'a> {
self.attr.span,
format!("failed to parse `#[kani::unstable]`: {}", self.reason),
)
.note(format!(
.with_note(format!(
"expected format: #[kani::unstable({}, {}, {})]",
r#"feature="<IDENTIFIER>""#, r#"issue="<ISSUE>""#, r#"reason="<DESCRIPTION>""#
))
Expand Down Expand Up @@ -665,7 +665,7 @@ fn expect_no_args(tcx: TyCtxt, kind: KaniAttributeKind, attr: &Attribute) {
if !attr.is_word() {
tcx.dcx()
.struct_span_err(attr.span, format!("unexpected argument for `{}`", kind.as_ref()))
.help("remove the extra argument")
.with_help("remove the extra argument")
.emit();
}
}
Expand Down
5 changes: 3 additions & 2 deletions kani-compiler/src/kani_middle/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use rustc_middle::mir::{Body, Const as mirConst, ConstValue, Operand, Terminator
use rustc_middle::mir::{Local, LocalDecl};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::ty::{Const, GenericArgsRef};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{sym, Symbol};
use tracing::{debug, trace};

Expand Down Expand Up @@ -48,12 +49,12 @@ impl<'tcx> ModelIntrinsics<'tcx> {
fn replace_simd_bitmask(
&self,
func: &mut Operand<'tcx>,
args: &[Operand<'tcx>],
args: &[Spanned<Operand<'tcx>>],
gen_args: GenericArgsRef<'tcx>,
) {
assert_eq!(args.len(), 1);
let tcx = self.tcx;
let arg_ty = args[0].ty(&self.local_decls, tcx);
let arg_ty = args[0].node.ty(&self.local_decls, tcx);
if arg_ty.is_simd() {
// Get the stub definition.
let stub_id = tcx.get_diagnostic_item(Symbol::intern("KaniModelSimdBitmask")).unwrap();
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-01-08"
channel = "nightly-2024-01-17"
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

0 comments on commit b349137

Please sign in to comment.