Mak*_*gan 5 compiler-errors traits rust
我试图让工作成为一种依赖于多个层面的其他抽象特征的特征。我遇到了这个错误:
error[E0391]: cycle detected when checking effective visibilities
|
note: ...which requires computing type of `wavefront::<impl at src/wavefront.rs:28:1: 47:46>::pos_iterator::{opaque#0}`...
--> src/wavefront.rs:54:34
|
54 | fn pos_iterator(&'a self) -> impl Iterator<Item = Self::Vert3D>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing type of opaque `wavefront::<impl at src/wavefront.rs:28:1: 47:46>::pos_iterator::{opaque#0}`...
--> src/wavefront.rs:54:34
|
54 | fn pos_iterator(&'a self) -> impl Iterator<Item = Self::Vert3D>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `wavefront::<impl at src/wavefront.rs:28:1: 47:46>::pos_iterator`...
--> src/wavefront.rs:54:5
|
54 | fn pos_iterator(&'a self) -> impl Iterator<Item = Self::Vert3D>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires checking effective visibilities, completing the cycle
note: cycle used when checking that `wavefront::<impl at src/wavefront.rs:28:1: 47:46>` is well-formed
--> src/wavefront.rs:28:1
|
28 | / impl<'a, V2, V3, V, E, F, VI, EI, FI> WaveFrontCompatible<'a>
29 | | for dyn HalfMeshLike<
30 | | VertData = V,
31 | | EdgeData = E,
... |
46 | | EI: Iterator<Item = HEdgeHandle<V, E, F>>,
47 | | FI: Iterator<Item = FaceHandle<V, E, F>>,
| |_____________________________________________^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
Run Code Online (Sandbox Code Playgroud)
我尝试过更改我的类型,尝试添加更多特征,专门化返回类型...我只是不明白,为什么编译器试图在这里实例化类型,为什么它不等到我尝试应用特征到一个具体类型来知道它是否可以推导出类型?
代码:
error[E0391]: cycle detected when checking effective visibilities
|
note: ...which requires computing type of `wavefront::<impl at src/wavefront.rs:28:1: 47:46>::pos_iterator::{opaque#0}`...
--> src/wavefront.rs:54:34
|
54 | fn pos_iterator(&'a self) -> impl Iterator<Item = Self::Vert3D>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing type of opaque `wavefront::<impl at src/wavefront.rs:28:1: 47:46>::pos_iterator::{opaque#0}`...
--> src/wavefront.rs:54:34
|
54 | fn pos_iterator(&'a self) -> impl Iterator<Item = Self::Vert3D>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `wavefront::<impl at src/wavefront.rs:28:1: 47:46>::pos_iterator`...
--> src/wavefront.rs:54:5
|
54 | fn pos_iterator(&'a self) -> impl Iterator<Item = Self::Vert3D>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires checking effective visibilities, completing the cycle
note: cycle used when checking that `wavefront::<impl at src/wavefront.rs:28:1: 47:46>` is well-formed
--> src/wavefront.rs:28:1
|
28 | / impl<'a, V2, V3, V, E, F, VI, EI, FI> WaveFrontCompatible<'a>
29 | | for dyn HalfMeshLike<
30 | | VertData = V,
31 | | EdgeData = E,
... |
46 | | EI: Iterator<Item = HEdgeHandle<V, E, F>>,
47 | | FI: Iterator<Item = FaceHandle<V, E, F>>,
| |_____________________________________________^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
448 次 |
| 最近记录: |