-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken MIR: generator contains type impl std::future::Future in MIR, but typeck only knows about {impl std::future::Future, ()} #61834
Comments
I also stumbled over this error. Adding a simplified reproduction as an additional test case / data point. ( #![feature(async_await)]
use futures::compat::Future01CompatExt;
use reqwest::r#async::Client;
use serde_json::Value;
type Map = serde_json::Map<String, Value>;
async fn get<'a, D, Q>(client: &'a Client, path: &'a str, query: Q) -> Result<D, String>
where
Q: serde::Serialize,
D: serde::de::DeserializeOwned,
{
let value = serde_json::to_value(query).map_err(|e| e.to_string())?;
let query_map = match value {
serde_json::Value::Object(obj) => obj,
_ => Err(format!(
"Invalid query data: type must serialize into a object"
))?,
};
let mut clean_map: Map = query_map
.into_iter()
.filter(|(_key, value)| !value.is_null())
.collect();
clean_map.insert("key".into(), "value".into());
let url = "".to_string();
let mut res = client
.get(&url)
.query(&clean_map)
.send()
.compat()
.await
.map_err(|e| e.to_string());
Err("err".to_string())
} |
@theduke Could you provide your |
Some redundant deps in there, I didn't create a minimal reproduction due to the multiple existing issues. [package]
name = "repro"
version = "0.1.0"
edition = "2018"
[dependencies]
failure = "0.1.5"
serde = { version = "1.0.92", features = ["derive"] }
serde_json = "1.0.39"
chrono = { version = "0.4.6", features = ["serde"] }
tokio = "0.1.21"
reqwest = "0.9.18"
futures-preview = { version = "0.3.0-alpha.16", features = ["nightly", "async-await", "compat"] }
url = "1.7.2"
url_serde = "0.2.0" PS: the code works when the map transformation (everything before |
It looks like this will be fixed by #61872 - it's another case of generator analysis getting confused by the lack of |
Thanks for investigating! |
…sakis Clean up MIR drop generation * Don't assign twice to the destination of a `while` loop containing a `break` expression * Use `as_temp` to evaluate statement expression * Avoid consecutive `StorageLive`s for the condition of a `while` loop * Unify `return`, `break` and `continue` handling, and move it to `scopes.rs` * Make some of the `scopes.rs` internals private * Don't use `Place`s that are always `Local`s in MIR drop generation Closes #42371 Closes #61579 Closes #61731 Closes #61834 Closes #61910 Closes #62115
I tried this code with edition 2018:
This happened:
Meta
rustc --version --verbose
:Backtrace:
The text was updated successfully, but these errors were encountered: