谁能解释一下这个错误是什么意思?这实际上是相同的结构。 它是否无法以某种方式推断出 R 或 F 并以这种方式报告?
src/demo.rs:113:51: 113:65 error: mismatched types:
expected `&mut gfx_debug_draw::debug_renderer::DebugRenderer<_, _>`,
found `&mut gfx_debug_draw::debug_renderer::DebugRenderer<R, F>`
(expected struct `gfx_debug_draw::debug_renderer::DebugRenderer`,
found a different struct `gfx_debug_draw::debug_renderer::DebugRenderer`) [E0308]
src/demo.rs:113 self.skeleton.draw(&global_poses, debug_renderer, settings.draw_labels);
^~~~~~~~~~~~~~
违规行在这里: https://github.com/PistonDevelopers/skeletal_animation_demo/blob/master/src/demo.rs#L113 debug_renderer 在这里定义: https://github.com/PistonDevelopers/skeletal_animation_demo/blob/master/src/demo.rs#L97 这些类型来自此处的 impl: https://github.com/PistonDevelopers/skeletal_animation_demo/blob/master/src/demo.rs#L43
函数本身在这里: https://github.com/PistonDevelopers/skeletal_animation/blob/master/src/skeleton.rs#L66-L70
Rust 1.5 和 1.3,同样的错误。
最佳答案
看起来您的项目使用了两个不同版本的gfx_debug_draw
(因此找到了一个不同的结构gfx_debug_draw::debug_renderer::DebugRenderer
。它是相同的结构,但来自不同的同一个包的多个版本。),可能是因为您在 Cargo.toml
中指定了一个版本,而您的一个依赖项指定了另一个版本。你应该检查你的 Cargo.lock
看看是否是真的,然后确保你在所有地方都使用相同版本的箱子。
关于rust - 类型不匹配 : expected somestruct<_, _> 得到了一些结构<R,F>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32903119/