diff options
author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-23 20:06:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-23 20:06:33 +0200 |
commit | 12858d9a6154e92c6f739c00a80f021515e9b7bb (patch) | |
tree | ca9688068315f9546f20f7a3a5d27c25584e60c7 /tests/ui | |
parent | 96acbd8e287b9e03d2255334e0747253dace83b1 (diff) | |
parent | c8874e24458e7ba88fad7969562a45c951d002a8 (diff) | |
download | rust-12858d9a6154e92c6f739c00a80f021515e9b7bb.tar.gz |
Rollup merge of #110700 - compiler-errors:fn-ret-fn, r=oli-obk
Don't infer fn return type to return itself
Fixes #110687
Diffstat (limited to 'tests/ui')
-rw-r--r-- | tests/ui/typeck/bad-recursive-type-sig-infer.rs | 11 | ||||
-rw-r--r-- | tests/ui/typeck/bad-recursive-type-sig-infer.stderr | 15 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/typeck/bad-recursive-type-sig-infer.rs b/tests/ui/typeck/bad-recursive-type-sig-infer.rs new file mode 100644 index 00000000000..9812d8c3811 --- /dev/null +++ b/tests/ui/typeck/bad-recursive-type-sig-infer.rs @@ -0,0 +1,11 @@ +fn a() -> _ { + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + &a +} + +fn b() -> _ { + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + &a +} + +fn main() {} diff --git a/tests/ui/typeck/bad-recursive-type-sig-infer.stderr b/tests/ui/typeck/bad-recursive-type-sig-infer.stderr new file mode 100644 index 00000000000..e145da5623a --- /dev/null +++ b/tests/ui/typeck/bad-recursive-type-sig-infer.stderr @@ -0,0 +1,15 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/bad-recursive-type-sig-infer.rs:1:11 + | +LL | fn a() -> _ { + | ^ not allowed in type signatures + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/bad-recursive-type-sig-infer.rs:6:11 + | +LL | fn b() -> _ { + | ^ not allowed in type signatures + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0121`. |