From bb4769532b721d3c6355ac11910c273724a77967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 27 Apr 2024 14:52:52 +0200 Subject: [PATCH] add test for const generic ty's with lifetimes cause opaque types to ICE Fixes https://github.com/rust-lang/rust/issues/111911 --- ...ith_non-universal_region_substs_ice-111911.rs | 13 +++++++++++++ ...non-universal_region_substs_ice-111911.stderr | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.rs create mode 100644 tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.stderr diff --git a/tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.rs b/tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.rs new file mode 100644 index 00000000000..05bd0d91168 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.rs @@ -0,0 +1,13 @@ +//@ edition:2021 +// issues rust-lang/rust#111911 +// test for ICE opaque type with non-universal region substs + +#![feature(adt_const_params)] +#![allow(incomplete_features)] + +pub async fn foo() {} +//~^ ERROR const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias +//~| ERROR const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias +fn bar() -> impl Sized {} + +pub fn main() {} diff --git a/tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.stderr b/tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.stderr new file mode 100644 index 00000000000..1bdb9cd9501 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/opaque_type_with_non-universal_region_substs_ice-111911.stderr @@ -0,0 +1,16 @@ +error: const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/opaque_type_with_non-universal_region_substs_ice-111911.rs:8:43 + | +LL | pub async fn foo() {} + | ^^ + +error: const parameter `X` is part of concrete type but not used in parameter list for the `impl Trait` type alias + --> $DIR/opaque_type_with_non-universal_region_substs_ice-111911.rs:8:43 + | +LL | pub async fn foo() {} + | ^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors +