Open
Description
Given the following code:
extern crate mio;
use mio::buf::RingBuf;
use mio::buf::Buf;
use std::io::Read;
fn main() {
let buf = RingBuf::new(10);
let bytes = buf.bytes();
println!("{:?}", bytes);
}
buf
is of type RingBuf
. RingBuf
does not provide .bytes()
, but it implements both Buf
and Read
, which both provide a .bytes()
implementation.
According to https://doc.rust-lang.org/book/ufcs.html the compiler should complain. But it simply chooses to take the implementation of Read
, which return the "wrong" result type.
(Without the "use Read" line rust chooses the implementation of Buf
, which return the "correct" type.)
(I am using Rust 1.0.0.)