Make impl of Add for @[] public

It's not clear that impls should have to be public to be used
from outside the crate; in particular, I don't know whether
they have to be public to be used from other modules within
the same crate.
This commit is contained in:
Niko Matsakis 2012-09-26 14:23:27 -07:00
parent 264e1b2edb
commit 8b13912a83
2 changed files with 6 additions and 4 deletions

View File

@ -134,9 +134,9 @@ pub pure fn from_elem<T: Copy>(n_elts: uint, +t: T) -> @[T] {
}
#[cfg(notest)]
mod traits {
pub mod traits {
#[legacy_exports];
impl<T: Copy> @[T] : Add<&[const T],@[T]> {
pub impl<T: Copy> @[T] : Add<&[const T],@[T]> {
#[inline(always)]
pure fn add(rhs: & &[const T]) -> @[T] {
append(self, (*rhs))
@ -249,9 +249,7 @@ pub fn test() {
assert from_elem(5, 3.14) == @[3.14, 3.14, 3.14, 3.14, 3.14];
}
/*
#[test]
pub fn append_test() {
assert @[1,2,3] + @[4,5,6] == @[1,2,3,4,5,6];
}
*/

View File

@ -654,6 +654,10 @@ impl CoherenceChecker {
module_def_id,
None);
for (*implementations).each |implementation| {
debug!("coherence: adding impl from external crate: %s",
ty::item_path_str(self.crate_context.tcx,
implementation.did));
// Make sure we don't visit the same implementation
// multiple times.
match impls_seen.find(implementation.did) {