Hello,
I have a question that may be related to Ashish's recent questions.
I was trying to compile the below files and I discovered, unexpectedly,
that one fix is to add the line "use file1::file2::*;" at the top of
test-crate.rc.
Can someone clarify what's going on here? Is there a fix that modifies
file1.rs instead?
Thanks,
David
------ test-crate.rc -----
mod file1;
mod file2;
fn main() {
file1::bar();
}
------ file1.rs ------
mod file2;
struct X {
x : int
}
impl file2::HasInt for X {
fn foo(&self) -> int {
self.x
}
}
pub fn bar() -> int {
let x = X{x : 10};
x.foo()
}
------- file2.rs -----
pub trait HasInt {
fn foo(&self) -> int;
}
---------------------
$ rustc test-crate.rc
file1.rs:16:4: 18:1 error: type `file1::X` does not implement any method in
scope named `foo`
file1.rs:16 x.foo()
file1.rs:17
file1.rs:18 }
error: aborting due to previous error
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev