about summary refs log tree commit diff
path: root/src/librustc/plugin
diff options
context:
space:
mode:
authorBarosl Lee <vcs@barosl.com>2014-11-11 14:38:20 +0900
committerBarosl Lee <vcs@barosl.com>2014-11-19 05:31:45 +0900
commit6f422c4c05f4d108ba6429a174aa0c2ef3b183fa (patch)
treeb393a680897f0d6a80b96f1fda5c6fcb636f8cc5 /src/librustc/plugin
parent09e2ad13d0aa01143bcb20dece3ff6c5a7e34ea3 (diff)
downloadrust-6f422c4c05f4d108ba6429a174aa0c2ef3b183fa.tar.gz
rust-6f422c4c05f4d108ba6429a174aa0c2ef3b183fa.zip
Make os::getcwd() return IoResult<Path>
os::getcwd() panics if the current directory is not available. According
to getcwd(3), there are three cases:

- EACCES: Permission denied.
- ENOENT: The current working directory has been removed.
- ERANGE: The buffer size is less than the actual absolute path.

This commit makes os::getcwd() return IoResult<Path>, not just Path,
preventing it from panicking.

As os::make_absolute() depends on os::getcwd(), it is also modified to
return IoResult<Path>.

Fixes #16946.

[breaking-change]
Diffstat (limited to 'src/librustc/plugin')
-rw-r--r--src/librustc/plugin/load.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc/plugin/load.rs b/src/librustc/plugin/load.rs
index 1a270d0b1b7..5c2fe0854ee 100644
--- a/src/librustc/plugin/load.rs
+++ b/src/librustc/plugin/load.rs
@@ -134,7 +134,7 @@ impl<'a> PluginLoader<'a> {
     // Dynamically link a registrar function into the compiler process.
     fn dylink_registrar(&mut self, vi: &ast::ViewItem, path: Path, symbol: String) {
         // Make sure the path contains a / or the linker will search for it.
-        let path = os::make_absolute(&path);
+        let path = os::make_absolute(&path).unwrap();
 
         let lib = match DynamicLibrary::open(Some(&path)) {
             Ok(lib) => lib,