tests: unconstrain params in non_lifetime_binders

It seems like generics from `non_lifetime_binders` don't have any default
bounds like normal generics, so all of the `?Sized` relaxations need
to be further relaxed with `PointeeSized` for this test to be the
equivalent of before.
This commit is contained in:
David Wood 2025-02-12 20:43:19 +00:00
parent cb711504bd
commit 8f19fd0841
No known key found for this signature in database
16 changed files with 64 additions and 43 deletions

View file

@ -1,12 +1,15 @@
//@ check-pass
// Basic test that show's we can successfully typeck a `for<T>` where clause.
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete
trait Trait {}
use std::marker::PointeeSized;
impl<T: ?Sized> Trait for T {}
trait Trait: PointeeSized {}
impl<T: PointeeSized> Trait for T {}
fn foo()
where

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:4:12
--> $DIR/basic.rs:5:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,11 +1,14 @@
// Make sure not to construct predicates with escaping bound vars in `diagnostic_hir_wf_check`.
// Regression test for <https://github.com/rust-lang/rust/issues/139330>.
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete
trait A<T: ?Sized> {}
impl<T: ?Sized> A<T> for () {}
use std::marker::PointeeSized;
trait A<T: PointeeSized> {}
impl<T: PointeeSized> A<T> for () {}
trait B {}
struct W<T: B>(T);

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/diagnostic-hir-wf-check.rs:4:12
--> $DIR/diagnostic-hir-wf-check.rs:5:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^
@ -8,24 +8,24 @@ LL | #![feature(non_lifetime_binders)]
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `(): B` is not satisfied
--> $DIR/diagnostic-hir-wf-check.rs:13:12
--> $DIR/diagnostic-hir-wf-check.rs:16:12
|
LL | fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) }
| ^^^^^ the trait `B` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/diagnostic-hir-wf-check.rs:10:1
--> $DIR/diagnostic-hir-wf-check.rs:13:1
|
LL | trait B {}
| ^^^^^^^
note: required by a bound in `W`
--> $DIR/diagnostic-hir-wf-check.rs:11:13
--> $DIR/diagnostic-hir-wf-check.rs:14:13
|
LL | struct W<T: B>(T);
| ^ required by this bound in `W`
error[E0277]: the trait bound `(): B` is not satisfied
--> $DIR/diagnostic-hir-wf-check.rs:13:42
--> $DIR/diagnostic-hir-wf-check.rs:16:42
|
LL | fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) }
| - ^^ the trait `B` is not implemented for `()`
@ -33,29 +33,29 @@ LL | fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) }
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> $DIR/diagnostic-hir-wf-check.rs:10:1
--> $DIR/diagnostic-hir-wf-check.rs:13:1
|
LL | trait B {}
| ^^^^^^^
note: required by a bound in `W`
--> $DIR/diagnostic-hir-wf-check.rs:11:13
--> $DIR/diagnostic-hir-wf-check.rs:14:13
|
LL | struct W<T: B>(T);
| ^ required by this bound in `W`
error[E0277]: the trait bound `(): B` is not satisfied
--> $DIR/diagnostic-hir-wf-check.rs:13:40
--> $DIR/diagnostic-hir-wf-check.rs:16:40
|
LL | fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) }
| ^^^^^ the trait `B` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/diagnostic-hir-wf-check.rs:10:1
--> $DIR/diagnostic-hir-wf-check.rs:13:1
|
LL | trait B {}
| ^^^^^^^
note: required by a bound in `W`
--> $DIR/diagnostic-hir-wf-check.rs:11:13
--> $DIR/diagnostic-hir-wf-check.rs:14:13
|
LL | struct W<T: B>(T);
| ^ required by this bound in `W`

View file

@ -1,11 +1,14 @@
//@ check-pass
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete
trait Trait<T: ?Sized> {}
use std::marker::PointeeSized;
impl<T: ?Sized> Trait<T> for i32 {}
trait Trait<T: PointeeSized> {}
impl<T: PointeeSized> Trait<T> for i32 {}
fn produce() -> impl for<T> Trait<T> {
16

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/on-rpit.rs:3:12
--> $DIR/on-rpit.rs:4:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,19 +1,22 @@
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete
use std::marker::PointeeSized;
trait Foo: for<T> Bar<T> {}
trait Bar<T: ?Sized> {
trait Bar<T: PointeeSized>: PointeeSized {
fn method(&self) {}
}
fn needs_bar(x: &(impl Bar<i32> + ?Sized)) {
fn needs_bar(x: &(impl Bar<i32> + PointeeSized)) {
x.method();
}
impl Foo for () {}
impl<T: ?Sized> Bar<T> for () {}
impl<T: PointeeSized> Bar<T> for () {}
fn main() {
let x: &dyn Foo = &();

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-dyn-compatibility.rs:1:12
--> $DIR/supertrait-dyn-compatibility.rs:2:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^
@ -8,14 +8,14 @@ LL | #![feature(non_lifetime_binders)]
= note: `#[warn(incomplete_features)]` on by default
error[E0038]: the trait `Foo` is not dyn compatible
--> $DIR/supertrait-dyn-compatibility.rs:19:17
--> $DIR/supertrait-dyn-compatibility.rs:22:17
|
LL | let x: &dyn Foo = &();
| ^^^ `Foo` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> $DIR/supertrait-dyn-compatibility.rs:4:12
--> $DIR/supertrait-dyn-compatibility.rs:7:12
|
LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/unifying-placeholders-in-query-response-2.rs:6:12
--> $DIR/unifying-placeholders-in-query-response-2.rs:7:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/unifying-placeholders-in-query-response-2.rs:6:12
--> $DIR/unifying-placeholders-in-query-response-2.rs:7:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -3,19 +3,22 @@
//@[next] compile-flags: -Znext-solver
//@ check-pass
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete
trait Id {
type Output: ?Sized;
use std::marker::PointeeSized;
trait Id: PointeeSized {
type Output: PointeeSized;
}
impl<T: ?Sized> Id for T {
impl<T: PointeeSized> Id for T {
type Output = T;
}
trait Everyone {}
impl<T: ?Sized> Everyone for T {}
trait Everyone: PointeeSized {}
impl<T: PointeeSized> Everyone for T {}
fn hello() where for<T> <T as Id>::Output: Everyone {}

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/unifying-placeholders-in-query-response.rs:6:12
--> $DIR/unifying-placeholders-in-query-response.rs:7:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/unifying-placeholders-in-query-response.rs:6:12
--> $DIR/unifying-placeholders-in-query-response.rs:7:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^

View file

@ -3,15 +3,18 @@
//@[next] compile-flags: -Znext-solver
//@ check-pass
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete
pub trait Foo<T: ?Sized> {
type Bar<K: ?Sized>: ?Sized;
use std::marker::PointeeSized;
pub trait Foo<T: PointeeSized> {
type Bar<K: PointeeSized>: PointeeSized;
}
impl Foo<usize> for () {
type Bar<K: ?Sized> = K;
type Bar<K: PointeeSized> = K;
}
pub fn f<T1, T2>(a: T1, b: T2)

View file

@ -1,12 +1,15 @@
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete
trait Other<U: ?Sized> {}
use std::marker::PointeeSized;
impl<U: ?Sized> Other<U> for U {}
trait Other<U: PointeeSized>: PointeeSized {}
impl<U: PointeeSized> Other<U> for U {}
#[rustfmt::skip]
fn foo<U: ?Sized>()
fn foo<U: PointeeSized>()
where
for<T> T: Other<U> {}

View file

@ -1,5 +1,5 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/universe-error1.rs:1:12
--> $DIR/universe-error1.rs:2:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^
@ -8,15 +8,15 @@ LL | #![feature(non_lifetime_binders)]
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: the trait bound `T: Other<_>` is not satisfied
--> $DIR/universe-error1.rs:14:11
--> $DIR/universe-error1.rs:17:11
|
LL | foo::<_>();
| ^ the trait `Other<_>` is not implemented for `T`
|
note: required by a bound in `foo`
--> $DIR/universe-error1.rs:11:15
--> $DIR/universe-error1.rs:14:15
|
LL | fn foo<U: ?Sized>()
LL | fn foo<U: PointeeSized>()
| --- required by a bound in this function
LL | where
LL | for<T> T: Other<U> {}