Skip to content

Commit 781a5af

Browse files
committed
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.
1 parent 67e807e commit 781a5af

12 files changed

+43
-28
lines changed

tests/ui/traits/non_lifetime_binders/basic.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
//@ check-pass
22
// Basic test that show's we can successfully typeck a `for<T>` where clause.
33

4+
#![feature(sized_hierarchy)]
45
#![feature(non_lifetime_binders)]
56
//~^ WARN the feature `non_lifetime_binders` is incomplete
67

7-
trait Trait {}
8+
use std::marker::PointeeSized;
89

9-
impl<T: ?Sized> Trait for T {}
10+
trait Trait: PointeeSized {}
11+
12+
impl<T: PointeeSized> Trait for T {}
1013

1114
fn foo()
1215
where

tests/ui/traits/non_lifetime_binders/basic.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/basic.rs:4:12
2+
--> $DIR/basic.rs:5:12
33
|
44
LL | #![feature(non_lifetime_binders)]
55
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/traits/non_lifetime_binders/on-rpit.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
//@ check-pass
22

3+
#![feature(sized_hierarchy)]
34
#![feature(non_lifetime_binders)]
45
//~^ WARN the feature `non_lifetime_binders` is incomplete
56

6-
trait Trait<T: ?Sized> {}
7+
use std::marker::PointeeSized;
78

8-
impl<T: ?Sized> Trait<T> for i32 {}
9+
trait Trait<T: PointeeSized> {}
10+
11+
impl<T: PointeeSized> Trait<T> for i32 {}
912

1013
fn produce() -> impl for<T> Trait<T> {
1114
16

tests/ui/traits/non_lifetime_binders/on-rpit.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/on-rpit.rs:3:12
2+
--> $DIR/on-rpit.rs:4:12
33
|
44
LL | #![feature(non_lifetime_binders)]
55
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1+
#![feature(sized_hierarchy)]
12
#![feature(non_lifetime_binders)]
23
//~^ WARN the feature `non_lifetime_binders` is incomplete
34

5+
use std::marker::PointeeSized;
6+
47
trait Foo: for<T> Bar<T> {}
58

6-
trait Bar<T: ?Sized> {
9+
trait Bar<T: PointeeSized>: PointeeSized {
710
fn method(&self) {}
811
}
912

10-
fn needs_bar(x: &(impl Bar<i32> + ?Sized)) {
13+
fn needs_bar(x: &(impl Bar<i32> + PointeeSized)) {
1114
x.method();
1215
}
1316

1417
impl Foo for () {}
1518

16-
impl<T: ?Sized> Bar<T> for () {}
19+
impl<T: PointeeSized> Bar<T> for () {}
1720

1821
fn main() {
1922
let x: &dyn Foo = &();

tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/supertrait-dyn-compatibility.rs:1:12
2+
--> $DIR/supertrait-dyn-compatibility.rs:2:12
33
|
44
LL | #![feature(non_lifetime_binders)]
55
| ^^^^^^^^^^^^^^^^^^^^
@@ -8,14 +8,14 @@ LL | #![feature(non_lifetime_binders)]
88
= note: `#[warn(incomplete_features)]` on by default
99

1010
error[E0038]: the trait `Foo` is not dyn compatible
11-
--> $DIR/supertrait-dyn-compatibility.rs:19:23
11+
--> $DIR/supertrait-dyn-compatibility.rs:22:23
1212
|
1313
LL | let x: &dyn Foo = &();
1414
| ^^^ `Foo` is not dyn compatible
1515
|
1616
note: for a trait to be dyn compatible it needs to allow building a vtable
1717
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
18-
--> $DIR/supertrait-dyn-compatibility.rs:4:12
18+
--> $DIR/supertrait-dyn-compatibility.rs:7:12
1919
|
2020
LL | trait Foo: for<T> Bar<T> {}
2121
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
@@ -25,14 +25,14 @@ LL | trait Foo: for<T> Bar<T> {}
2525
= note: required for the cast from `&()` to `&dyn Foo`
2626

2727
error[E0038]: the trait `Foo` is not dyn compatible
28-
--> $DIR/supertrait-dyn-compatibility.rs:19:12
28+
--> $DIR/supertrait-dyn-compatibility.rs:22:12
2929
|
3030
LL | let x: &dyn Foo = &();
3131
| ^^^^^^^^ `Foo` is not dyn compatible
3232
|
3333
note: for a trait to be dyn compatible it needs to allow building a vtable
3434
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
35-
--> $DIR/supertrait-dyn-compatibility.rs:4:12
35+
--> $DIR/supertrait-dyn-compatibility.rs:7:12
3636
|
3737
LL | trait Foo: for<T> Bar<T> {}
3838
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
@@ -41,14 +41,14 @@ LL | trait Foo: for<T> Bar<T> {}
4141
= help: only type `()` implements `Foo`; consider using it directly instead.
4242

4343
error[E0038]: the trait `Foo` is not dyn compatible
44-
--> $DIR/supertrait-dyn-compatibility.rs:22:5
44+
--> $DIR/supertrait-dyn-compatibility.rs:25:5
4545
|
4646
LL | needs_bar(x);
4747
| ^^^^^^^^^ `Foo` is not dyn compatible
4848
|
4949
note: for a trait to be dyn compatible it needs to allow building a vtable
5050
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
51-
--> $DIR/supertrait-dyn-compatibility.rs:4:12
51+
--> $DIR/supertrait-dyn-compatibility.rs:7:12
5252
|
5353
LL | trait Foo: for<T> Bar<T> {}
5454
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables

tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/unifying-placeholders-in-query-response-2.rs:6:12
2+
--> $DIR/unifying-placeholders-in-query-response-2.rs:7:12
33
|
44
LL | #![feature(non_lifetime_binders)]
55
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/unifying-placeholders-in-query-response-2.rs:6:12
2+
--> $DIR/unifying-placeholders-in-query-response-2.rs:7:12
33
|
44
LL | #![feature(non_lifetime_binders)]
55
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@
33
//@[next] compile-flags: -Znext-solver
44
//@ check-pass
55

6+
#![feature(sized_hierarchy)]
67
#![feature(non_lifetime_binders)]
78
//~^ WARN the feature `non_lifetime_binders` is incomplete
89

9-
trait Id {
10-
type Output: ?Sized;
10+
use std::marker::PointeeSized;
11+
12+
trait Id: PointeeSized {
13+
type Output: PointeeSized;
1114
}
1215

13-
impl<T: ?Sized> Id for T {
16+
impl<T: PointeeSized> Id for T {
1417
type Output = T;
1518
}
1619

17-
trait Everyone {}
18-
impl<T: ?Sized> Everyone for T {}
20+
trait Everyone: PointeeSized {}
21+
impl<T: PointeeSized> Everyone for T {}
1922

2023
fn hello() where for<T> <T as Id>::Output: Everyone {}
2124

tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.current.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/unifying-placeholders-in-query-response.rs:6:12
2+
--> $DIR/unifying-placeholders-in-query-response.rs:7:12
33
|
44
LL | #![feature(non_lifetime_binders)]
55
| ^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)