-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when a verusroot is present, with source files, remap spans so that t…
…hey are available in binary releases
- Loading branch information
Showing
7 changed files
with
210 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,9 @@ verus! { | |
{ | ||
*r = 0; | ||
} | ||
|
||
proof fn external_span(s: Seq<nat>) { | ||
assert(s[0] == 0); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#[cfg(target_os = "macos")] | ||
mod lib_exe_names { | ||
pub const LIB_PRE: &str = "lib"; | ||
pub const LIB_DL: &str = "dylib"; | ||
} | ||
|
||
#[cfg(target_os = "linux")] | ||
mod lib_exe_names { | ||
pub const LIB_PRE: &str = "lib"; | ||
pub const LIB_DL: &str = "so"; | ||
} | ||
|
||
#[cfg(target_os = "windows")] | ||
mod lib_exe_names { | ||
pub const LIB_PRE: &str = ""; | ||
pub const LIB_DL: &str = "dll"; | ||
} | ||
|
||
use lib_exe_names::{LIB_DL, LIB_PRE}; | ||
|
||
#[derive(Debug)] | ||
pub struct VerusExterns { | ||
pub verus_root: std::path::PathBuf, | ||
pub has_vstd: bool, | ||
pub has_builtin: bool, | ||
} | ||
|
||
pub enum VerusExtern { | ||
Macros, | ||
Builtin, | ||
Vstd, | ||
} | ||
|
||
fn verus_builtin_std() -> Box<[(VerusExtern, &'static str, String)]> { | ||
vec![ | ||
(VerusExtern::Macros, "builtin_macros", format!("{LIB_PRE}builtin_macros.{LIB_DL}")), | ||
( | ||
VerusExtern::Macros, | ||
"state_machines_macros", | ||
format!("{LIB_PRE}state_machines_macros.{LIB_DL}"), | ||
), | ||
(VerusExtern::Builtin, "builtin", format!("libbuiltin.rlib")), | ||
(VerusExtern::Vstd, "vstd", format!("libvstd.rlib")), | ||
] | ||
.into_boxed_slice() | ||
} | ||
|
||
impl VerusExterns { | ||
pub fn to_args(&self) -> impl Iterator<Item = String> { | ||
let mut args = Vec::new(); | ||
args.push(format!("-L")); | ||
args.push(format!("dependency={}", self.verus_root.to_str().unwrap())); | ||
for (extern_, name, file) in verus_builtin_std().iter() { | ||
match extern_ { | ||
VerusExtern::Macros => {} | ||
VerusExtern::Builtin => { | ||
if !self.has_builtin { | ||
continue; | ||
} | ||
} | ||
VerusExtern::Vstd => { | ||
if !self.has_vstd { | ||
continue; | ||
} | ||
} | ||
} | ||
let path = self.verus_root.join(file); | ||
let path = path.to_str().unwrap(); | ||
args.push(format!("--extern")); | ||
args.push(format!("{}={}", name, path)); | ||
} | ||
args.into_iter() | ||
} | ||
|
||
pub fn to_path_mappings(&self) -> Box<[(String, std::path::PathBuf)]> { | ||
let mut args = Vec::new(); | ||
for (extern_, name, _file) in verus_builtin_std().iter() { | ||
match extern_ { | ||
VerusExtern::Macros => {} | ||
VerusExtern::Builtin => { | ||
if !self.has_builtin { | ||
continue; | ||
} | ||
} | ||
VerusExtern::Vstd => { | ||
if !self.has_vstd { | ||
continue; | ||
} | ||
} | ||
} | ||
let path = self.verus_root.join(name); | ||
args.push((name.to_string(), path)); | ||
} | ||
args.into_boxed_slice() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters