From e388f9eeb2130920f317cade97bfd4d89a2c766e Mon Sep 17 00:00:00 2001 From: Redddy Date: Fri, 4 Sep 2026 15:11:26 +0000 Subject: [PATCH] add test for direct-const-arg --- .../mgca/direct-const-arg-placeholder.rs | 10 +++++++++ .../mgca/direct-const-arg-placeholder.stderr | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/ui/const-generics/mgca/direct-const-arg-placeholder.rs create mode 100644 tests/ui/const-generics/mgca/direct-const-arg-placeholder.stderr diff --git a/tests/ui/const-generics/mgca/direct-const-arg-placeholder.rs b/tests/ui/const-generics/mgca/direct-const-arg-placeholder.rs new file mode 100644 index 0000000000000..72b5221c1fccd --- /dev/null +++ b/tests/ui/const-generics/mgca/direct-const-arg-placeholder.rs @@ -0,0 +1,10 @@ +//! Regression test for +#![feature(min_generic_const_args)] +struct S; + +fn foo() -> S { + //~^ ERROR: type annotations needed + //~| ERROR: the placeholder `_` is not allowed + todo!() +} +fn main() {} diff --git a/tests/ui/const-generics/mgca/direct-const-arg-placeholder.stderr b/tests/ui/const-generics/mgca/direct-const-arg-placeholder.stderr new file mode 100644 index 0000000000000..1d6b851b009e1 --- /dev/null +++ b/tests/ui/const-generics/mgca/direct-const-arg-placeholder.stderr @@ -0,0 +1,21 @@ +error[E0282]: type annotations needed + --> $DIR/direct-const-arg-placeholder.rs:5:43 + | +LL | fn foo() -> S { + | ___________________________________________^ +LL | | +LL | | +LL | | todo!() +LL | | } + | |_^ cannot infer type for struct `S<_>` + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/direct-const-arg-placeholder.rs:5:39 + | +LL | fn foo() -> S { + | ^ not allowed in type signatures + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0121, E0282. +For more information about an error, try `rustc --explain E0121`.