Skip to content

Commit 5512fb4

Browse files
committed
auto merge of #11639 : sfackler/rust/macro-crate-path, r=alexcrichton
If the library is in the working directory, its path won't have a "/" which will cause dlopen to search /usr/lib etc. It turns out that Path auto-normalizes during joins so Path::new(".").join(path) is actually a no-op.
2 parents 52f1d90 + 1e20960 commit 5512fb4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libsyntax/ext/expand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use util::small_vector::SmallVector;
3131

3232
use std::vec;
3333
use std::unstable::dynamic_lib::DynamicLibrary;
34+
use std::os;
3435

3536
pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr {
3637
match e.node {
@@ -402,8 +403,7 @@ fn load_extern_macros(crate: &ast::ViewItem, fld: &mut MacroExpander) {
402403
None => return
403404
};
404405
// Make sure the path contains a / or the linker will search for it.
405-
// If path is already absolute this is a no-op.
406-
let path = Path::new(".").join(path);
406+
let path = os::make_absolute(&path);
407407

408408
let registrar = match fld.cx.loader.get_registrar_symbol(cnum) {
409409
Some(registrar) => registrar,

0 commit comments

Comments
 (0)