-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support crate-type=bin and --tests with dependencies #1260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for figuring this out, @tedinski!
Only have a few minor comments.
@@ -11,6 +11,15 @@ pub fn alter_extension(path: &Path, ext: &str) -> PathBuf { | |||
path.with_extension(ext) | |||
} | |||
|
|||
/// Attempt to guess the rlib name for rust source file | |||
pub fn guess_rlib_name(path: &Path) -> PathBuf { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more reliable way to get the rlib name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not as far as I can tell, will at least add a quick ref to rustc sources...
Co-authored-by: Zyad Hassan <88045115+zhassan-aws@users.noreply.github.com>
let mut entries = Vec::new(); | ||
|
||
for (entry_name, entry) in self.entries { | ||
// FIXME only read the symbol table of the object files to avoid having to keep all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want a tracking issue for the "FIXMEs" here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not our fixme, it's from the upstream file. I didn't remove it because I wanted to modify the file as minimally as possible.
Description of changes:
This causes kani-compiler to emit
rlib
files. Cargo expects these to exist in certain circumstances, such as for the dependencies of--crate-type=bin
(including the binaries built by--tests
)Resolved issues:
Resolves #1216
Resolves #473
Newly opened #1258
Call-outs:
archive.rs
is basically just code lifted from cranelift, only slightly simplified to remove extra dependencies.Emitting
rlib
meanskani
(single file mode) creates a new noisy file that we need to delete.THREE new major cargo-kani test cases!!
cfg(test)
To use dev-dependencies, you need to guard withcfg(all(kani, test))
#1258)tests/
directory! (cargo kani --tests doesn't work with dependencies #1216 sort of, modulo To use dev-dependencies, you need to guard withcfg(all(kani, test))
#1258)Testing:
How is this change tested? new tests
Is this a refactor change? no
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.