Skip to content

Commit

Permalink
Try using both types of join
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed Sep 30, 2022
1 parent 5888f0c commit 6c8ddfd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions prusti-contracts/prusti-specs/src/specifications/preparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,11 @@ impl RustOp {
}

fn join_spans(s1: Span, s2: Span) -> Span {
// This works even when compiled with stable, compared to `s1.join(s2)`
s1.unwrap().join(s2.unwrap()).expect("Failed to join spans!").into()
// This will not work on stable, but will work outside of proc macros (e.g. tests)
s1.join(s2).unwrap_or_else(||
// This works even when compiled with stable, but panics when outside of the proc macro context
s1.unwrap().join(s2.unwrap()).expect("Failed to join spans!").into()
)
}

#[cfg(test)]
Expand Down

0 comments on commit 6c8ddfd

Please sign in to comment.