Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions prusti-tests/tests/verify/fail/no-annotations/panic-reason.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ fn test_assert(x: bool) {
}

fn test_assert_msg(x: bool) {
assert!(false, "msg"); //~ ERROR the asserted expression might not hold
// FIXME: see mir_encoder encode_panic_cause
assert!(false, "msg"); //~ ERROR panic!(..) statement might be reachable
}

fn test_debug_assert(x: bool) {
Expand Down Expand Up @@ -65,7 +66,8 @@ fn test_inner_assert(x: bool) {
macro_rules! inner_assert_msg {
() => {
{
assert!(false, "msg"); //~ ERROR the asserted expression might not hold
// FIXME: see mir_encoder encode_panic_cause
assert!(false, "msg"); //~ ERROR panic!(..) statement might be reachable
}
};
}
Expand Down
12 changes: 7 additions & 5 deletions prusti-viper/src/encoder/mir_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,13 +750,15 @@ impl<'p, 'v: 'p, 'tcx: 'v> MirEncoder<'p, 'v, 'tcx> {
.map(|x| x.as_str())
.collect();
match &macro_names_str[..] {
["core::macros::panic", "std::unimplemented", ..] => PanicCause::Unimplemented,
["core::macros::panic", "std::unreachable", ..] => PanicCause::Unreachable,
["core::panic::panic_2015", "core::macros::panic", "std::unimplemented"] => PanicCause::Unimplemented,
["core::panic::panic_2015", "core::macros::panic", "std::unreachable"] => PanicCause::Unreachable,
["std::assert", "std::debug_assert", ..] => PanicCause::DebugAssert,
["std::assert", ..] => PanicCause::Assert,
["std::panic", "std::assert", "std::debug_assert", ..] => PanicCause::DebugAssert,
["std::panic", "std::assert", ..] => PanicCause::Assert,
["std::panic", ..] => PanicCause::Panic,
["std::panic::panic_2015", "std::panic", "std::debug_assert"] => PanicCause::DebugAssert,
// TODO: assert!(_, "") currently has the same backtrace as panic!()
// see https://github.com/rust-lang/rust/issues/82157
//["std::panic::panic_2015", "std::panic", ..] => PanicCause::Assert,
["std::panic::panic_2015", "std::panic", ..] => PanicCause::Panic,
_ => PanicCause::Generic,
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2021-02-01"
channel = "nightly-2021-02-15"
components = [ "rustfmt", "rustc-dev", "llvm-tools-preview" ]