diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-25 16:57:39 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-29 10:42:45 -0800 |
| commit | eb4d39e1fef918242a5dba2a09d7b9faa437b911 (patch) | |
| tree | 92d923119a6d8f1b16d83c2214e8acf9d0dd25e6 /src/libstd/map.rs | |
| parent | f1e78c6dd7dc41a9937c466a7af5d0efc779909f (diff) | |
| download | rust-eb4d39e1fef918242a5dba2a09d7b9faa437b911.tar.gz rust-eb4d39e1fef918242a5dba2a09d7b9faa437b911.zip | |
libstd: Remove "dual impls" from the language and enforce coherence rules. r=brson
"Dual impls" are impls that are both type implementations and trait implementations. They can lead to ambiguity and so this patch removes them from the language. This also enforces coherence rules. Without this patch, records can implement traits not defined in the current crate. This patch fixes this, and updates all of rustc to adhere to the new enforcement. Most of this patch is fixing rustc to obey the coherence rules, which involves converting a bunch of records to structs.
Diffstat (limited to 'src/libstd/map.rs')
| -rw-r--r-- | src/libstd/map.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 3c890ef0654..f3016e9df21 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -28,7 +28,7 @@ pub type Set<K:Eq IterBytes Hash> = HashMap<K, ()>; pub type HashMap<K:Eq IterBytes Hash, V> = chained::T<K, V>; -pub trait Map<K:Eq IterBytes Hash Copy, V: Copy> { +pub trait StdMap<K:Eq IterBytes Hash Copy, V: Copy> { /// Return the number of elements in the map pure fn size() -> uint; @@ -124,7 +124,7 @@ pub mod util { // FIXME (#2344): package this up and export it as a datatype usable for // external code that doesn't want to pay the cost of a box. pub mod chained { - use map::{Map, util}; + use map::{StdMap, util}; use core::io; use core::ops; @@ -239,7 +239,7 @@ pub mod chained { } } - impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: Map<K, V> { + impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: StdMap<K, V> { pure fn size() -> uint { self.count } pure fn contains_key(k: K) -> bool { |
