Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

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

Closed
pcwalton wants to merge 1 commit into
rust-lang:masterfrom
pcwalton:impls-next-to-struct
Closed

pcwalton wants to merge 1 commit into
rust-lang:masterfrom
pcwalton:impls-next-to-struct

Conversation

@pcwalton

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
rust-bors Bot pushed a commit that referenced this pull request Sep 2, 2026
*[View all
comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/17163)*

Do not lint `unused_async_trait_impl` for `impl Trait for !` blocks.

The never type `!` can never be instantiated, so any method implemented
for it can never be called. Flagging these as having an "unused async"
is a false positive since the async keyword has no practical impact.

fixes rust-lang/rust-clippy#17162

changelog: [`unused_async_trait_impl`]: do not lint when the trait is
implemented for the never type `!`

I ran the tests locally and pass, also did uibless and formatted the
code
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