Skip to content
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

1.70.0: Type inference no longer works in conjunction with Glib's clone macro #112225

Closed
marhkb opened this issue Jun 2, 2023 · 13 comments · Fixed by #112266
Closed

1.70.0: Type inference no longer works in conjunction with Glib's clone macro #112225

marhkb opened this issue Jun 2, 2023 · 13 comments · Fixed by #112266
Labels
A-async-await Area: Async & Await A-inference Area: Type inference C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@marhkb
Copy link

marhkb commented Jun 2, 2023

My code does not compile any more after updating to 1.70.0. The project can be found here

Code

I tried to create a minimal reproducer. It has something to do with glib's clone macro, which I use. Here is the reproducer that compiles fine on 1.69 but not on 1.70.0. I left some comments in the code describing what I observed so far. It needs glib and futures dependency):

use futures::Future;
use glib::clone;

fn main() {
    let obj = String::new();
    do_async(
        // just using `compound()` without `async` block works
        async { compound().await },
        clone!(@strong obj => move |info| if let Ok(info) = info {
            // removing this line makes the code compile
            println!("{:?}", info.t);
        }),
    );
}

struct Compound {
    t: i32
}

// Just returning a simple type like i32 makes the code compile
async fn compound() -> Result<Compound, ()> {
    Err(())
}

async fn do_async<R, Fut, F>(tokio_fut: Fut, glib_closure: F)
where
    R: Send + 'static,
    Fut: Future<Output = R> + Send + 'static,
    F: FnOnce(R) + 'static,
{
    glib_closure(tokio_fut.await);
}

Output

error[E0282]: type annotations needed for `Result<_, E>`
  --> src/main.rs:9:37
   |
9  |         clone!(@strong obj => move |info| if let Ok(info) = info {
   |                                     ^^^^
10 |             // removing this line makes the code compile
11 |             println!("{:?}", info.t);
   |                              ---- type must be known at this point
   |
help: consider giving this closure parameter an explicit type, where the placeholders `_` are specified
   |
9  |         clone!(@strong obj => move |info: Result<_, E>| if let Ok(info) = info {
   |                                         ++++++++++++++

For more information about this error, try `rustc --explain E0282`.

I expected to see this happen: The type info is correctly inferred

Instead, this happened: The compiler tells me that it doesn't know the type, although the type can be inferred

Version it worked on

It most recently worked on: 1.69.0

Version with regression

rustc --version --verbose:

rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-unknown-linux-gnu
release: 1.70.0
LLVM version: 16.0.2
@marhkb marhkb added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jun 2, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jun 2, 2023
@lukas-code
Copy link
Member

lukas-code commented Jun 2, 2023

regressed in #104833 cc @Swatinem

slightly minimized and removed dependencies: playground

use core::future::Future;

fn main() {
    do_async(
        async { (0,) },
        {
            // closure must be inside block
            |info| println!("{:?}", info.0)
        },
    );
}

fn do_async<R, Fut, F>(tokio_fut: Fut, glib_closure: F)
where
    Fut: Future<Output = R>,
    F: FnOnce(R),
{
}

Putting the identity function back (or wrapping the async block in a block) seems to "fix" the error:

    do_async(
-       async { (0,) },
+       core::convert::identity(async { (0,) }),
        {
            // closure must be inside block
            |info| println!("{:?}", info.0)
        },
    );
bisector output

searched nightlies: from nightly-2023-03-01 to nightly-2023-06-01
regressed nightly: nightly-2023-03-15
searched commit range: 22f247c...1716932
regressed commit: 669e751

bisected with cargo-bisect-rustc v0.6.6

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc -- check 

@rustbot label -regression-untriaged +regression-from-stable-to-stable +A-inference +A-async-await

@rustbot rustbot added A-async-await Area: Async & Await A-inference Area: Type inference regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-untriaged Untriaged performance or correctness regression. labels Jun 2, 2023
@Swatinem
Copy link
Contributor

Swatinem commented Jun 3, 2023

It is not only an identity function that makes this suddenly work, but putting the async block in a block works as well.
Permuting what to wrap in a block, only a single case out of the four fails:

// works:
    do_async(
        async { (0,) },
        |info| println!("{:?}", info.0),
    );

// works:
    do_async(
        {
            // async block in block
            async { (0,) }
        },
        |info| println!("{:?}", info.0),
    );

// works:
    do_async(
        {
            // both in block
            async { (0,) }
        },
        {
            // closure must be inside block
            |info| println!("{:?}", info.0)
        },
    );

// fails:
    do_async(
        async { (0,) },
        {
            // closure must be inside block
            |info| println!("{:?}", info.0)
        },
    );

Out of curiousity I tried the patch in #109338 thats supposed to fix #106527 to make async blocks "provide inference guidance", but that doesn’t work either.

@lukas-code
Copy link
Member

lukas-code commented Jun 3, 2023

This happens due to a hack in typeck, where function arguments that aren't closures, including block expressions that return closures, are typechecked before function parameters that are closures. Note that async blocks are desugared to closures.

// Check the arguments.
// We do this in a pretty awful way: first we type-check any arguments
// that are not closures, then we type-check the closures. This is so
// that we have more information about the types of arguments when we
// type-check the functions. This isn't really the right way to do this.
for check_closures in [false, true] {
// More awful hacks: before we check argument types, try to do
// an "opportunistic" trait resolution of any trait bounds on
// the call. This helps coercions.
if check_closures {
self.select_obligations_where_possible(|_| {})
}
// Check each argument, to satisfy the input it was provided for
// Visually, we're traveling down the diagonal of the compatibility matrix
for (idx, arg) in provided_args.iter().enumerate() {
// Warn only for the first loop (the "no closures" one).
// Closure arguments themselves can't be diverging, but
// a previous argument can, e.g., `foo(panic!(), || {})`.
if !check_closures {
self.warn_if_unreachable(arg.hir_id, arg.span, "expression");
}
// For C-variadic functions, we don't have a declared type for all of
// the arguments hence we only do our usual type checking with
// the arguments who's types we do know. However, we *can* check
// for unreachable expressions (see above).
// FIXME: unreachable warning current isn't emitted
if idx >= minimum_input_count {
continue;
}
let is_closure = matches!(arg.kind, ExprKind::Closure { .. });
if is_closure != check_closures {
continue;
}
let compatible = demand_compatible(idx);
let is_compatible = matches!(compatible, Compatibility::Compatible);
compatibility_diagonal[idx] = compatible;
if !is_compatible {
call_appears_satisfied = false;
}
}
}

This basically means that closures and async blocks in function arguments behave as if they were ordered after all non-closure non-async-block arguments and you now get the same inference error that you would get on older compilers if you manually swapped the function arguments.

(Also, looks like this hack has existed forever.)

@Swatinem
Copy link
Contributor

Swatinem commented Jun 3, 2023

Wow, that is a very good catch! And also good news, as it means "fixing" the regression should be a oneliner, which I will try tomorrow.

However that does smell like a very gross hack, and I wonder if there will eventually be a better way altogether. But that is for a different day.

@lukas-code
Copy link
Member

"fixing" the regression should be a oneliner

Note that just excluding desugared async block closures from this hack breaks inference for different programs that are now accepted on stable, for example:

fn main() {
    let x = Default::default();
    do_async(
        async { x.0; },
        { || { let _: &(i32,) = &x; } },
    );
}

fn do_async<Fut, T>(fut: Fut, val: T, ) {}

@Swatinem
Copy link
Contributor

Swatinem commented Jun 3, 2023

that are now accepted on stable

you mean which are only accepted as of 1.70?

@lukas-code
Copy link
Member

Yeah, I mean stable 1.70. But I guess it's better to break a constructed program that compiled for one stable version instead of breaking a real codebase that compiled for several stable versions.

@compiler-errors
Copy link
Member

@Swatinem @lukas-code: I'd be fine landing a PR that excludes future-desugared async blocks from this hack.

@Swatinem
Copy link
Contributor

Swatinem commented Jun 4, 2023

I opened #112266 with a fix and regression test.

Thanks so much @lukas-code for finding the code responsible for this, I sure would have gone crazy with this :-D

@marhkb As both the culprit PR and the 1.70 beta went through a crater run, we are wondering why this was never caught earlier? Is it correct to assume your code exhibiting this problem is closed source? Or is it in some public repo that is not yet scraped by crater?

@marhkb
Copy link
Author

marhkb commented Jun 4, 2023

@marhkb As both the culprit PR and the 1.70 beta went through a crater run, we are wondering why this was never caught earlier? Is it correct to assume your code exhibiting this problem is closed source? Or is it in some public repo that is not yet scraped by crater?

My code is GPLv3 and can be found here on GitHub. I've never heard of crater and I don't think it is scraped. But it would really cool if it could scrape my project, too. To actually build it, you also need some system libraries installed like glib2, gtk4, libadwaita, etc. No idea whether crater can handle this special case.

@Swatinem
Copy link
Contributor

Swatinem commented Jun 4, 2023

Crater should automatically pick up any public Rust project on github. But I’m not an expert on it by any means. Its quite possible that it ignores certain crates that depend on specific system libraries.

@lukas-code
Copy link
Member

Your repo is on crater under the name "symphony", but it's failing to build due to outdated system libraries.

crater log
[INFO] cloning repository https://github.com/marhkb/symphony
[INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/marhkb/symphony" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fmarhkb%2Fsymphony", kill_on_drop: false }`
[INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fmarhkb%2Fsymphony'...
[INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }`
[INFO] [stdout] ef83422e4f3fb2d662fccaa0156a921e9a13ac0d
[INFO] checking marhkb/symphony against master#9a7cc6c32f1a690f86827e4724bcda85e506ef35 for pr-104833
[INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fmarhkb%2Fsymphony" "/workspace/builds/worker-1-tc1/source", kill_on_drop: false }`
[INFO] [stderr] Cloning into '/workspace/builds/worker-1-tc1/source'...
[INFO] [stderr] done.
[INFO] validating manifest of git repo https://github.com/marhkb/symphony on toolchain 9a7cc6c32f1a690f86827e4724bcda85e506ef35
[INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+9a7cc6c32f1a690f86827e4724bcda85e506ef35" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }`
[INFO] started tweaking git repo https://github.com/marhkb/symphony
[INFO] finished tweaking git repo https://github.com/marhkb/symphony
[INFO] tweaked toml for git repo https://github.com/marhkb/symphony written to /workspace/builds/worker-1-tc1/source/Cargo.toml
[INFO] crate git repo https://github.com/marhkb/symphony already has a lockfile, it will not be regenerated
[INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+9a7cc6c32f1a690f86827e4724bcda85e506ef35" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }`
[INFO] [stderr]     Updating git repository `https://github.com/vv9k/podman-api-rs.git`
[INFO] [stderr]     Updating git repository `https://github.com/vv9k/containers-api`
[INFO] [stderr]  Downloading crates ...
[INFO] [stderr]   Downloaded gdk4-sys v0.5.5
[INFO] [stderr]   Downloaded gettext-rs v0.7.0
[INFO] [stderr]   Downloaded sourceview5-sys v0.5.0
[INFO] [stderr]   Downloaded names v0.14.0
[INFO] [stderr]   Downloaded libpanel v0.1.1
[INFO] [stderr]   Downloaded sourceview5 v0.5.0
[INFO] [stderr]   Downloaded gdk4-wayland v0.5.5
[INFO] [stderr]   Downloaded gdk4-wayland-sys v0.5.5
[INFO] [stderr]   Downloaded gdk4-x11-sys v0.5.4
[INFO] [stderr]   Downloaded pango v0.16.5
[INFO] [stderr]   Downloaded gtk4-macros v0.5.5
[INFO] [stderr]   Downloaded gdk4 v0.5.5
[INFO] [stderr]   Downloaded syslog v6.0.1
[INFO] [stderr]   Downloaded gdk-pixbuf v0.16.7
[INFO] [stderr]   Downloaded graphene-rs v0.16.3
[INFO] [stderr]   Downloaded vte v0.11.0
[INFO] [stderr]   Downloaded ordered-stream v0.1.4
[INFO] [stderr]   Downloaded zvariant v3.10.0
[INFO] [stderr]   Downloaded gsk4 v0.5.5
[INFO] [stderr]   Downloaded zvariant_derive v3.10.0
[INFO] [stderr]   Downloaded libpanel-sys v0.1.1
[INFO] [stderr]   Downloaded libadwaita-sys v0.2.1
[INFO] [stderr]   Downloaded gio v0.16.7
[INFO] [stderr]   Downloaded zbus_macros v3.9.0
[INFO] [stderr]   Downloaded zbus v3.9.0
[INFO] [stderr]   Downloaded libadwaita v0.2.1
[INFO] [stderr]   Downloaded locale_config v0.3.0
[INFO] [stderr]   Downloaded gtk4 v0.5.5
[INFO] [stderr]   Downloaded cairo-rs v0.16.7
[INFO] [stderr]   Downloaded glib v0.16.7
[INFO] [stderr]   Downloaded glib-macros v0.16.3
[INFO] [stderr]   Downloaded graphene-sys v0.16.3
[INFO] [stderr]   Downloaded vte4-sys v0.5.0
[INFO] [stderr]   Downloaded gettext-sys v0.21.3
[INFO] [stderr]   Downloaded vte4 v0.5.0
[INFO] [stderr]   Downloaded gsk4-sys v0.5.5
[INFO] [stderr]   Downloaded gtk4-sys v0.5.5
[INFO] [stderr]   Downloaded gdk4-x11 v0.5.4
[INFO] [stderr]   Downloaded ashpd v0.4.0-alpha.2
[INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:542af8c9c691278ea8427c9f55ce1005b509eeebcbbcbc893145cd6832507671" "/opt/rustwide/cargo-home/bin/cargo" "+9a7cc6c32f1a690f86827e4724bcda85e506ef35" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }`
[INFO] [stdout] 5dcad20099aea9902c7d4e972bafca0130f5dad7ce6691e477c979651219882e
[INFO] running `Command { std: "docker" "start" "-a" "5dcad20099aea9902c7d4e972bafca0130f5dad7ce6691e477c979651219882e", kill_on_drop: false }`
[INFO] running `Command { std: "docker" "inspect" "5dcad20099aea9902c7d4e972bafca0130f5dad7ce6691e477c979651219882e", kill_on_drop: false }`
[INFO] running `Command { std: "docker" "rm" "-f" "5dcad20099aea9902c7d4e972bafca0130f5dad7ce6691e477c979651219882e", kill_on_drop: false }`
[INFO] [stdout] 5dcad20099aea9902c7d4e972bafca0130f5dad7ce6691e477c979651219882e
[INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:542af8c9c691278ea8427c9f55ce1005b509eeebcbbcbc893145cd6832507671" "/opt/rustwide/cargo-home/bin/cargo" "+9a7cc6c32f1a690f86827e4724bcda85e506ef35" "check" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }`
[INFO] [stdout] ec40382e803d12eb6c69f70e634a2e95e6750f0e0232d623ce44b69deeca3604
[INFO] running `Command { std: "docker" "start" "-a" "ec40382e803d12eb6c69f70e634a2e95e6750f0e0232d623ce44b69deeca3604", kill_on_drop: false }`
[INFO] [stderr]    Compiling autocfg v1.1.0
[INFO] [stderr]    Compiling libc v0.2.139
[INFO] [stderr]    Compiling proc-macro2 v1.0.51
[INFO] [stderr]    Compiling serde v1.0.152
[INFO] [stderr]    Compiling quote v1.0.23
[INFO] [stderr]    Compiling unicode-ident v1.0.6
[INFO] [stderr]    Compiling smallvec v1.10.0
[INFO] [stderr]    Compiling heck v0.4.1
[INFO] [stderr]    Compiling pkg-config v0.3.26
[INFO] [stderr]    Compiling version-compare v0.1.1
[INFO] [stderr]    Compiling syn v1.0.107
[INFO] [stderr]    Compiling memchr v2.5.0
[INFO] [stderr]    Compiling futures-core v0.3.26
[INFO] [stderr]    Compiling version_check v0.9.4
[INFO] [stderr]     Checking pin-project-lite v0.2.9
[INFO] [stderr]     Checking futures-io v0.3.26
[INFO] [stderr]    Compiling thiserror v1.0.38
[INFO] [stderr]    Compiling futures-channel v0.3.26
[INFO] [stderr]    Compiling futures-task v0.3.26
[INFO] [stderr]    Compiling cfg-expr v0.11.0
[INFO] [stderr]    Compiling futures-util v0.3.26
[INFO] [stderr]    Compiling hashbrown v0.12.3
[INFO] [stderr]     Checking futures-sink v0.3.26
[INFO] [stderr]    Compiling toml_datetime v0.5.1
[INFO] [stderr]    Compiling once_cell v1.17.0
[INFO] [stderr]    Compiling slab v0.4.7
[INFO] [stderr]    Compiling indexmap v1.9.2
[INFO] [stderr]    Compiling proc-macro-error-attr v1.0.4
[INFO] [stderr]    Compiling anyhow v1.0.69
[INFO] [stderr]    Compiling proc-macro-error v1.0.4
[INFO] [stderr]    Compiling log v0.4.17
[INFO] [stderr]    Compiling serde_derive v1.0.152
[INFO] [stderr]    Compiling gio v0.16.7
[INFO] [stderr]    Compiling ucd-trie v0.1.5
[INFO] [stderr]    Compiling memoffset v0.6.5
[INFO] [stderr]     Checking bytes v1.4.0
[INFO] [stderr]    Compiling nom8 v0.2.0
[INFO] [stderr]    Compiling tokio v1.25.0
[INFO] [stderr]     Checking tinyvec_macros v0.1.1
[INFO] [stderr]     Checking itoa v1.0.5
[INFO] [stderr]     Checking tinyvec v1.6.0
[INFO] [stderr]    Compiling typenum v1.16.0
[INFO] [stderr]    Compiling generic-array v0.14.6
[INFO] [stderr]     Checking percent-encoding v2.2.0
[INFO] [stderr]     Checking unicode-bidi v0.3.10
[INFO] [stderr]     Checking tracing-core v0.1.30
[INFO] [stderr]     Checking form_urlencoded v1.1.0
[INFO] [stderr]    Compiling num-traits v0.2.15
[INFO] [stderr]    Compiling crossbeam-utils v0.8.14
[INFO] [stderr]    Compiling num-integer v0.1.45
[INFO] [stderr]    Compiling lock_api v0.4.9
[INFO] [stderr]     Checking event-listener v2.5.3
[INFO] [stderr]     Checking fastrand v1.8.0
[INFO] [stderr]    Compiling parking_lot_core v0.9.7
[INFO] [stderr]    Compiling httparse v1.8.0
[INFO] [stderr]     Checking http v0.2.8
[INFO] [stderr]    Compiling polling v2.5.2
[INFO] [stderr]     Checking futures-lite v1.12.0
[INFO] [stderr]     Checking ppv-lite86 v0.2.17
[INFO] [stderr]     Checking hex v0.4.3
[INFO] [stderr]    Compiling serde_json v1.0.92
[INFO] [stderr]    Compiling crc32fast v1.3.2
[INFO] [stderr]     Checking try-lock v0.2.4
[INFO] [stderr]    Compiling pin-project-internal v0.4.30
[INFO] [stderr]     Checking socket2 v0.4.7
[INFO] [stderr]     Checking num_cpus v1.15.0
[INFO] [stderr]     Checking signal-hook-registry v1.4.0
[INFO] [stderr]     Checking mio v0.8.5
[INFO] [stderr]     Checking unicode-normalization v0.1.22
[INFO] [stderr]     Checking getrandom v0.2.8
[INFO] [stderr]     Checking want v0.3.0
[INFO] [stderr]     Checking filetime v0.2.19
[INFO] [stderr]     Checking time v0.1.45
[INFO] [stderr]     Checking rand_core v0.6.4
[INFO] [stderr]     Checking xattr v0.2.3
[INFO] [stderr]     Checking concurrent-queue v2.1.0
[INFO] [stderr]    Compiling aho-corasick v0.7.20
[INFO] [stderr]     Checking http-body v0.4.5
[INFO] [stderr]    Compiling async-io v1.12.0
[INFO] [stderr]     Checking rand_chacha v0.3.1
[INFO] [stderr]     Checking async-lock v2.6.0
[INFO] [stderr]    Compiling regex-syntax v0.6.28
[INFO] [stderr]    Compiling async-trait v0.1.64
[INFO] [stderr]     Checking iana-time-zone v0.1.53
[INFO] [stderr]     Checking idna v0.3.0
[INFO] [stderr]     Checking static_assertions v1.1.0
[INFO] [stderr]     Checking ryu v1.0.12
[INFO] [stderr]    Compiling paste v1.0.11
[INFO] [stderr]    Compiling temp-dir v0.1.11
[INFO] [stderr]    Compiling cc v1.0.79
[INFO] [stderr]     Checking tower-service v0.3.2
[INFO] [stderr]     Checking httpdate v1.0.2
[INFO] [stderr]     Checking miniz_oxide v0.6.2
[INFO] [stderr]     Checking rand v0.8.5
[INFO] [stderr]     Checking parking_lot v0.12.1
[INFO] [stderr]     Checking dirs-sys v0.3.7
[INFO] [stderr]    Compiling error-chain v0.12.4
[INFO] [stderr]     Checking cpufeatures v0.2.5
[INFO] [stderr]     Checking async-task v4.3.0
[INFO] [stderr]     Checking dirs v4.0.0
[INFO] [stderr]     Checking flate2 v1.0.25
[INFO] [stderr]     Checking async-broadcast v0.5.0
[INFO] [stderr]     Checking async-executor v1.5.0
[INFO] [stderr]     Checking tar v0.4.38
[INFO] [stderr]     Checking nix v0.25.1
[INFO] [stderr]     Checking crypto-common v0.1.6
[INFO] [stderr]     Checking block-buffer v0.10.3
[INFO] [stderr]     Checking ordered-stream v0.1.4
[INFO] [stderr]     Checking time-core v0.1.0
[INFO] [stderr]    Compiling toml_edit v0.18.1
[INFO] [stderr]     Checking digest v0.10.6
[INFO] [stderr]     Checking num_threads v0.1.6
[INFO] [stderr]    Compiling names v0.14.0
[INFO] [stderr]     Checking hostname v0.3.1
[INFO] [stderr]     Checking time v0.3.17
[INFO] [stderr]     Checking sha1 v0.10.5
[INFO] [stderr]    Compiling vte_generate_state_changes v0.1.1
[INFO] [stderr]     Checking base64 v0.13.1
[INFO] [stderr]     Checking utf8parse v0.2.0
[INFO] [stderr]    Compiling gettext-sys v0.21.3
[INFO] [stderr]    Compiling toml v0.5.11
[INFO] [stderr]     Checking vte v0.11.0
[INFO] [stderr]     Checking syslog v6.0.1
[INFO] [stderr]     Checking regex v1.7.1
[INFO] [stderr]    Compiling proc-macro-crate v1.3.0
[INFO] [stderr]    Compiling system-deps v6.0.3
[INFO] [stderr]     Checking locale_config v0.3.0
[INFO] [stderr]    Compiling glib-sys v0.16.3
[INFO] [stderr]    Compiling gobject-sys v0.16.3
[INFO] [stderr]    Compiling gio-sys v0.16.3
[INFO] [stderr]    Compiling gdk-pixbuf-sys v0.16.3
[INFO] [stderr]    Compiling cairo-sys-rs v0.16.3
[INFO] [stderr]    Compiling pango-sys v0.16.3
[INFO] [stderr]    Compiling gdk4-sys v0.5.5
[INFO] [stderr]    Compiling gtk4-sys v0.5.5
[INFO] [stderr]    Compiling graphene-sys v0.16.3
[INFO] [stderr]    Compiling gsk4-sys v0.5.5
[INFO] [stderr]    Compiling libadwaita-sys v0.2.1
[INFO] [stderr]    Compiling gdk4-x11-sys v0.5.4
[INFO] [stderr] The following warnings were emitted during compilation:
[INFO] [stderr] 
[INFO] [stderr] warning: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "gobject-2.0" "gobject-2.0 >= 2.73"` did not exit successfully: exit status: 1
[INFO] [stderr] 
[INFO] [stderr] error: failed to run custom build command for `gobject-sys v0.16.3`
[INFO] [stderr] note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/target/debug/build/gobject-sys-ff753d4b2e927975/build-script-build` (exit status: 1)
[INFO] [stderr]   --- stdout
[INFO] [stderr]   cargo:rerun-if-env-changed=GOBJECT_2.0_NO_PKG_CONFIG
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_PATH
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
[INFO] [stderr]   cargo:warning=`PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "gobject-2.0" "gobject-2.0 >= 2.73"` did not exit successfully: exit status: 1
[INFO] [stderr]   error: could not find system library 'gobject-2.0' required by the 'gobject-sys' crate
[INFO] [stderr] 
[INFO] [stderr]   --- stderr
[INFO] [stderr]   Requested 'gobject-2.0 >= 2.73' but version of GObject is 2.72.4
[INFO] [stderr] 
[INFO] [stderr] warning: build failed, waiting for other jobs to finish...
[INFO] [stderr] The following warnings were emitted during compilation:
[INFO] [stderr] 
[INFO] [stderr] warning: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "gio-2.0" "gio-2.0 >= 2.73"` did not exit successfully: exit status: 1
[INFO] [stderr] 
[INFO] [stderr] error: failed to run custom build command for `gio-sys v0.16.3`
[INFO] [stderr] note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
[INFO] [stderr] 
[INFO] [stderr] Caused by:
[INFO] [stderr]   process didn't exit successfully: `/opt/rustwide/target/debug/build/gio-sys-6dde261b9560f9e9/build-script-build` (exit status: 1)
[INFO] [stderr]   --- stdout
[INFO] [stderr]   cargo:rerun-if-env-changed=GIO_2.0_NO_PKG_CONFIG
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_PATH
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
[INFO] [stderr]   cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
[INFO] [stderr]   cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
[INFO] [stderr]   cargo:warning=`PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "gio-2.0" "gio-2.0 >= 2.73"` did not exit successfully: exit status: 1
[INFO] [stderr]   error: could not find system library 'gio-2.0' required by the 'gio-sys' crate
[INFO] [stderr] 
[INFO] [stderr]   --- stderr
[INFO] [stderr]   Requested 'gio-2.0 >= 2.73' but version of GIO is 2.72.4
[INFO] [stderr] 
[INFO] running `Command { std: "docker" "inspect" "ec40382e803d12eb6c69f70e634a2e95e6750f0e0232d623ce44b69deeca3604", kill_on_drop: false }`
[INFO] running `Command { std: "docker" "rm" "-f" "ec40382e803d12eb6c69f70e634a2e95e6750f0e0232d623ce44b69deeca3604", kill_on_drop: false }`
[INFO] [stdout] ec40382e803d12eb6c69f70e634a2e95e6750f0e0232d623ce44b69deeca3604

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 4, 2023
…r=compiler-errors

Fix type-inference regression in rust-lang#112225

The type inference of argument-position closures and async blocks regressed in 1.70 as the evaluation order of async blocks changed, as they are not implicitly wrapped in an identity-function anymore.

Fixes rust-lang#112225 by making sure the evaluation order stays the same as it used to.

r? `@compiler-errors`

As this was a stable-to-stable regression, it might be worth to consider backporting. Although the workaround for this is trivial as well: Just wrap the async block in another block.
@bors bors closed this as completed in 75b557a Jun 5, 2023
@apiraino
Copy link
Contributor

apiraino commented Jun 5, 2023

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

Note: unsure if we wanted to keep issues open when the fix is nominated for a backport

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 5, 2023
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 5, 2023
Mark-Simulacrum pushed a commit to Mark-Simulacrum/rust that referenced this issue Jun 24, 2023
The type inference of argument-position closures and async blocks
regressed in 1.70 as the evaluation order of async blocks changed, as
they are not implicitly wrapped in an identity-function anymore.

Fixes rust-lang#112225 by making sure the evaluation order stays the same as it
used to.
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 24, 2023
…k-Simulacrum

[beta] backport

This PR backports:

- rust-lang#112684: Disable alignment checks on i686-pc-windows-msvc
- rust-lang#112581: [rustdoc] Fix URL encoding of % sign
- rust-lang#112312: Update to LLVM 16.0.5
- rust-lang#112266: Fix type-inference regression in rust-lang#112225
- rust-lang#112062: Make struct layout not depend on unsizeable tail

r? `@Mark-Simulacrum`
xobs pushed a commit to betrusted-io/rust that referenced this issue Aug 5, 2023
The type inference of argument-position closures and async blocks
regressed in 1.70 as the evaluation order of async blocks changed, as
they are not implicitly wrapped in an identity-function anymore.

Fixes rust-lang#112225 by making sure the evaluation order stays the same as it
used to.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-inference Area: Type inference C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@Swatinem @marhkb @compiler-errors @apiraino @lukas-code @rustbot and others