Skip to content

Conversation

@sgrif
Copy link
Contributor

@sgrif sgrif commented Dec 17, 2015

It is entirely possible for a crate to have a build script that is simply
the equivalent to

fn main() {
    println!("cargo:rustc-link-search=native=/some/path");
}

Without actually giving anything to link (for example, because the code
contains #[link(name="foo")]. In this case, we aren't actually passing
-L through when running doctests, even though they're passed when
compiling the main crate.

Fixes #1592

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@sgrif sgrif force-pushed the sg-doctest-link-args branch from e477025 to 749af1d Compare December 17, 2015 21:19
It is entirely possible for a crate to have a build script that is simply
the equivalent to

```rustc
fn main() {
    println!("cargo:rustc-link-search=native=/some/path");
}
```

Without actually giving anything to link (for example, because the code
contains `#[link(name="foo")]`. In this case, we aren't actually passing
`-L` through when running doctests, even though they're passed when
compiling the main crate.

Fixes rust-lang#1592
@sgrif sgrif force-pushed the sg-doctest-link-args branch from 749af1d to 8c65284 Compare December 17, 2015 21:20
@alexcrichton
Copy link
Member

Oh, right! I think in this case the any_dylib clause can be dropped as it's moot. Also, does this actually fix the use case in mind? If the build script doesn't link to anything it looks like it's still ignored in terms of passing arguments?

(also, can you add a test for this?)

@sgrif
Copy link
Contributor Author

sgrif commented Dec 18, 2015

Yes, Diesel passes with this change at least. The build script doesn't have to link it for something to be linked. I'll see what happens if we just drop the conditional and add a test tomorrow. (STAR WARS TIME!!!!!)

In this case the dylib check isn't actually doing anything useful, as
we're just appending search paths. Also adds a test for
8c65284
@sgrif
Copy link
Contributor Author

sgrif commented Dec 19, 2015

@alexcrichton Seems like removing the dylib check was fine, tests all passed. Added a test for this change as well

@alexcrichton
Copy link
Member

@bors: r+ a6f2063

@bors
Copy link
Contributor

bors commented Dec 20, 2015

⌛ Testing commit a6f2063 with merge e1c105e...

bors added a commit that referenced this pull request Dec 20, 2015
It is entirely possible for a crate to have a build script that is simply
the equivalent to

```rustc
fn main() {
    println!("cargo:rustc-link-search=native=/some/path");
}
```

Without actually giving anything to link (for example, because the code
contains `#[link(name="foo")]`. In this case, we aren't actually passing
`-L` through when running doctests, even though they're passed when
compiling the main crate.

Fixes #1592
@bors
Copy link
Contributor

bors commented Dec 20, 2015

💔 Test failed - cargo-win-gnu-64

@alexcrichton
Copy link
Member

@bors: retry

On Saturday, December 19, 2015, bors notifications@github.com wrote:

[image: 💔] Test failed - cargo-win-gnu-64
http://buildbot.rust-lang.org/builders/cargo-win-gnu-64/builds/297


Reply to this email directly or view it on GitHub
#2225 (comment).

@bors
Copy link
Contributor

bors commented Dec 20, 2015

⚡ Previous build results for cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-msvc-32, cargo-win-msvc-64 are reusable. Rebuilding only cargo-win-gnu-64...

@bors
Copy link
Contributor

bors commented Dec 20, 2015

@bors bors merged commit a6f2063 into rust-lang:master Dec 20, 2015
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

Successfully merging this pull request may close these issues.

4 participants