reem / rust-typemap

A typesafe store keyed by types and containing different types of values.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking under rust nightly

jaredonline opened this issue · comments

src/lib.rs:40:9: 40:65 error: mismatched types: expected `bool`, found `core::option::Option<Box<core::any::Any+'static>>` (expected bool, found enum core::option::Option)
src/lib.rs:40         self.data.insert(TypeId::of::<K>(), box val as Box<Any>)
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:66:9: 66:45 error: mismatched types: expected `bool`, found `core::option::Option<Box<core::any::Any+'static>>` (expected bool, found enum core::option::Option)
src/lib.rs:66         self.data.remove(&TypeId::of::<K>())
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Build failed, waiting for other jobs to finish...
Could not compile `typemap`.

To learn more, run the command again with --verbose.
cargo 0.0.1-pre-nightly (537b43c 2014-11-06 00:02:30 +0000)

This should be fixed by a cargo update now.

I have updated but still getting these errors:

   Compiling typemap v0.0.0 (https://github.com/reem/rust-typemap.git#55f0020b)
   Compiling url v0.1.0 (https://github.com/servo/rust-url.git#8a61b765)
src/lib.rs:40:66: 42:11 error: type `bool` does not implement any method in scope named `map`
src/lib.rs:40         self.data.insert(TypeId::of::<K>(), box val as Box<Any>).map(|v| unsafe {
src/lib.rs:41             *v.downcast_unchecked::<V>()
src/lib.rs:42         })
src/lib.rs:41:14: 41:41 error: the type of this value must be known in this context
src/lib.rs:41             *v.downcast_unchecked::<V>()
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:48:19: 48:42 error: type `std::collections::hash::map::HashMap<core::intrinsics::TypeId, Box<core::any::Any+'static>>` does not implement any method in scope named `get`
src/lib.rs:48         self.data.get(&TypeId::of::<K>()).map(|v| unsafe {
                                ^~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:49:13: 49:44 error: the type of this value must be known in this context
src/lib.rs:49             v.downcast_ref_unchecked::<V>()
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:56:47: 58:11 error: type `&mut Box<core::any::Any+'static>` does not implement any method in scope named `map`
src/lib.rs:56         self.data.get_mut(&TypeId::of::<K>()).map(|v| unsafe {
src/lib.rs:57             v.downcast_mut_unchecked::<V>()
src/lib.rs:58         })
src/lib.rs:57:13: 57:44 error: the type of this value must be known in this context
src/lib.rs:57             v.downcast_mut_unchecked::<V>()
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:63:19: 63:42 error: type `std::collections::hash::map::HashMap<core::intrinsics::TypeId, Box<core::any::Any+'static>>` does not implement any method in scope named `get`
src/lib.rs:63         self.data.get(&TypeId::of::<K>()).map(|v| unsafe {
                                ^~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:64:13: 64:44 error: the type of this value must be known in this context
src/lib.rs:64             v.downcast_ref_unchecked::<V>()
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:70:47: 72:11 error: type `&mut Box<core::any::Any+'static>` does not implement any method in scope named `map`
src/lib.rs:70         self.data.get_mut(&TypeId::of::<K>()).map(|v| unsafe {
src/lib.rs:71             v.downcast_mut_unchecked::<V>()
src/lib.rs:72         })
src/lib.rs:71:13: 71:44 error: the type of this value must be known in this context
src/lib.rs:71             v.downcast_mut_unchecked::<V>()
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:84:46: 86:11 error: type `bool` does not implement any method in scope named `map`
src/lib.rs:84         self.data.remove(&TypeId::of::<K>()).map(|v| unsafe {
src/lib.rs:85             *v.downcast_unchecked::<V>()
src/lib.rs:86         })
src/lib.rs:85:14: 85:41 error: the type of this value must be known in this context
src/lib.rs:85             *v.downcast_unchecked::<V>()
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 12 previous errors
Build failed, waiting for other jobs to finish...
Could not compile `typemap`.

You have an old version of rustc with the old libcollections.

Sorry, my bad.

@reem Thanks for fixing this so fast!

@jaredonline Absolutely! I try to keep the response time low so it's actually practical to use these libraries.