-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
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> { |
There was a problem hiding this comment.
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?
While you're at it, would you mine changing |
@bors: r+ 5b24228 |
@bors: r+ d619afe |
⌛ Testing commit d619afe with merge a61acf6... |
💔 Test failed - auto-win-32-nopt-t |
@bors: r+ 9ce9ad478d2f032251e728923f753d84639bad1c |
⌛ Testing commit 9ce9ad4 with merge 629557f... |
💔 Test failed - auto-mac-64-nopt-t |
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. |
Looks like there's a tidy error (squashes are also nice) |
Yup, I accidentally had some trailing whitespace. I fixed that up and I squashed the whole thing into one commit. @alexcrichton |
@bors: r+ c861692ca6e04d1b54a893218b3c51f1045de362 |
⌛ Testing commit c861692 with merge f71ce33... |
💔 Test failed - auto-linux-64-nopt-t |
Removed the unused imports that caused the linux build to fail, @alexcrichton. |
@bors: r+ c80d8fa |
⌛ Testing commit c80d8fa with merge 80093ef... |
💔 Test failed - auto-win-32-nopt-t |
|
Fixed that now, too. Am I missing something? Is there an easy way to test this stuff before committing? Running |
@bors: r+ 267478a Unfortunately without compiling on windows there's not a great way to do a smoke test of compiling on windows. |
@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())); |
There was a problem hiding this comment.
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
@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; |
There was a problem hiding this comment.
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
@alexcrichton and now I've done the rest of them. |
@bors: r+ d72691df90f1f522aafb775e77476e4a2edd9511 Thanks! |
⌛ Testing commit d72691d with merge 9451af9... |
💔 Test failed - auto-win-64-nopt-t |
@alexcrichton I think I caught all the Windows issues now. (At least, I hope?) |
@bors: r+ 05f942c |
⌛ Testing commit 05f942c with merge 5f267f2... |
💔 Test failed - auto-linux-64-x-android-t |
|
@alexcrichton Added |
📌 Commit 6acf385 has been approved by |
@bors: r+ fb3bd98d619dd26663df7745e81466fbe8ef2a92 |
🙀 |
`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
std::dynamic_library
is currently usingstd::old_io::Path
specifically. This change brings the API in alignment withstd::fs::File
by having it takestd::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