Skip to content

Regression around Trait::method -> Self #18209

Closed
@wycats

Description

@wycats

I have this trait definition:

pub trait LoadableMessage {
    fn load<R: Reader>(reader: &mut R) -> IoResult<Self> {
        let mut stream = InputStream::new();
        LoadableMessage::load_from_stream(&mut stream)
    }
}

And this usage:

pub fn load<'a, M: LoadableMessage, R: Reader>(reader: &mut R) -> IoResult<M> {
    LoadableMessage::load(reader)
}

And I get this error upon compilation:

-gnu/release/deps --extern nix=/home/wycats/Code/skylight-rust/target/x86_64-unknown-linux-gnu/release/deps/libnix-13dc7f065ef11e3c.rlib`
/home/wycats/Code/skylight-rust/libs/buffoon/src/lib.rs:19:5: 19:34 error: mismatched types: expected `core::result::Result<M,std::io::IoError>`, found `core::result::Result<Self,std::io::IoError>` (expected type parameter, found Self)
/home/wycats/Code/skylight-rust/libs/buffoon/src/lib.rs:19     LoadableMessage::load(reader)
                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This was compiling recently (I believe last week), but does not compile with today's nightly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions