Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
adjust trait bound for with_clone::Any
I believe the [new] std::marker::[Reflect] trait made it necessary to
specify a Reflect bound, but it's advised to use an Any bound instead.

Adding this bound makes it compile. I ran the tests and got an error
saying it couldn't determine the type of one of the expressions so I
introduced a scope to bind the result of the expression and annotate its
type.

I also removed the `convert` feature that was no longer needed.

[new]: rust-lang/rust#23712
[Reflect]: http://doc.rust-lang.org/std/marker/trait.Reflect.html
  • Loading branch information
blaenk committed Apr 6, 2015
commit 454d7a1ac6d0b9ecc3569a981b1609ab7f1d4964
10 changes: 7 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type.

#![feature(core, std_misc, convert)]
#![feature(core, std_misc)]
#![cfg_attr(test, feature(test))]
#![warn(missing_docs, unused_results)]

Expand Down Expand Up @@ -346,9 +346,13 @@ mod tests {
*v = new_v;
}
}
assert_eq!(map.get().unwrap(), &B(200));
assert_eq!(map.len(), 6);

{
let b: &B = map.get().unwrap();
assert_eq!(b, &B(200));
}

assert_eq!(map.len(), 6);

// Existing key (remove)
match map.entry::<C>() {
Expand Down
2 changes: 1 addition & 1 deletion src/with_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<T: 'static + Clone> CloneToAny for T {
/// Pretty much just `std::any::Any + Clone`.
pub trait Any: ::std::any::Any + CloneToAny { }

impl<T: 'static + Clone> Any for T { }
impl<T: 'static + Clone + Any> Any for T { }

impl Clone for Box<Any> {
fn clone(&self) -> Box<Any> {
Expand Down