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/libcore | |
| 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/libcore')
| -rw-r--r-- | src/libcore/gc.rs | 1 | ||||
| -rw-r--r-- | src/libcore/hashmap.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num.rs | 5 | ||||
| -rw-r--r-- | src/libcore/pipes.rs | 3 | ||||
| -rw-r--r-- | src/libcore/prelude.rs | 2 | ||||
| -rw-r--r-- | src/libcore/private/weak_task.rs | 2 | ||||
| -rw-r--r-- | src/libcore/task/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcore/task/spawn.rs | 4 |
8 files changed, 15 insertions, 6 deletions
diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index bb2e7d788fd..4e69947ac67 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -42,6 +42,7 @@ with destructors. #[allow(structural_records)]; use cast; +use container::{Container, Mutable, Map, Set}; use io; use libc::{size_t, uintptr_t}; use option::{None, Option, Some}; diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index 27b5ddadff9..df98e469bbc 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -16,7 +16,6 @@ use cmp::Eq; use hash::Hash; -use prelude::*; use to_bytes::IterBytes; /// Open addressing with linear probing. @@ -464,6 +463,7 @@ pub mod linear { #[test] pub mod test { + use container::{Container, Mutable, Map, Set}; use option::{None, Some}; use hashmap::linear::LinearMap; use hashmap::linear; diff --git a/src/libcore/num.rs b/src/libcore/num.rs index 4c2daa458a4..6eb22e53a24 100644 --- a/src/libcore/num.rs +++ b/src/libcore/num.rs @@ -23,6 +23,11 @@ pub trait Num { static pure fn from_int(n: int) -> self; } +pub trait IntConvertible { + pure fn to_int(&self) -> int; + static pure fn from_int(n: int) -> self; +} + pub trait Zero { static pure fn zero() -> self; } diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 5029fc89b34..33826d10c3c 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -96,10 +96,9 @@ use either::{Either, Left, Right}; use kinds::Owned; use libc; use option; -use option::unwrap; +use option::{None, Option, Some, unwrap}; use pipes; use ptr; -use prelude::*; use private; use task; use vec; diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index 72aa828ff12..d3813d1ae85 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -35,6 +35,8 @@ pub use vec::{ImmutableEqVector, ImmutableCopyableVector}; pub use vec::{OwnedVector, OwnedCopyableVector}; pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times}; +pub use container::{Container, Mutable, Map, Set}; +pub use pipes::{GenericChan, GenericPort}; pub use num::Num; pub use ptr::Ptr; diff --git a/src/libcore/private/weak_task.rs b/src/libcore/private/weak_task.rs index 25a03ff960f..573a3e54b44 100644 --- a/src/libcore/private/weak_task.rs +++ b/src/libcore/private/weak_task.rs @@ -22,7 +22,7 @@ use option::{Some, None, swap_unwrap}; use private::at_exit::at_exit; use private::global::global_data_clone_create; use private::finally::Finally; -use pipes::{Port, Chan, SharedChan, stream}; +use pipes::{Port, Chan, SharedChan, GenericSmartChan, stream}; use task::{Task, task, spawn}; use task::rt::{task_id, get_task_id}; use hashmap::linear::LinearMap; diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index aa82309c78a..9ddafee6938 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -45,7 +45,7 @@ use iter; use libc; use option; use result::Result; -use pipes::{stream, Chan, Port, SharedChan}; +use pipes::{stream, Chan, GenericChan, GenericPort, Port, SharedChan}; use pipes; use prelude::*; use ptr; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index a5ab4af40be..0a2f6634214 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -74,8 +74,10 @@ #[warn(deprecated_mode)]; use cast; +use container::Map; +use oldcomm; use option; -use pipes::{stream, Chan, Port}; +use pipes::{Chan, GenericChan, GenericPort, Port}; use pipes; use prelude::*; use private; |
