Skip to content

error: failed to resolve imports (I think I'm doing something wrong) #3409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brendanzab opened this issue Sep 7, 2012 · 1 comment
Closed

Comments

@brendanzab
Copy link
Member

I'm currently working on my linear algebra library, but I'm having trouble compiling it.

Here's the error I'm getting when I run $ make all

rustc src/om3d.rc --lib --out-dir=lib
error: failed to resolve imports
src/quat.rs:5:7: 5:14 error: unresolved import
src/quat.rs:5 import mat::*;
                     ^~~~~~~
src/mat.rs:5:7: 5:15 error: unresolved import
src/mat.rs:5 import quat::*;
                    ^~~~~~~~
src/projection.rs:2:7: 2:14 error: unresolved import
src/projection.rs:2 import mat::*;
                           ^~~~~~~
error: aborting due to 4 previous errors

My directory is layed out like so:

om3d-rs/
    | Makefile
    | src/
    |    | mat.rs
    |    | om3d.rc
    |    | projection.rs
    |    | quat.rs
    |    | vec.rs
    | ...

makefile

all:
    rustc src/om3d.rc --lib --out-dir=lib

src/om3d.rc

#[link(name = "om3d",
       vers = "0.1",
       author = "Brendan Zabarauskas")];

#[comment = "Linear algebra library for Rust. Incomplete and probably buggy."];
#[crate_type = "lib"];

use std;

mod mat;
mod projection;
mod quat;
mod vec;

src/quat.rs

// ...
import mat::*;
import vec::*;
// ...

src/mat.rs

// ...
import quat::*;
import vec::*;
// ...

src/projection.rs

// ...
import mat::*;
// ...

Any idea what am I doing wrong?

@brendanzab
Copy link
Member Author

Ok, the issue was that the glob imports were triggering a cyclic import (see Issue #3352).

I fixed it by changing the imports:

src/mat.rs

// ...
import quat::quat;
import vec::*;
// ...

src/quat.rs

// ...
import mat::{mat3, mat4};
import vec::*;
// ...

src/projection.rs

// ...
import mat::{mat3, mat4};
// ...

bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant