【发布时间】:2018-09-19 16:28:34
【问题描述】:
我尝试关注strategy described in the book(和编译器),但遇到以下错误:
lifetime parameters are not allowed on this type: lifetime parameter not allowed
这里是sn-p的代码:
struct FooRef<'a, F: 'a>(&'a F);
struct Bar<'a, 'f: 'a, F: Foo<'f>> {
filter: &'a FooRef<'f, F<'f>>,
}
【问题讨论】:
-
请查看如何创建minimal reproducible example,然后查看edit 您的问题以包含它。我们无法分辨代码中存在哪些 crate、类型、特征、字段等。例如,
Foo是什么?尝试在Rust Playground 上重现您的错误,或者您可以在全新的 Cargo 项目中重现它。还有Rust-specific MCVE tips。