Skip to content

Commit 5490a80

Browse files
tautschnigqinheping
andcommitted
Update toolchain to 2023-02-16
Skip over all the nightlies from 2023-02-06 until 2023-02-15 as those ICE when trying to build kani with: ``` error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<[T; N]>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<[T; _]>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<[T; N]>} != fn() -> usize {std::mem::size_of::<[T; _]>} ``` This issue was reported upstream as rust-lang/rust#107898, and fixed in rust-lang/rust#107940, which isn't part of any of the above nightlies. Doing this multi-day update also requires addressing: Remove some superfluous type parameters from layout.rs rust-lang/rust#107163 Introduce -Zterminal-urls to use OSC8 for error codes rust-lang/rust#107838 s/eval_usize/eval_target_usize/ for clarity rust-lang/rust#108029 Co-authored-by: Qinheping Hu <[email protected]>
1 parent 3f0789d commit 5490a80

File tree

6 files changed

+25
-20
lines changed

6 files changed

+25
-20
lines changed

kani-compiler/src/codegen_cprover_gotoc/codegen/intrinsic.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -1226,14 +1226,16 @@ impl<'tcx> GotocCtx<'tcx> {
12261226
// `simd_shuffle4`) is type-checked
12271227
match farg_types[2].kind() {
12281228
ty::Array(ty, len) if matches!(ty.kind(), ty::Uint(ty::UintTy::U32)) => {
1229-
len.try_eval_usize(self.tcx, ty::ParamEnv::reveal_all()).unwrap_or_else(|| {
1230-
self.tcx.sess.span_err(
1231-
span.unwrap(),
1232-
"could not evaluate shuffle index array length",
1233-
);
1234-
// Return a dummy value
1235-
u64::MIN
1236-
})
1229+
len.try_eval_target_usize(self.tcx, ty::ParamEnv::reveal_all()).unwrap_or_else(
1230+
|| {
1231+
self.tcx.sess.span_err(
1232+
span.unwrap(),
1233+
"could not evaluate shuffle index array length",
1234+
);
1235+
// Return a dummy value
1236+
u64::MIN
1237+
},
1238+
)
12371239
}
12381240
_ => {
12391241
let err_msg = format!(

kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl<'tcx> GotocCtx<'tcx> {
144144
) -> Expr {
145145
let res_t = self.codegen_ty(res_ty);
146146
let op_expr = self.codegen_operand(op);
147-
let width = sz.try_eval_usize(self.tcx, ty::ParamEnv::reveal_all()).unwrap();
147+
let width = sz.try_eval_target_usize(self.tcx, ty::ParamEnv::reveal_all()).unwrap();
148148
Expr::struct_expr(
149149
res_t,
150150
btree_string_map![("0", op_expr.array_constant(width))],

kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ impl<'tcx> GotocCtx<'tcx> {
777777
}
778778
ty::Foreign(defid) => self.codegen_foreign(ty, *defid),
779779
ty::Array(et, len) => {
780-
let evaluated_len = len.try_eval_usize(self.tcx, self.param_env()).unwrap();
780+
let evaluated_len = len.try_eval_target_usize(self.tcx, self.param_env()).unwrap();
781781
let array_name = format!("[{}; {evaluated_len}]", self.ty_mangled_name(*et));
782782
let array_pretty_name = format!("[{}; {evaluated_len}]", self.ty_pretty_name(*et));
783783
// wrap arrays into struct so that one can take advantage of struct copy in C
@@ -902,7 +902,7 @@ impl<'tcx> GotocCtx<'tcx> {
902902
fn codegen_alignment_padding(
903903
&self,
904904
size: Size,
905-
layout: &LayoutS<VariantIdx>,
905+
layout: &LayoutS,
906906
idx: usize,
907907
) -> Option<DatatypeComponent> {
908908
let align = Size::from_bits(layout.align.abi.bits());
@@ -927,7 +927,7 @@ impl<'tcx> GotocCtx<'tcx> {
927927
fn codegen_struct_fields(
928928
&mut self,
929929
flds: Vec<(String, Ty<'tcx>)>,
930-
layout: &LayoutS<VariantIdx>,
930+
layout: &LayoutS,
931931
initial_offset: Size,
932932
) -> Vec<DatatypeComponent> {
933933
match &layout.fields {
@@ -1385,7 +1385,7 @@ impl<'tcx> GotocCtx<'tcx> {
13851385
&mut self,
13861386
variant: &VariantDef,
13871387
subst: &'tcx InternalSubsts<'tcx>,
1388-
layout: &LayoutS<VariantIdx>,
1388+
layout: &LayoutS,
13891389
initial_offset: Size,
13901390
) -> Vec<DatatypeComponent> {
13911391
let flds: Vec<_> =
@@ -1554,7 +1554,7 @@ impl<'tcx> GotocCtx<'tcx> {
15541554
ty: Ty<'tcx>,
15551555
adtdef: &'tcx AdtDef,
15561556
subst: &'tcx InternalSubsts<'tcx>,
1557-
variants: &IndexVec<VariantIdx, LayoutS<VariantIdx>>,
1557+
variants: &IndexVec<VariantIdx, LayoutS>,
15581558
) -> Type {
15591559
let non_zst_count = variants.iter().filter(|layout| layout.size.bytes() > 0).count();
15601560
let mangled_name = self.ty_mangled_name(ty);
@@ -1573,7 +1573,7 @@ impl<'tcx> GotocCtx<'tcx> {
15731573

15741574
pub(crate) fn variant_min_offset(
15751575
&self,
1576-
variants: &IndexVec<VariantIdx, LayoutS<VariantIdx>>,
1576+
variants: &IndexVec<VariantIdx, LayoutS>,
15771577
) -> Option<Size> {
15781578
variants
15791579
.iter()
@@ -1657,7 +1657,7 @@ impl<'tcx> GotocCtx<'tcx> {
16571657
pretty_name: InternedString,
16581658
def: &'tcx AdtDef,
16591659
subst: &'tcx InternalSubsts<'tcx>,
1660-
layouts: &IndexVec<VariantIdx, LayoutS<VariantIdx>>,
1660+
layouts: &IndexVec<VariantIdx, LayoutS>,
16611661
initial_offset: Size,
16621662
) -> Vec<DatatypeComponent> {
16631663
def.variants()
@@ -1689,7 +1689,7 @@ impl<'tcx> GotocCtx<'tcx> {
16891689
pretty_name: InternedString,
16901690
case: &VariantDef,
16911691
subst: &'tcx InternalSubsts<'tcx>,
1692-
variant: &LayoutS<VariantIdx>,
1692+
variant: &LayoutS,
16931693
initial_offset: Size,
16941694
) -> Type {
16951695
let case_name = format!("{name}::{}", case.name);

kani-compiler/src/session.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::parser;
77
use clap::ArgMatches;
88
use rustc_errors::{
99
emitter::Emitter, emitter::HumanReadableErrorType, fallback_fluent_bundle, json::JsonEmitter,
10-
ColorConfig, Diagnostic,
10+
ColorConfig, Diagnostic, TerminalUrl,
1111
};
1212
use std::panic;
1313
use std::str::FromStr;
@@ -57,6 +57,7 @@ static JSON_PANIC_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send
5757
None,
5858
false,
5959
false,
60+
TerminalUrl::No,
6061
);
6162
let diagnostic = Diagnostic::new(rustc_errors::Level::Bug, msg);
6263
emitter.emit_diagnostic(&diagnostic);

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# SPDX-License-Identifier: Apache-2.0 OR MIT
33

44
[toolchain]
5-
channel = "nightly-2023-02-05"
5+
channel = "nightly-2023-02-16"
66
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]

tools/bookrunner/librustdoc/doctest.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// See GitHub history for details.
55
use rustc_ast as ast;
66
use rustc_data_structures::sync::Lrc;
7-
use rustc_errors::ColorConfig;
7+
use rustc_errors::{ColorConfig, TerminalUrl};
88
use rustc_span::edition::Edition;
99
use rustc_span::source_map::SourceMap;
1010
use rustc_span::symbol::sym;
@@ -90,6 +90,7 @@ pub fn make_test(
9090
Some(80),
9191
false,
9292
false,
93+
TerminalUrl::No,
9394
)
9495
.supports_color();
9596

@@ -104,6 +105,7 @@ pub fn make_test(
104105
None,
105106
false,
106107
false,
108+
TerminalUrl::No,
107109
);
108110

109111
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser

0 commit comments

Comments
 (0)