I\xe2\x80\x99m 尝试使用基于 LLVM 的zig cc为 R4300i / VR4300 MIPS CPU(N64 中的处理器)编译 C 代码(最终还有其他基于 LLVM 的语言,如 Rust/Zig)。但我没有看到任何以 VR4300 作为目标进行编译的证据或示例:
zig targets。LLVM不支持VR4300作为编译目标吗?我怎样才能自己发现这一点?
\nstruct Foo<'a> {
bytes: &'a mut [u8],
}
impl<'a> Foo<'a> {
fn bar<'b>(&'b mut self) {
self.bytes = &mut self.bytes[1..];
}
}
fn baz<'a, 'b>(foo: &'b mut Foo<'a>) {
println!("baz!");
for _ in 0..3 {
foo.bar();
}
}
Run Code Online (Sandbox Code Playgroud)
这会导致以下错误回溯:
Compiling playground v0.0.1 (/playground)
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in function call due to conflicting requirements
--> src/main.rs:12:27
|
12 | self.bytes = &mut self.bytes[1..];
| ^^^^^^^^^^^^^^^
|
note: first, the …Run Code Online (Sandbox Code Playgroud)