Skip to content

Commit e68600d

Browse files
authored
Merge pull request #1779 from verus-lang/fix-no-cheating
Allow external_body/assume_specification inside vstd
2 parents c3a5054 + c885f86 commit e68600d

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

source/vir/src/ast_util.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ impl PathX {
5959
_ => false,
6060
}
6161
}
62+
63+
pub fn is_vstd_path(&self) -> bool {
64+
match &self.krate {
65+
Some(k) if &**k == "vstd" => true,
66+
_ => false,
67+
}
68+
}
6269
}
6370

6471
pub fn path_segments_match_prefix(target: &Idents, prefix: &Idents) -> bool {

source/vir/src/well_formed.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,10 +1174,16 @@ fn check_function(
11741174
}
11751175

11761176
if ctxt.no_cheating && (function.x.attrs.is_external_body || function.x.proxy.is_some()) {
1177-
return Err(error(
1178-
&function.span,
1179-
"external_body/assume_specification not allowed with --no-cheating",
1180-
));
1177+
match &function.x.owning_module {
1178+
// Allow external_body/assume_specification inside vstd
1179+
Some(path) if path.is_vstd_path() => {}
1180+
_ => {
1181+
return Err(error(
1182+
&function.span,
1183+
"external_body/assume_specification not allowed with --no-cheating",
1184+
));
1185+
}
1186+
}
11811187
}
11821188

11831189
Ok(())

0 commit comments

Comments
 (0)