summaryrefslogtreecommitdiffstats
path: root/tests/ui/higher-rank-trait-bounds
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/higher-rank-trait-bounds')
-rw-r--r--tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr4
-rw-r--r--tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr2
-rw-r--r--tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr4
-rw-r--r--tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr4
-rw-r--r--tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr11
-rw-r--r--tests/ui/higher-rank-trait-bounds/issue-30786.rs2
-rw-r--r--tests/ui/higher-rank-trait-bounds/issue-30786.stderr27
-rw-r--r--tests/ui/higher-rank-trait-bounds/issue-39292.rs17
-rw-r--r--tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr10
-rw-r--r--tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr6
-rw-r--r--tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr2
-rw-r--r--tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr2
12 files changed, 59 insertions, 32 deletions
diff --git a/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr b/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr
index 71e196c32..3662cbfb9 100644
--- a/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr
+++ b/tests/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr
@@ -11,9 +11,9 @@ LL | | ),
LL | | ) {
| |_- expected `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` because of return type
LL | f
- | ^ expected reference, found `u32`
+ | ^ expected `&dyn Fn(&dyn Fn(&dyn Fn(&...)))`, found `&dyn Fn(u32)`
|
- = note: expected reference `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a ...) + 'a)) + 'a)) + 'a))`
+ = note: expected reference `&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&...)))))))))))`
the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/hang-on-deeply-nested-dyn/hang-on-deeply-nested-dyn.long-type-hash.txt'
found reference `&dyn Fn(u32)`
diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr
index 8cda76b94..b1b8ffa8c 100644
--- a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr
+++ b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr
@@ -10,7 +10,7 @@ note: required by a bound in `want_bar_for_any_ccx`
--> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:32:15
|
LL | fn want_bar_for_any_ccx<B>(b: &B)
- | -------------------- required by a bound in this
+ | -------------------- required by a bound in this function
LL | where B : for<'ccx> Bar<'ccx>
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx`
help: consider further restricting this bound
diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr
index 88793a152..7f96909b6 100644
--- a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr
+++ b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr
@@ -10,7 +10,7 @@ note: required by a bound in `want_foo_for_any_tcx`
--> $DIR/hrtb-higher-ranker-supertraits.rs:22:15
|
LL | fn want_foo_for_any_tcx<F>(f: &F)
- | -------------------- required by a bound in this
+ | -------------------- required by a bound in this function
LL | where F : for<'tcx> Foo<'tcx>
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo_for_any_tcx`
help: consider further restricting this bound
@@ -30,7 +30,7 @@ note: required by a bound in `want_bar_for_any_ccx`
--> $DIR/hrtb-higher-ranker-supertraits.rs:39:15
|
LL | fn want_bar_for_any_ccx<B>(b: &B)
- | -------------------- required by a bound in this
+ | -------------------- required by a bound in this function
LL | where B : for<'ccx> Bar<'ccx>
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx`
help: consider further restricting this bound
diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr
index 4886a3c8b..25af011e3 100644
--- a/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr
+++ b/tests/ui/higher-rank-trait-bounds/hrtb-identity-fn-borrows.stderr
@@ -2,9 +2,9 @@ error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/hrtb-identity-fn-borrows.rs:14:5
|
LL | let y = f.call(&x);
- | -- borrow of `x` occurs here
+ | -- `x` is borrowed here
LL | x = 5;
- | ^^^^^ assignment to borrowed `x` occurs here
+ | ^^^^^ `x` is assigned to here but it was already borrowed
...
LL | drop(y);
| - borrow later used here
diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr
index f31aa5546..765ea9f78 100644
--- a/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr
+++ b/tests/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr
@@ -1,14 +1,21 @@
-error: only lifetime parameters can be used in this context
+error[E0658]: only lifetime parameters can be used in this context
--> $DIR/hrtb-wrong-kind.rs:1:18
|
LL | fn a() where for<T> T: Copy {}
| ^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
-error: only lifetime parameters can be used in this context
+error[E0658]: only lifetime parameters can be used in this context
--> $DIR/hrtb-wrong-kind.rs:4:24
|
LL | fn b() where for<const C: usize> [(); C]: Copy {}
| ^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/higher-rank-trait-bounds/issue-30786.rs b/tests/ui/higher-rank-trait-bounds/issue-30786.rs
index e5f46f711..4a6399c8f 100644
--- a/tests/ui/higher-rank-trait-bounds/issue-30786.rs
+++ b/tests/ui/higher-rank-trait-bounds/issue-30786.rs
@@ -1,3 +1,5 @@
+// normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
+
// rust-lang/rust#30786: the use of `for<'b> &'b mut A: Stream<Item=T`
// should act as assertion that item does not borrow from its stream;
// but an earlier buggy rustc allowed `.map(|x: &_| x)` which does
diff --git a/tests/ui/higher-rank-trait-bounds/issue-30786.stderr b/tests/ui/higher-rank-trait-bounds/issue-30786.stderr
index 0458d2535..6ec34d11a 100644
--- a/tests/ui/higher-rank-trait-bounds/issue-30786.stderr
+++ b/tests/ui/higher-rank-trait-bounds/issue-30786.stderr
@@ -1,5 +1,5 @@
-error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@issue-30786.rs:117:27]>`, but its trait bounds were not satisfied
- --> $DIR/issue-30786.rs:118:22
+error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@issue-30786.rs:119:27]>`, but its trait bounds were not satisfied
+ --> $DIR/issue-30786.rs:120:22
|
LL | pub struct Map<S, F> {
| --------------------
@@ -8,19 +8,19 @@ LL | pub struct Map<S, F> {
| doesn't satisfy `_: StreamExt`
...
LL | let filter = map.filterx(|x: &_| true);
- | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@issue-30786.rs:117:27]>` due to unsatisfied trait bounds
+ | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@issue-30786.rs:119:27]>` due to unsatisfied trait bounds
|
note: the following trait bounds were not satisfied:
- `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream`
- `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream`
- `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream`
- --> $DIR/issue-30786.rs:96:50
+ `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
+ `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
+ `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:119:27: 119:34]>: Stream`
+ --> $DIR/issue-30786.rs:98:50
|
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
| --------- - ^^^^^^ unsatisfied trait bound introduced here
-error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@issue-30786.rs:129:30]>`, but its trait bounds were not satisfied
- --> $DIR/issue-30786.rs:130:24
+error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, fn(&u64) -> &u64 {identity::<u64>}>, [closure@issue-30786.rs:131:30]>`, but its trait bounds were not satisfied
+ --> $DIR/issue-30786.rs:132:24
|
LL | pub struct Filter<S, F> {
| -----------------------
@@ -31,11 +31,12 @@ LL | pub struct Filter<S, F> {
LL | let count = filter.countx();
| ^^^^^^ method cannot be called due to unsatisfied trait bounds
|
+ = note: the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/issue-30786/issue-30786.long-type-hash.txt'
note: the following trait bounds were not satisfied:
- `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream`
- `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream`
- `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream`
- --> $DIR/issue-30786.rs:96:50
+ `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
+ `&'a mut &mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
+ `&'a mut Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:131:30: 131:37]>: Stream`
+ --> $DIR/issue-30786.rs:98:50
|
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
| --------- - ^^^^^^ unsatisfied trait bound introduced here
diff --git a/tests/ui/higher-rank-trait-bounds/issue-39292.rs b/tests/ui/higher-rank-trait-bounds/issue-39292.rs
new file mode 100644
index 000000000..968cf0891
--- /dev/null
+++ b/tests/ui/higher-rank-trait-bounds/issue-39292.rs
@@ -0,0 +1,17 @@
+// run-pass
+// Regression test for issue #39292. The object vtable was being
+// incorrectly left with a null pointer.
+
+trait Foo<T> {
+ fn print<'a>(&'a self) where T: 'a { println!("foo"); }
+}
+
+impl<'a> Foo<&'a ()> for () { }
+
+trait Bar: for<'a> Foo<&'a ()> { }
+
+impl Bar for () {}
+
+fn main() {
+ (&() as &dyn Bar).print(); // Segfault
+}
diff --git a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr
index 810f7c28c..4d470ae70 100644
--- a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr
+++ b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr
@@ -1,4 +1,4 @@
-error[E0271]: type mismatch resolving `for<'r> <L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
+error[E0271]: type mismatch resolving `<L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
--> $DIR/issue-62203-hrtb-ice.rs:39:9
|
LL | let v = Unit2.m(
@@ -10,7 +10,7 @@ LL | | f: |x| {
... |
LL | | },
LL | | },
- | |_________^ type mismatch resolving `for<'r> <L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
+ | |_________^ type mismatch resolving `<L<[closure@issue-62203-hrtb-ice.rs:42:16]> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V`
|
note: expected this to be `<_ as Ty<'_>>::V`
--> $DIR/issue-62203-hrtb-ice.rs:21:14
@@ -25,7 +25,7 @@ note: required by a bound in `T1::m`
--> $DIR/issue-62203-hrtb-ice.rs:27:51
|
LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1
- | - required by a bound in this
+ | - required by a bound in this associated function
LL | where
LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
@@ -42,7 +42,7 @@ LL | | f: |x| {
... |
LL | | },
LL | | },
- | |_________^ expected struct `Unit3`, found struct `Unit4`
+ | |_________^ expected `Unit3`, found `Unit4`
|
note: required for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]>` to implement `for<'r> T0<'r, (&'r u8,)>`
--> $DIR/issue-62203-hrtb-ice.rs:17:16
@@ -56,7 +56,7 @@ note: required by a bound in `T1::m`
--> $DIR/issue-62203-hrtb-ice.rs:27:12
|
LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1
- | - required by a bound in this
+ | - required by a bound in this associated function
LL | where
LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
index 62d0128fd..edef6ccd3 100644
--- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
+++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr
@@ -15,7 +15,7 @@ note: required by a bound in `StackContext`
--> $DIR/issue-89118.rs:9:14
|
LL | trait StackContext
- | ------------ required by a bound in this
+ | ------------ required by a bound in this trait
LL | where
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
@@ -37,7 +37,7 @@ note: required by a bound in `EthernetWorker`
--> $DIR/issue-89118.rs:28:14
|
LL | struct EthernetWorker<C>(C)
- | -------------- required by a bound in this
+ | -------------- required by a bound in this struct
LL | where
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker`
@@ -59,7 +59,7 @@ note: required by a bound in `StackContext`
--> $DIR/issue-89118.rs:9:14
|
LL | trait StackContext
- | ------------ required by a bound in this
+ | ------------ required by a bound in this trait
LL | where
LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext`
diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr
index 6206b167b..5be33bccd 100644
--- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr
+++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr
@@ -11,7 +11,7 @@ note: required by a bound in `upcast`
--> $DIR/issue-90950.rs:27:42
|
LL | fn upcast<Y>(x: Yoke<Y>) -> Yoke<Box<dyn IsCovariant<'static> + 'static>> where
- | ------ required by a bound in this
+ | ------ required by a bound in this function
LL | Y: for<'a> Yokeable<'a>,
LL | for<'a> <Y as Yokeable<'a>>::Output: IsCovariant<'a>
| ^^^^^^^^^^^^^^^ required by this bound in `upcast`
diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
index 51c964600..73388a725 100644
--- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
+++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr
@@ -8,7 +8,7 @@ note: required by a bound in `weird_bound`
--> $DIR/norm-before-method-resolution.rs:18:40
|
LL | fn weird_bound<X>() -> X
- | ----------- required by a bound in this
+ | ----------- required by a bound in this function
...
LL | for<'a> <X as Trait<'a>>::Out: Copy
| ^^^^ required by this bound in `weird_bound`