此Rust编译器错误是什么意思?我遇到了它:
pub fn some_func(foo: Something<Else>) -> Another {
Another { foo: foo }
}
屈服误差:
error: Type must be rooted
--> script/foo.rs:12:32
|
12 | pub fn some_func(foo: Something<Else>) -> Another {
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(unrooted_must_root)]` on by default
这是特定于the Servo project使用的编译器插件的错误。它指的是在JavaScript GC控制下的类型必须在堆栈上存在一个根,以确保在给定的堆栈帧中使用它们是相同的,这将防止该值在被使用时进行GC。由Rust代码使用。