diff --git a/tests/ui/closures/2229_closure_analysis/migrations/opaque-field-projection.rs b/tests/ui/closures/2229_closure_analysis/migrations/opaque-field-projection.rs new file mode 100644 index 0000000000000..4ae2079a58255 --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/migrations/opaque-field-projection.rs @@ -0,0 +1,15 @@ +//! Regression test for: https://github.com/rust-lang/rust/issues/156837 +//@ compile-flags: -Znext-solver=globally --crate-type=lib +//@ edition: 2018 + +#![warn(rust_2021_incompatible_closure_captures)] + +async fn get() {} + +fn check() { + let mut v = get(); + (|| match v { + (1, _) => (), + //~^ ERROR mismatched types + })() +} diff --git a/tests/ui/closures/2229_closure_analysis/migrations/opaque-field-projection.stderr b/tests/ui/closures/2229_closure_analysis/migrations/opaque-field-projection.stderr new file mode 100644 index 0000000000000..c40d44e1a6dbc --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/migrations/opaque-field-projection.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/opaque-field-projection.rs:12:9 + | +LL | (|| match v { + | - this expression has type `impl Future` +LL | (1, _) => (), + | ^^^^^^ expected future, found `(_, _)` + | + = note: expected opaque type `impl Future` + found tuple `(_, _)` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`.