i do link c++ library in my rust program. and the c++ library should use no-strict aliasing flag.
i try to add rustflags = ["-C", "target-cpu=native", "-C", "no-strict-aliasing"] in Cargo.toml
and got error: unknown codegen option: no-strict-aliasing`.
Strict aliasing is a C++ specific rule about aliasing between different pointer types. -Z mutable-noalias is a Rust specific flag about emitting LLVM noalias attribute on &mut. They are not relevant. As long as you compile your C++ code with -fno-strict-aliasing then it's fine.
#[cfg(all(feature = "fifo"))]
fn fifo_build_link(c: &PathBuf) {
let function_path = c.join("fifo.cpp");
Build::new()
.file(function_path.clone())
.cpp(true)
.flag("-fno-strict-aliasing")
.warnings(true)
.out_dir(c)
.compile("fifo");
}
``` it should work like this?