Rust:类型必须植根于[保留]

问题描述 投票:-2回答:1

此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
rust
1个回答
2
投票

这是特定于the Servo project使用的编译器插件的错误。它指的是在JavaScript GC控制下的类型必须在堆栈上存在一个根,以确保在给定的堆栈帧中使用它们是相同的,这将防止该值在被使用时进行GC。由Rust代码使用。

© www.soinside.com 2019 - 2024. All rights reserved.