File tree Expand file tree Collapse file tree 4 files changed +52
-2
lines changed
compiler/rustc_codegen_llvm/src/gotoc Expand file tree Collapse file tree 4 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,15 @@ impl<'tcx> GotocCtx<'tcx> {
102
102
// https://github.com/model-checking/rmc/issues/202
103
103
"fmt::ArgumentV1::<'a>::as_usize" => true ,
104
104
// https://github.com/model-checking/rmc/issues/204
105
- x if x . ends_with ( "__getit" ) => true ,
105
+ name if name . ends_with ( "__getit" ) => true ,
106
106
// https://github.com/model-checking/rmc/issues/205
107
107
"panic::Location::<'a>::caller" => true ,
108
108
// https://github.com/model-checking/rmc/issues/207
109
109
"core::slice::<impl [T]>::split_first" => true ,
110
+ // https://github.com/model-checking/rmc/issues/281
111
+ name if name. starts_with ( "bridge::client" ) => true ,
112
+ // https://github.com/model-checking/rmc/issues/282
113
+ "bridge::closure::Closure::<'a, A, R>::call" => true ,
110
114
_ => false ,
111
115
}
112
116
}
Original file line number Diff line number Diff line change @@ -1034,6 +1034,7 @@ impl<'tcx> GotocCtx<'tcx> {
1034
1034
1035
1035
/// Check if the mir type already is a vtable fat pointer.
1036
1036
pub fn is_vtable_fat_pointer ( & self , mir_type : Ty < ' tcx > ) -> bool {
1037
- pointee_type ( mir_type) . map_or ( false , |p| self . use_vtable_fat_pointer ( p) )
1037
+ self . is_ref_of_unsized ( mir_type)
1038
+ && self . use_vtable_fat_pointer ( pointee_type ( mir_type) . unwrap ( ) )
1038
1039
}
1039
1040
}
Original file line number Diff line number Diff line change @@ -22,3 +22,6 @@ check-cbmc-viewer-version.py --major 2 --minor 5
22
22
# Standalone rmc tests, expected tests, and cargo tests
23
23
./x.py build -i --stage 1 library/std ${EXTRA_X_PY_BUILD_ARGS}
24
24
./x.py test -i --stage 1 cbmc firecracker prusti smack expected cargo-rmc
25
+
26
+ # Check codegen for the standard library
27
+ $SCRIPT_DIR /std-lib-regression.sh
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ # SPDX-License-Identifier: Apache-2.0 OR MIT
4
+
5
+ # Test for platform
6
+ platform=` uname -sp`
7
+ if [[ $platform != " Linux x86_64" ]]; then
8
+ echo " Codegen script only works on Linux x86 platform"
9
+ exit 0
10
+ fi
11
+
12
+ # Get RMC root
13
+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
14
+ RMC_DIR=$SCRIPT_DIR /..
15
+
16
+ # Log output
17
+ STD_LIB_LOG=" /tmp/SizeAndAlignOfDstTest/log.txt"
18
+
19
+ # Use a unit test that requires mutex and cell
20
+ echo " Starting RMC codegen for the Rust standard library"
21
+ cd /tmp
22
+ if [ -d SizeAndAlignOfDstTest ]; then rm -rf SizeAndAlignOfDstTest; fi
23
+ cargo new SizeAndAlignOfDstTest
24
+ cd SizeAndAlignOfDstTest
25
+ cp $RMC_DIR /src/test/cbmc/SizeAndAlignOfDst/main_fail.rs src/main.rs
26
+ rustup component add rust-src --toolchain nightly > /dev/null 2>&1
27
+ RUSTFLAGS=" -Z trim-diagnostic-paths=no -Z codegen-backend=gotoc --cfg=rmc" RUSTC=rmc-rustc cargo +nightly build -Z build-std --target x86_64-unknown-linux-gnu 2> $STD_LIB_LOG
28
+
29
+ # For now, we expect a linker error, but no modules should fail with a compiler
30
+ # panic.
31
+ #
32
+ # With https://github.com/model-checking/rmc/issues/109, this check can be
33
+ # removed to just allow the success of the previous line to determine the
34
+ # success of this script (with no $STD_LIB_LOG needed)
35
+ RESULT=$?
36
+ if grep -q " error: internal compiler error: unexpected panic" $STD_LIB_LOG ; then
37
+ echo " Panic on building standard library"
38
+ cat $STD_LIB_LOG
39
+ exit 1
40
+ else
41
+ echo " Successful RMC codegen for the Rust standard library"
42
+ fi
You can’t perform that action at this time.
0 commit comments