about summary refs log tree commit diff
path: root/src/libstd/path
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-09-10 22:26:41 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-09-13 02:07:39 -0700
commit467bea04fa1d5fd894d64b2b2901d94260301631 (patch)
treea57cedfccc75f43f37995d0de6f9cb3f1bf27900 /src/libstd/path
parenta9cf19889ae7030c7df25cf41105906d12616f1e (diff)
downloadrust-467bea04fa1d5fd894d64b2b2901d94260301631.tar.gz
rust-467bea04fa1d5fd894d64b2b2901d94260301631.zip
librustc: Forbid inherent implementations that aren't adjacent to the
type they provide an implementation for.

This breaks code like:

    mod foo {
        struct Foo { ... }
    }

    impl foo::Foo {
        ...
    }

Change this code to:

    mod foo {
        struct Foo { ... }

        impl Foo {
            ...
        }
    }

Additionally, if you used the I/O path extension methods `stat`,
`lstat`, `exists`, `is_file`, or `is_dir`, note that these methods have
been moved to the the `std::io::fs::PathExtensions` trait. This breaks
code like:

    fn is_it_there() -> bool {
        Path::new("/foo/bar/baz").exists()
    }

Change this code to:

    use std::io::fs::PathExtensions;

    fn is_it_there() -> bool {
        Path::new("/foo/bar/baz").exists()
    }

Closes #17059.

RFC #155.

[breaking-change]
Diffstat (limited to 'src/libstd/path')
-rw-r--r--src/libstd/path/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs
index 5a5068f4d01..d84848545bd 100644
--- a/src/libstd/path/mod.rs
+++ b/src/libstd/path/mod.rs
@@ -53,6 +53,8 @@ actually operates on the path; it is only intended for display.
 ## Example
 
 ```rust
+use std::io::fs::PathExtensions;
+
 let mut path = Path::new("/tmp/path");
 println!("path: {}", path.display());
 path.set_filename("foo");