2012-12-10 17:32:48 -08:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
// This tests that exports can have visible dependencies on things
|
|
|
|
// that are not exported, allowing for a sort of poor-man's ADT
|
2011-06-30 15:19:47 -07:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
mod foo {
|
2011-07-27 14:19:39 +02:00
|
|
|
// not exported
|
2012-01-19 18:31:08 -08:00
|
|
|
enum t { t1, t2, }
|
2011-06-30 15:19:47 -07:00
|
|
|
|
2013-02-14 11:47:00 -08:00
|
|
|
impl cmp::Eq for t {
|
2013-03-22 11:23:21 -07:00
|
|
|
fn eq(&self, other: &t) -> bool {
|
2012-11-14 18:59:30 -08:00
|
|
|
((*self) as uint) == ((*other) as uint)
|
2012-08-27 16:26:35 -07:00
|
|
|
}
|
2013-03-22 11:23:21 -07:00
|
|
|
fn ne(&self, other: &t) -> bool { !(*self).eq(other) }
|
2012-08-27 16:26:35 -07:00
|
|
|
}
|
|
|
|
|
2013-01-30 15:56:40 -08:00
|
|
|
pub fn f() -> t { return t1; }
|
2011-05-02 19:42:00 -04:00
|
|
|
|
2013-03-28 18:39:09 -07:00
|
|
|
pub fn g(v: t) { assert!((v == t1)); }
|
2011-05-02 19:42:00 -04:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() { foo::g(foo::f()); }
|