bless tests
This commit is contained in:
parent
963f82d322
commit
ec03e39afd
9 changed files with 86 additions and 18 deletions
|
|
@ -15,6 +15,7 @@ trait Trait {
|
|||
struct Hold<T: ?Sized>(T);
|
||||
|
||||
trait Bound = Trait<Y = { Hold::<Self> }>;
|
||||
//~^ ERROR the constant `Hold::<Self>` is not of type `i32`
|
||||
|
||||
fn main() {
|
||||
let _: dyn Bound; //~ ERROR associated constant binding in trait object type mentions `Self`
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
error: the constant `Hold::<Self>` is not of type `i32`
|
||||
--> $DIR/dyn-compat-const-projection-behind-trait-alias-mentions-self.rs:17:21
|
||||
|
|
||||
LL | trait Bound = Trait<Y = { Hold::<Self> }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected `i32`, found struct constructor
|
||||
|
|
||||
note: required by a const generic parameter in `Bound`
|
||||
--> $DIR/dyn-compat-const-projection-behind-trait-alias-mentions-self.rs:17:21
|
||||
|
|
||||
LL | trait Bound = Trait<Y = { Hold::<Self> }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Bound`
|
||||
|
||||
error: associated constant binding in trait object type mentions `Self`
|
||||
--> $DIR/dyn-compat-const-projection-behind-trait-alias-mentions-self.rs:20:12
|
||||
--> $DIR/dyn-compat-const-projection-behind-trait-alias-mentions-self.rs:21:12
|
||||
|
|
||||
LL | trait Bound = Trait<Y = { Hold::<Self> }>;
|
||||
| -------------------- this binding mentions `Self`
|
||||
|
|
@ -7,5 +19,5 @@ LL | trait Bound = Trait<Y = { Hold::<Self> }>;
|
|||
LL | let _: dyn Bound;
|
||||
| ^^^^^^^^^ contains a mention of `Self`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
//! Check associated const binding with escaping bound vars doesn't cause ICE
|
||||
//! (#151642)
|
||||
//@ check-pass
|
||||
|
||||
#![feature(min_generic_const_args)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
trait Trait2<'a> { type const ASSOC: i32; }
|
||||
fn g(_: for<'a> fn(Box<dyn Trait2<'a, ASSOC = 10>>)) {}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
//@ known-bug: unknown
|
||||
//@ check-pass
|
||||
//! Check that we correctly handle associated const bindings
|
||||
//! in `impl Trait` where the RHS is a const param (#151642).
|
||||
|
||||
#![feature(min_generic_const_args)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
trait Trait { #[type_const] const CT: bool; }
|
||||
trait Trait { type const CT: bool; }
|
||||
|
||||
// FIXME: this should yield a type mismatch (`bool` v `i32`)
|
||||
fn f<const N: i32>(_: impl Trait<CT = { N }>) {}
|
||||
|
||||
//~^ ERROR the constant `N` is not of type `bool`
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
error: the constant `N` is not of type `bool`
|
||||
--> $DIR/wf-mismatch-1.rs:9:34
|
||||
|
|
||||
LL | fn f<const N: i32>(_: impl Trait<CT = { N }>) {}
|
||||
| ^^^^^^^^^^ expected `bool`, found `i32`
|
||||
|
|
||||
note: required by a const generic parameter in `f`
|
||||
--> $DIR/wf-mismatch-1.rs:9:34
|
||||
|
|
||||
LL | fn f<const N: i32>(_: impl Trait<CT = { N }>) {}
|
||||
| ^^^^^^^^^^ required by this const generic parameter in `f`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
//@ known-bug: unknown
|
||||
//@ check-pass
|
||||
//! Check that we correctly handle associated const bindings
|
||||
//! in `dyn Trait` where the RHS is a const param (#151642).
|
||||
|
||||
#![feature(min_generic_const_args)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
trait Trait { #[type_const] const CT: bool; }
|
||||
trait Trait { type const CT: bool; }
|
||||
|
||||
fn f<const N: i32>() {
|
||||
let _: dyn Trait<CT = { N }>; // FIXME: this should yield a type mismatch (`bool` v `i32`)
|
||||
let _: dyn Trait<CT = { N }>;
|
||||
//~^ ERROR the constant `N` is not of type `bool`
|
||||
}
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
error: the constant `N` is not of type `bool`
|
||||
--> $DIR/wf-mismatch-2.rs:10:12
|
||||
|
|
||||
LL | let _: dyn Trait<CT = { N }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `i32`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
@ -1,15 +1,17 @@
|
|||
//@ known-bug: unknown
|
||||
//@ check-pass
|
||||
//! Check that we correctly handle associated const bindings
|
||||
//! where the RHS is a normalizable const projection (#151642).
|
||||
|
||||
#![feature(min_generic_const_args)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
trait Trait { #[type_const] const CT: bool; }
|
||||
trait Trait { type const CT: bool; }
|
||||
|
||||
trait Bound { #[type_const] const N: u32; }
|
||||
impl Bound for () { #[type_const] const N: u32 = 0; }
|
||||
trait Bound { type const N: u32; }
|
||||
impl Bound for () { type const N: u32 = 0; }
|
||||
|
||||
fn f() { let _: dyn Trait<CT = { <() as Bound>::N }>; } // FIXME
|
||||
fn g(_: impl Trait<CT = { <() as Bound>::N }>) {} // FIXME
|
||||
fn f() { let _: dyn Trait<CT = { <() as Bound>::N }>; }
|
||||
//~^ ERROR the constant `0` is not of type `bool`
|
||||
fn g(_: impl Trait<CT = { <() as Bound>::N }>) {}
|
||||
//~^ ERROR the constant `0` is not of type `bool`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
error: the constant `0` is not of type `bool`
|
||||
--> $DIR/wf-mismatch-3.rs:14:20
|
||||
|
|
||||
LL | fn g(_: impl Trait<CT = { <() as Bound>::N }>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `u32`
|
||||
|
|
||||
note: required by a const generic parameter in `g`
|
||||
--> $DIR/wf-mismatch-3.rs:14:20
|
||||
|
|
||||
LL | fn g(_: impl Trait<CT = { <() as Bound>::N }>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `g`
|
||||
|
||||
error: the constant `0` is not of type `bool`
|
||||
--> $DIR/wf-mismatch-3.rs:12:17
|
||||
|
|
||||
LL | fn f() { let _: dyn Trait<CT = { <() as Bound>::N }>; }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `u32`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue