about summary refs log tree commit diff
path: root/tests/ui/generic-const-items
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2024-03-11 09:29:33 -0700
committerGitHub <noreply@github.com>2024-03-11 09:29:33 -0700
commita4503390ba89559fc60c0374116b4652736e27e4 (patch)
treef893928cd2239ad752ca14f287333d22072badd9 /tests/ui/generic-const-items
parente1ceadcdfeccc879ef5c1759dcc62daa2c7a6de8 (diff)
parent858d3362095851bde4f9cc3c132542f2ce9e9a15 (diff)
downloadrust-a4503390ba89559fc60c0374116b4652736e27e4.tar.gz
rust-a4503390ba89559fc60c0374116b4652736e27e4.zip
Rollup merge of #119385 - fmease:assoc-const-eq-fixes-2, r=oli-obk,cjgillot
Fix type resolution of associated const equality bounds (take 2)

Instead of trying to re-resolve the type of assoc const bindings inside the `type_of` query impl in an incomplete manner, transfer the already (correctly) resolved type from `add_predicates_for_ast_type_binding` to `type_of`/`anon_type_of` through query feeding.

---

Together with #118668 (merged) and #121258, this supersedes #118360.
Fixes #118040.

r? ``@ghost``
Diffstat (limited to 'tests/ui/generic-const-items')
-rw-r--r--tests/ui/generic-const-items/associated-const-equality.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/ui/generic-const-items/associated-const-equality.rs b/tests/ui/generic-const-items/associated-const-equality.rs
index 3c727097e2b..c0179f02fd2 100644
--- a/tests/ui/generic-const-items/associated-const-equality.rs
+++ b/tests/ui/generic-const-items/associated-const-equality.rs
@@ -1,22 +1,31 @@
 //@ check-pass
 
-#![feature(generic_const_items, associated_const_equality)]
+#![feature(generic_const_items, associated_const_equality, adt_const_params)]
 #![allow(incomplete_features)]
 
 trait Owner {
     const C<const N: u32>: u32;
     const K<const N: u32>: u32;
+    const Q<T>: Maybe<T>;
 }
 
 impl Owner for () {
     const C<const N: u32>: u32 = N;
     const K<const N: u32>: u32 = N + 1;
+    const Q<T>: Maybe<T> = Maybe::Nothing;
 }
 
 fn take0<const N: u32>(_: impl Owner<C<N> = { N }>) {}
 fn take1(_: impl Owner<K<99> = 100>) {}
+fn take2(_: impl Owner<Q<()> = { Maybe::Just(()) }>) {}
 
 fn main() {
     take0::<128>(());
     take1(());
 }
+
+#[derive(PartialEq, Eq, std::marker::ConstParamTy)]
+enum Maybe<T> {
+    Nothing,
+    Just(T),
+}