From 4547b622d8d29df964fa2914213088b148c498fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:32 +0200 Subject: Merging upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/const-generics/inhabited-assoc-ty-ice-1.rs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/test/ui/const-generics/inhabited-assoc-ty-ice-1.rs (limited to 'src/test/ui/const-generics/inhabited-assoc-ty-ice-1.rs') diff --git a/src/test/ui/const-generics/inhabited-assoc-ty-ice-1.rs b/src/test/ui/const-generics/inhabited-assoc-ty-ice-1.rs new file mode 100644 index 000000000..b385406b0 --- /dev/null +++ b/src/test/ui/const-generics/inhabited-assoc-ty-ice-1.rs @@ -0,0 +1,28 @@ +// run-pass +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +// This tests that the inhabited check doesn't cause +// ICEs by trying to evaluate `T::ASSOC` with an incorrect `ParamEnv`. + +trait Foo { + const ASSOC: usize = 1; +} + +#[allow(unused_tuple_struct_fields)] +struct Iced(T, [(); T::ASSOC]) +where + [(); T::ASSOC]: ; + +impl Foo for u32 {} + +fn foo() +where + [(); T::ASSOC]: , +{ + let _iced: Iced = return; +} + +fn main() { + foo::(); +} -- cgit v1.2.3