Fix handling of const params defaults that ref Self & generalize diag

We used to lower such bad defaulted const args in trait object types to
`{type error}`; now correctly lower them to `{const error}`.

The added tests used to ICE prior to this change.
This commit is contained in:
León Orell Valerian Liehr 2026-01-07 16:32:14 +01:00
parent baba337869
commit 233a45c41a
No known key found for this signature in database
GPG key ID: D17A07215F68E713
14 changed files with 139 additions and 108 deletions

View file

@ -1,6 +0,0 @@
//@ known-bug: #136063
#![feature(generic_const_exprs)]
trait A<const B: u8 = X> {}
impl A<1> for bool {}
fn bar(arg : &dyn A<x>) { bar(true) }
pub fn main() {}

View file

@ -1,11 +0,0 @@
//@ known-bug: #137260
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
trait Iter<const N: usize = { 1 + true }> {}
fn needs_iter<const N: usize, T: Iter<N>>() {}
fn test() {
needs_iter::<1, dyn Iter<()>>();
}

View file

@ -1,9 +0,0 @@
//@ known-bug: #137514
//@ needs-rustc-debug-assertions
#![feature(generic_const_exprs)]
trait Bar<const N: usize> {}
trait BB = Bar<{ 1i32 + 1 }>;
fn foo(x: &dyn BB) {}