From 39679b68ac1b6ef5caecba8899c1cc86cd871cb0 Mon Sep 17 00:00:00 2001 From: zakrad <49591476+zakrad@users.noreply.github.com> Date: Sun, 8 Nov 2026 19:23:33 +0330 Subject: [PATCH] Add regression test for GCA associated const with a pattern type field --- .../assoc-const-pattern-type-field-162336.rs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/ui/const-generics/gca/assoc-const-pattern-type-field-162336.rs diff --git a/tests/ui/const-generics/gca/assoc-const-pattern-type-field-162336.rs b/tests/ui/const-generics/gca/assoc-const-pattern-type-field-162336.rs new file mode 100644 index 0000000000000..c64a0d89e49a7 --- /dev/null +++ b/tests/ui/const-generics/gca/assoc-const-pattern-type-field-162336.rs @@ -0,0 +1,26 @@ +//! Regression test for . +//@ build-pass +//@ compile-flags: -Znext-solver + +#![feature(gca_min_const_items, gca_const_items)] + +use std::time::Duration; + +trait Trait { + const CONST: Duration; +} + +struct Thing; + +impl Trait for Thing { + const CONST: Duration = Duration::ZERO; +} + +fn generic() -> Duration { + T::CONST +} + +fn main() { + let _ = ::CONST; + let _ = generic::(); +}