Skip to content

Confusing error: 'method read has 1 parameters' #5925

Closed
@brson

Description

@brson

I am trying to implement my own trait called Reader, but I accidentally had a different Reader trait in scope.

/home/brian/dev/rust/src/libcore/rt/io/comm_adapters.rs:20:4: 20:67 error: method `read` has 1 parameters 
but the trait has 2
/home/brian/dev/rust/src/libcore/rt/io/comm_adapters.rs:20     fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail!() }
                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It took some time to figure out that rustc and I were looking at different traits. It could tell me the path to the trait it is trying to match. Even better, it could tell me about alternate traits with the same name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions