diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-10-25 17:40:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-25 17:40:28 +0200 |
| commit | 75efc4fd9e8aaf2d587be2f7f853b52ba5852e1d (patch) | |
| tree | acde80c1a57d0d8366f04d8ac2862832ab309f77 | |
| parent | b66fe58f68d84cf422ff50c362ac5ad245cd9ce7 (diff) | |
| parent | 43a08bd29969be0f8b83a525b46cfa9e4b99e863 (diff) | |
| download | rust-75efc4fd9e8aaf2d587be2f7f853b52ba5852e1d.tar.gz rust-75efc4fd9e8aaf2d587be2f7f853b52ba5852e1d.zip | |
Rollup merge of #116801 - clubby789:issue-113326-test, r=compiler-errors
Add test for 113326 Closes #113326 Bisecting points to #113636 as the fix
| -rw-r--r-- | tests/ui/type-alias-impl-trait/recursive-fn-tait.rs | 17 | ||||
| -rw-r--r-- | tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr | 14 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs new file mode 100644 index 00000000000..3d1759097d6 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs @@ -0,0 +1,17 @@ +// test for #113326 +#![feature(type_alias_impl_trait)] + +pub type Diff = impl Fn(usize) -> usize; + +pub fn lift() -> Diff { + |_: usize |loop {} +} + +pub fn add( + n: Diff, + m: Diff, +) -> Diff { + move |x: usize| m(n(x)) //~ ERROR: concrete type differs +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr new file mode 100644 index 00000000000..b2898a21190 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr @@ -0,0 +1,14 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/recursive-fn-tait.rs:14:5 + | +LL | move |x: usize| m(n(x)) + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `{closure@$DIR/recursive-fn-tait.rs:7:5: 7:16}`, got `{closure@$DIR/recursive-fn-tait.rs:14:5: 14:20}` + | +note: previous use here + --> $DIR/recursive-fn-tait.rs:7:5 + | +LL | |_: usize |loop {} + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + |
