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

Updated std::dynamic_lib to use std::path. #23197

Merged
merged 1 commit into from
Mar 28, 2015
Merged

Updated std::dynamic_lib to use std::path. #23197

merged 1 commit into from
Mar 28, 2015

Conversation

aatxe
Copy link
Member

@aatxe aatxe commented Mar 8, 2015

std::dynamic_library is currently using std::old_io::Path specifically. This change brings the API in alignment with std::fs::File by having it take std::path::AsPath. The Windows code should work, but I admittedly haven't tried it (I don't have a Windows machine readily available right now).

r? @alexcrichton

@rust-highfive
Copy link
Collaborator

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. 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 CONTRIBUTING.md for more information.

@@ -51,8 +52,8 @@ impl DynamicLibrary {

/// Lazily open a dynamic library. When passed None it gives a
/// handle to the calling process
pub fn open(filename: Option<&Path>) -> Result<DynamicLibrary, String> {
let maybe_library = dl::open(filename.map(|path| path.as_vec()));
pub fn open<P: AsPath + ?Sized>(filename: Option<&P>) -> Result<DynamicLibrary, String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately using a type parameter I believe will cause DynamicLibrary::open(None) to fail as there's no way to determine the type of P. Perhaps this could stay as Path for now?

@alexcrichton
Copy link
Member

While you're at it, would you mine changing DynamicLibrary::search_path as well to return PathBuf instead of old_path::Path? Thanks!

@alexcrichton
Copy link
Member

@bors: r+ 5b24228

@alexcrichton
Copy link
Member

@bors: r+ d619afe

@bors
Copy link
Contributor

bors commented Mar 10, 2015

⌛ Testing commit d619afe with merge a61acf6...

@bors
Copy link
Contributor

bors commented Mar 10, 2015

💔 Test failed - auto-win-32-nopt-t

@alexcrichton
Copy link
Member

@bors: r+ 9ce9ad478d2f032251e728923f753d84639bad1c

@bors
Copy link
Contributor

bors commented Mar 11, 2015

⌛ Testing commit 9ce9ad4 with merge 629557f...

@bors
Copy link
Contributor

bors commented Mar 11, 2015

💔 Test failed - auto-mac-64-nopt-t

@aatxe
Copy link
Member Author

aatxe commented Mar 11, 2015

I missed some stuff again, but I think I got it this time. Sorry for being bad about this, @alexcrichton. Hopefully this is the last commit.

@alexcrichton
Copy link
Member

Looks like there's a tidy error (squashes are also nice)

@aatxe
Copy link
Member Author

aatxe commented Mar 11, 2015

Yup, I accidentally had some trailing whitespace. I fixed that up and I squashed the whole thing into one commit. @alexcrichton

@aatxe aatxe changed the title Updated DynamicLibrary::open to use AsPath. Updated std::dynamic_lib to use std::path. Mar 11, 2015
@alexcrichton
Copy link
Member

@bors: r+ c861692ca6e04d1b54a893218b3c51f1045de362

@bors
Copy link
Contributor

bors commented Mar 12, 2015

⌛ Testing commit c861692 with merge f71ce33...

@bors
Copy link
Contributor

bors commented Mar 12, 2015

💔 Test failed - auto-linux-64-nopt-t

@aatxe
Copy link
Member Author

aatxe commented Mar 12, 2015

Removed the unused imports that caused the linux build to fail, @alexcrichton.

@alexcrichton
Copy link
Member

@bors: r+ c80d8fa

@bors
Copy link
Contributor

bors commented Mar 12, 2015

⌛ Testing commit c80d8fa with merge 80093ef...

@bors
Copy link
Contributor

bors commented Mar 12, 2015

💔 Test failed - auto-win-32-nopt-t

@Manishearth
Copy link
Member

C:/bot/slave/auto-win-32-nopt-t/build/src/libstd\dynamic_lib.rs:277:9: 277:12 error: unused import, #[deny(unused_imports)] on by default
C:/bot/slave/auto-win-32-nopt-t/build/src/libstd\dynamic_lib.rs:277     use str;

@aatxe
Copy link
Member Author

aatxe commented Mar 12, 2015

Fixed that now, too. Am I missing something? Is there an easy way to test this stuff before committing? Running make check-stage1-std NO_REBUILD=1 NO_BENCH=1 gave no indication of the unused imports (even in the first case with linux).

@alexcrichton
Copy link
Member

@bors: r+ 267478a

Unfortunately without compiling on windows there's not a great way to do a smoke test of compiling on windows.

@aatxe
Copy link
Member Author

aatxe commented Mar 23, 2015

@Manishearth @alexcrichton I think I got the rebase correct?

@@ -47,7 +48,7 @@ impl PluginManager {
/// elsewhere, libname.so.
pub fn load_plugin(&mut self, name: String) {
let x = self.prefix.join(libname(name));
let lib_result = dl::DynamicLibrary::open(Some(&x));
let lib_result = dl::DynamicLibrary::open(Some(&x.as_path()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call to as_path shouldn't be necessary

@aatxe
Copy link
Member Author

aatxe commented Mar 23, 2015

@alexcrichton I made all the changes you suggested.

@@ -15,6 +15,7 @@ use clean;
use std::dynamic_lib as dl;
use serialize::json;
use std::mem;
use std::path::AsPath;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be deleted

@aatxe
Copy link
Member Author

aatxe commented Mar 24, 2015

@alexcrichton and now I've done the rest of them.

@alexcrichton
Copy link
Member

@bors: r+ d72691df90f1f522aafb775e77476e4a2edd9511

Thanks!

@bors
Copy link
Contributor

bors commented Mar 24, 2015

⌛ Testing commit d72691d with merge 9451af9...

@bors
Copy link
Contributor

bors commented Mar 24, 2015

💔 Test failed - auto-win-64-nopt-t

@aatxe
Copy link
Member Author

aatxe commented Mar 24, 2015

@alexcrichton I think I caught all the Windows issues now. (At least, I hope?)

@alexcrichton
Copy link
Member

@bors: r+ 05f942c

@bors
Copy link
Contributor

bors commented Mar 25, 2015

⌛ Testing commit 05f942c with merge 5f267f2...

@bors
Copy link
Contributor

bors commented Mar 25, 2015

💔 Test failed - auto-linux-64-x-android-t

@Manishearth
Copy link
Member

/home/rustbuild/src/rust-buildbot/slave/auto-linux-64-x-android-t/build/src/libstd/dynamic_lib.rs:24:5: 24:7 error: unused import, #[deny(unused_imports)] on by default
/home/rustbuild/src/rust-buildbot/slave/auto-linux-64-x-android-t/build/src/libstd/dynamic_lib.rs:24 use os;
                                                                                                         ^~
/home/rustbuild/src/rust-buildbot/slave/auto-linux-64-x-android-t/build/src/libstd/dynamic_lib.rs:24:5: 24:7 error: use of deprecated item: replaced with std::env APIs, #[deny(deprecated)] on by default
/home/rustbuild/src/rust-buildbot/slave/auto-linux-64-x-android-t/build/src/libstd/dynamic_lib.rs:24 use os;
                                                                                                         ^~
/home/rustbuild/src/rust-buildbot/slave/auto-linux-64-x-android-t/build/src/libstd/dynamic_lib.rs:25:5: 25:8 error: unused import, #[deny(unused_imports)] on by default
/home/rustbuild/src/rust-buildbot/slave/auto-linux-64-x-android-t/build/src/libstd/dynamic_lib.rs:25 use str;
                                                                                                         ^~~
error: aborting due to 3 previous errors
make: *** [x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-

@aatxe
Copy link
Member Author

aatxe commented Mar 27, 2015

@alexcrichton Added #[cfg(not(target_os = "android"))] on those imports.

@alexcrichton
Copy link
Member

@bors: r+ alexcrichton@fb3bd98

@bors
Copy link
Contributor

bors commented Mar 27, 2015

📌 Commit 6acf385 has been approved by alexcrichton

@alexcrichton
Copy link
Member

@bors: r+ fb3bd98d619dd26663df7745e81466fbe8ef2a92

@bors
Copy link
Contributor

bors commented Mar 27, 2015

🙀 fb3bd98d619dd26663df7745e81466fbe8ef2a92 is not a valid commit SHA. Please try again with 6acf385.

@alexcrichton
Copy link
Member

@bors: r+ 6acf385

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 27, 2015
`std::dynamic_library` is currently using `std::old_io::Path` specifically. This change brings the API in alignment with `std::fs::File` by having it take `std::path::AsPath`. The Windows code should work, but I admittedly haven't tried it (I don't have a Windows machine readily available right now).

r? @alexcrichton
@bors bors merged commit 6acf385 into rust-lang:master Mar 28, 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.

5 participants