Merge remote-tracking branch 'upstream/main' into rust-docs

This commit is contained in:
Luke Boswell 2022-11-06 09:15:57 +11:00
commit 2c2a70b8e7
132 changed files with 1819 additions and 1795 deletions

View file

@ -1597,7 +1597,7 @@ mod tests {
// we need to compile the app first
let output = std::process::Command::new(&zig)
.current_dir(dir)
.args(&[
.args([
"build-obj",
"app.zig",
"-fPIC",
@ -1637,7 +1637,7 @@ mod tests {
// now we can compile the host (it uses libapp.so, hence the order here)
let output = std::process::Command::new(&zig)
.current_dir(dir)
.args(&[
.args([
"build-exe",
"libapp.so",
"host.zig",
@ -1672,7 +1672,7 @@ mod tests {
std::fs::copy(&dir.join("preprocessedhost"), &dir.join("final")).unwrap();
surgery_elf(
&*roc_app,
&roc_app,
&dir.join("metadata"),
&dir.join("final"),
false,

View file

@ -47,7 +47,7 @@ pub fn create_dylib_macho(
}
std::fs::write(
&dummy_obj_file,
dummy_obj_file,
out_object.write().expect("failed to build output object"),
)
.expect("failed to write object to file");
@ -67,7 +67,7 @@ pub fn create_dylib_macho(
let output = Command::new("ld")
.args(ld_prefix_args)
.args(&[
.args([
ld_flag_soname,
dummy_lib_file.file_name().unwrap().to_str().unwrap(),
dummy_obj_file.to_str().unwrap(),

View file

@ -231,7 +231,7 @@ fn generate_import_library(stub_lib_path: &Path, custom_names: &[String]) {
// > https://github.com/messense/implib-rs
let output = std::process::Command::new(&zig)
.current_dir(stub_lib_path.parent().unwrap())
.args(&[
.args([
"dlltool",
"-d",
def_filename.to_str().unwrap(),

View file

@ -8,13 +8,13 @@ use roc_collections::all::MutMap;
use roc_error_macros::internal_error;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub enum VirtualOffset {
Absolute,
Relative(u64),
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub struct SurgeryEntry {
pub file_offset: u64,
pub virtual_offset: VirtualOffset,
@ -25,7 +25,7 @@ pub struct SurgeryEntry {
// I think a number of them can be combined to reduce string duplication.
// Also I think a few of them aren't need.
// For example, I think preprocessing can deal with all shifting and remove the need for added_byte_count.
#[derive(Default, Serialize, Deserialize, PartialEq, Debug)]
#[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug)]
pub struct Metadata {
pub app_functions: Vec<String>,
// offset followed by address.

View file

@ -1617,7 +1617,7 @@ mod test {
// we need to compile the app first
let output = std::process::Command::new(&zig)
.current_dir(dir)
.args(&[
.args([
"build-obj",
"app.zig",
"-target",
@ -1642,7 +1642,7 @@ mod test {
let file = std::fs::File::open(dir.join("app.obj")).unwrap();
let roc_app = unsafe { memmap2::Mmap::map(&file) }.unwrap();
let roc_app_sections = AppSections::from_data(&*roc_app);
let roc_app_sections = AppSections::from_data(&roc_app);
let symbols = roc_app_sections.roc_symbols;
// make the dummy dylib based on the app object
@ -1653,7 +1653,7 @@ mod test {
// now we can compile the host (it uses libapp.dll, hence the order here)
let output = std::process::Command::new(&zig)
.current_dir(dir)
.args(&[
.args([
"build-exe",
"libapp.dll",
"host.zig",
@ -1689,7 +1689,7 @@ mod test {
std::fs::copy(&dir.join("preprocessedhost"), &dir.join("app.exe")).unwrap();
surgery_pe(&dir.join("app.exe"), &dir.join("metadata"), &*roc_app);
surgery_pe(&dir.join("app.exe"), &dir.join("metadata"), &roc_app);
}
#[allow(dead_code)]
@ -1731,7 +1731,7 @@ mod test {
let output = std::process::Command::new("wine")
.current_dir(dir)
.args(&["app.exe"])
.args(["app.exe"])
.output()
.unwrap();
@ -1869,7 +1869,7 @@ mod test {
let output = std::process::Command::new(&zig)
.current_dir(dir)
.args(&[
.args([
"build-exe",
"host.zig",
"-lc",