Skip to content
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

No compile-time error when referencing non-public module #8505

Closed
joshuawarner32 opened this issue Aug 14, 2013 · 3 comments
Closed

No compile-time error when referencing non-public module #8505

joshuawarner32 opened this issue Aug 14, 2013 · 3 comments

Comments

@joshuawarner32
Copy link

The following produces a difficult to understand link error, rather than a compile error. Rust 0.7, ubuntu 12.04 x86_64.

hello.rs:

extern mod world;

fn main() {
  println("hello " + world::columbus::explore());
}

world.rs:

#[ link(name = "world",
        vers = "0.1")];

#[ crate_type = "lib" ];

mod columbus {
  pub fn explore() -> &str { "world" }
}

Compiling hello.rs gives this error:
error: linking with cc failed with code 1
note: cc arguments: -L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -m64 -o hello hello.o -L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -lstd-6c65cf4b443341b1-0.7 -L. -lworld-15fb3a718ea23983-0.1 -lrustrt -lrt -lpthread -L. -lrt -ldl -lm -lmorestack -lrustrt -Wl,-rpath,$ORIGIN/../../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -Wl,-rpath,$ORIGIN/. -Wl,-rpath,/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -Wl,-rpath,/tmp/test/.
note: hello.o: In function main::_f3d4197390d6bb2a::_0$x2e0': hello.rc:(.text+0x54): undefined reference tocolumbus::explore::_3de4895354bdc485::_0$x2e1'
collect2: ld returned 1 exit status

@chris-morgan
Copy link
Member

The problem here which should have been reported by the compiler is that columbus is private.

@alexcrichton
Copy link
Member

I believe that this would be solved by #8365

@alexcrichton
Copy link
Member

This has since been fixed to be a proper privacy error. There are plenty of tests in the testsuite for this, so I'm just going to close this.

The fixing pull request was #9735 for reference.

xFrednet pushed a commit to xFrednet/rust that referenced this issue May 21, 2022
`undocumented_unsafe_blocks` does not trigger on unsafe trait impls

Closes rust-lang#8505

changelog: This lint checks unsafe impls NOT from macro expansions and checks ones in macro declarations.
~~`unsafe impl`s from macro invocations don't trigger the lint for now.~~
~~This lint checks unsafe impls from/not from macro expansions~~
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

3 participants