Add regression test for 141845

This commit is contained in:
reddevilmidzy 2025-12-05 00:39:55 +09:00
parent 63b1db0580
commit 3d0f5f2f88
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,13 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/141845>
//! Checks const resolution stability when using inherent associated types
//! and generic const arguments.
//@compile-flags: --crate-type=lib
#![expect(incomplete_features)]
#![feature(inherent_associated_types, min_generic_const_args)]
trait Trait {}
struct Struct<const N: usize>;
type Alias<T: Trait> = Struct<{ Struct::N }>;
//~^ ERROR: missing generics for struct `Struct` [E0107]

View file

@ -0,0 +1,19 @@
error[E0107]: missing generics for struct `Struct`
--> $DIR/resolution-with-inherent-associated-types.rs:12:33
|
LL | type Alias<T: Trait> = Struct<{ Struct::N }>;
| ^^^^^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `N`
--> $DIR/resolution-with-inherent-associated-types.rs:10:8
|
LL | struct Struct<const N: usize>;
| ^^^^^^ --------------
help: add missing generic argument
|
LL | type Alias<T: Trait> = Struct<{ Struct<N>::N }>;
| +++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0107`.