Repository: seanmonstar/reqwest (language: rust)

Issue:
0.11.21 release fails to compile on Windows
```
error[E0308]: mismatched types
  --> C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\reqwest-0.11.21\src\dns\trust_dns.rs:54:37
   |
54 |         .map_err(|e| io::Error::new(e.kind(), format!("error reading DNS system conf: {}", e)))?;
   |                      -------------- ^^^^^^^^ expected `ErrorKind`, found `&ResolveErrorKind`
   |                      |
   |                      arguments to this function are incorrect
   |
note: associated function defined here
  --> /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3\library\std\src\io\error.rs:514:12
```

Please check and let me know if this will be fixed soon.


Discussion / hints:
It's not just a clippy error, `cargo check --features trust-dns` on master fails.
@Bharath92 Could you update the issue title please? The current title makes it sound less severe than it actually is. Something like “Latest release fails to compile” maybe.
Oh, thank you for updating it's on Windows. I was very confused, since CI passes, and I just ran it locally and it compiles. So on Windows, what's different? Does trust-dns return a different error kind type when on Windows?
> Oh, thank you for updating it's on Windows. I was very confused, since CI passes, and I just ran it locally and it compiles. So on Windows, what's different? Does trust-dns return a different error kind type when on Windows?

Looks like it
https://github.com/bluejekyll/trust-dns/blob/main/crates/resolver/src/system_conf/unix.rs#L29
https://github.com/bluejekyll/trust-dns/blob/main/crates/resolver/src/system_conf/windows.rs#L53

very odd choice by library authors tbf
Ok, I filed an issue over there. Seems most likely an oversight. But anyways, I can add some genericish code to fix it in the meantime.

Fix patch:
diff --git a/src/dns/trust_dns.rs b/src/dns/trust_dns.rs
index 3a5abda81..5af17cd67 100644
--- a/src/dns/trust_dns.rs
+++ b/src/dns/trust_dns.rs
@@ -50,7 +50,11 @@ impl Iterator for SocketAddrs {
 /// Create a new resolver with the default configuration,
 /// which reads from `/etc/resolve.conf`.
 fn new_resolver() -> io::Result<TokioAsyncResolver> {
-    let (config, opts) = system_conf::read_system_conf()
-        .map_err(|e| io::Error::new(e.kind(), format!("error reading DNS system conf: {}", e)))?;
+    let (config, opts) = system_conf::read_system_conf().map_err(|e| {
+        io::Error::new(
+            io::ErrorKind::Other,
+            format!("error reading DNS system conf: {}", e),
+        )
+    })?;
     Ok(TokioAsyncResolver::tokio(config, opts))
 }


Test patch: