Created
September 5, 2016 19:01
-
-
Save jacius/c4500c31e4ad84682dfca053b33a4e64 to your computer and use it in GitHub Desktop.
Scary Rust Compiler Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% rustc --version | |
rustc 1.10.0 (cfcb716cf 2016-07-03) | |
% cargo run | |
Compiling scary-compiler-message v0.1.0 (file:///Users/jac/scary-compiler-message) | |
src/main.rs:27:36: 27:40 error: no method named `iter` found for type `(specs::Storage<Foo, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<Foo>>>, specs::Storage<Bar, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<Bar>>>)` in the current scope | |
src/main.rs:27 for (foo, bar) in (foos, bars).iter() { | |
^~~~ | |
src/main.rs:27:36: 27:40 note: the method `iter` exists but the following trait bounds were not satisfied: `specs::Storage<Foo, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<Foo>>> : specs::Join`, `specs::Storage<Bar, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<Bar>>> : specs::Join`, `specs::Storage<Foo, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<Foo>>> : specs::Join`, `specs::Storage<Bar, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<Bar>>> : specs::Join` | |
error: aborting due to previous error | |
error: Could not compile `scary-compiler-message`. | |
To learn more, run the command again with --verbose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "scary-compiler-message" | |
version = "0.1.0" | |
[dependencies] | |
specs = "0.7.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate specs; | |
use specs::Join; | |
#[derive(Clone, Default)] | |
struct Foo; | |
impl specs::Component for Foo { | |
type Storage = specs::NullStorage<Foo>; | |
} | |
#[derive(Clone, Default)] | |
struct Bar; | |
impl specs::Component for Bar { | |
type Storage = specs::NullStorage<Bar>; | |
} | |
fn main() { | |
let mut world = specs::World::new(); | |
world.register::<Foo>(); | |
world.register::<Bar>(); | |
let entity = world.create_now().with(Foo).with(Bar).build(); | |
let foos = world.read::<Foo>(); | |
let bars = world.read::<Bar>(); | |
// This should be (&foos, &bars).iter() | |
// But the compiler error does not point the user towards a solution. | |
for (foo, bar) in (foos, bars).iter() { | |
println!("Hi"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment