Closed
Description
I'm seeing a regression in error spans for this use case:
use std::net::TcpListener;
use std::net::TcpStream;
use std::io::{self, Read, Write};
fn handle_client(stream: TcpStream) -> io::Result<()> {
stream.write_fmt(format!("message received"))
}
fn main() {
if let Ok(listener) = TcpListener::bind("127.0.0.1:8080") {
for incoming in listener.incoming() {
if let Ok(stream) = incoming {
handle_client(stream);
}
}
}
}
On 5-19-2016, the error span looks okay:
error: mismatched types [--explain E0308]
--> macro_errors_small.rs:7:22
7 |> stream.write_fmt(format!("message received"))
|> ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::fmt::Arguments`, found struct `std::string::String`
macro_errors_small.rs:7:22: 7:49: note: in this expansion of format! (defined in <std macros>)
note: expected type `std::fmt::Arguments<'_>`
note: found type `std::string::String`
On 5-20-2016, the error span became less helpful:
error: mismatched types [--explain E0308]
--> <std macros>:2:1
2 |> $ crate :: fmt :: format ( format_args ! ( $ ( $ arg ) * ) ) )
|> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::fmt::Arguments`, found struct `std::string::String`
macro_errors_small.rs:7:22: 7:49: note: in this expansion of format! (defined in <std macros>)
note: expected type `std::fmt::Arguments<'_>`
note: found type `std::string::String`
It's possible it's related to #33683 (cc @nikomatsakis and @sanxiyn) but I haven't done the full bisect.