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

librustc: Forbid inherent implementations that aren't adjacent to the #17163

Closed
wants to merge 1 commit into from

Conversation

pcwalton
Copy link
Contributor

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 {
        ...
    }
}

Closes #17059.

RFC #155.

[breaking-change]

r? @brson

@alexcrichton
Copy link
Member

As part of the [breaking-change] commit message, could you include that std::io::fs::PathExtensions will need to be included to use convenience methods on path?

@pcwalton pcwalton force-pushed the impls-next-to-struct branch from f63cbb3 to 3234673 Compare September 11, 2014 17:39
@pcwalton
Copy link
Contributor Author

Updated. re-r? @alexcrichton

@pcwalton pcwalton force-pushed the impls-next-to-struct branch from 3234673 to bfee958 Compare September 11, 2014 23:12
@pcwalton
Copy link
Contributor Author

Updated again. re-r? @alexcrichton

@pcwalton pcwalton force-pushed the impls-next-to-struct branch from bfee958 to b4049f4 Compare September 13, 2014 01:49
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 rust-lang#17059.

RFC rust-lang#155.

[breaking-change]
@pcwalton pcwalton force-pushed the impls-next-to-struct branch from b4049f4 to 467bea0 Compare September 13, 2014 09:07
bors added a commit that referenced this pull request Sep 14, 2014
…hton

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 {
            ...
        }
    }

Closes #17059.

RFC #155.

[breaking-change]

r? @brson
@bors bors closed this Sep 14, 2014
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.

Require inherent impls to be located adjacent to their types
4 participants