You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
extern mod inside of module doesn't work as expected #4677
compilation of the crate works fine, but linking against it causes an error:
machine> rustc cratey.rs
Running /Users/clements/rust/build/x86_64-apple-darwin/stage2/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
machine> rustc -L . crateuser.rs
Running /Users/clements/rust/build/x86_64-apple-darwin/stage2/bin/rustc:
crateuser.rs:6:4: 6:17 error: unresolved name
crateuser.rs:6 use cratey::add1;
^~~~~~~~~~~~~
crateuser.rs:6:4: 6:17 error: failed to resolve import: cratey::add1
crateuser.rs:6 use cratey::add1;
^~~~~~~~~~~~~
error: failed to resolve imports
error: aborting due to 3 previous errors
Removing the "mod mymod" wrapper allows the thing to compile fine. Apologies if this is the way it's supposed to work; casual stand-up-and-shout suggests to me that it should be possible to put an extern mod inside a module.
I see... 'use' paths are relative to the crate root, and not to the current module. I've added a note (not yet pushed) to the documentation about this; hopefully this will prevent others from making this mistake.
Activity
graydon commentedon Jan 30, 2013
Use self::cratey::add1 ?
jbclements commentedon Jan 30, 2013
I see... 'use' paths are relative to the crate root, and not to the current module. I've added a note (not yet pushed) to the documentation about this; hopefully this will prevent others from making this mistake.
Thanks!
Closing this issue.
Auto merge of rust-lang#6076 - rail-rain:fix_fp_explicit_counter_loop…
Merge pull request rust-lang#4677 from rust-lang/rustup-2025-11-10
Merge pull request rust-lang#4677 from rust-lang/rustup-2025-11-10