diff --git a/tests/ui/const-generics/mgca/ice-143358-nested-const-arg.rs b/tests/ui/const-generics/mgca/ice-143358-nested-const-arg.rs new file mode 100644 index 0000000000000..57a5bb514d2e7 --- /dev/null +++ b/tests/ui/const-generics/mgca/ice-143358-nested-const-arg.rs @@ -0,0 +1,18 @@ +//! Regression test for +//! +//! Using deeply nested const generic function calls in the type position of a +//! const parameter with both `generic_const_exprs` and `min_generic_const_args` +//! used to ICE with "unhandled node ConstArg" in `generics_of`. +//! Fixed by . + +#![feature(generic_const_exprs)] +//~^ WARN the feature `generic_const_exprs` is incomplete +#![feature(min_generic_const_args)] +//~^ WARN the feature `min_generic_const_args` is incomplete + +fn identity }>() }>>(); +//~^ ERROR free function without a body +//~| ERROR expected type, found function `identity` +//~| ERROR complex const arguments must be placed inside of a `const` block + +fn main() {} diff --git a/tests/ui/const-generics/mgca/ice-143358-nested-const-arg.stderr b/tests/ui/const-generics/mgca/ice-143358-nested-const-arg.stderr new file mode 100644 index 0000000000000..f1839d2aca16e --- /dev/null +++ b/tests/ui/const-generics/mgca/ice-143358-nested-const-arg.stderr @@ -0,0 +1,40 @@ +error: free function without a body + --> $DIR/ice-143358-nested-const-arg.rs:13:1 + | +LL | fn identity }>() }>>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: provide a definition for the function: `{ }` + +error[E0573]: expected type, found function `identity` + --> $DIR/ice-143358-nested-const-arg.rs:13:22 + | +LL | fn identity }>() }>>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/ice-143358-nested-const-arg.rs:8:12 + | +LL | #![feature(generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/ice-143358-nested-const-arg.rs:10:12 + | +LL | #![feature(min_generic_const_args)] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #132980 for more information + +error: complex const arguments must be placed inside of a `const` block + --> $DIR/ice-143358-nested-const-arg.rs:13:57 + | +LL | fn identity }>() }>>(); + | ^^ + +error: aborting due to 3 previous errors; 2 warnings emitted + +For more information about this error, try `rustc --explain E0573`.