diff options
21 files changed, 95 insertions, 71 deletions
diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.base.stderr index b1d4c0bf375..e55e56f916b 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.stderr +++ b/src/test/ui/hrtb/hrtb-conflate-regions.base.stderr @@ -1,5 +1,5 @@ error: implementation of `Foo` is not general enough - --> $DIR/hrtb-conflate-regions.rs:27:10 + --> $DIR/hrtb-conflate-regions.rs:31:10 | LL | fn b() { want_foo2::<SomeStruct>(); } | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr index 46f5308dd87..61b549b9cd7 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr +++ b/src/test/ui/hrtb/hrtb-conflate-regions.nll.stderr @@ -1,5 +1,5 @@ error: implementation of `Foo` is not general enough - --> $DIR/hrtb-conflate-regions.rs:27:10 + --> $DIR/hrtb-conflate-regions.rs:31:10 | LL | fn b() { want_foo2::<SomeStruct>(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough @@ -8,7 +8,7 @@ LL | fn b() { want_foo2::<SomeStruct>(); } = note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` error: implementation of `Foo` is not general enough - --> $DIR/hrtb-conflate-regions.rs:27:10 + --> $DIR/hrtb-conflate-regions.rs:31:10 | LL | fn b() { want_foo2::<SomeStruct>(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.rs b/src/test/ui/hrtb/hrtb-conflate-regions.rs index 004d62ac513..11285d07575 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.rs +++ b/src/test/ui/hrtb/hrtb-conflate-regions.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Test that an impl with only one bound region `'a` cannot be used to // satisfy a constraint where there are two bound regions. @@ -24,6 +28,9 @@ impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct } fn a() { want_foo1::<SomeStruct>(); } // OK -- foo wants just one region -fn b() { want_foo2::<SomeStruct>(); } //~ ERROR +fn b() { want_foo2::<SomeStruct>(); } +//[base]~^ ERROR +//[nll]~^^ ERROR implementation of +//[nll]~| ERROR implementation of fn main() { } diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.base.stderr index 613f4dc4951..006b6756b1e 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.base.stderr @@ -1,5 +1,5 @@ error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:38:5 | LL | foo::<()>(); | ^^^^^^^^^ implementation of `Trait` is not general enough diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr index 364b613fc77..23b50728264 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.nll.stderr @@ -1,5 +1,5 @@ error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5 + --> $DIR/hrtb-exists-forall-trait-contravariant.rs:38:5 | LL | foo::<()>(); | ^^^^^^^^^^^ implementation of `Trait` is not general enough diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs index 921061916fc..4b33dcb2cab 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Test a case where variance and higher-ranked types interact in surprising ways. // // In particular, we test this pattern in trait solving, where it is not connected diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.base.stderr index b487ce3e0ff..05575b01834 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.base.stderr @@ -1,5 +1,5 @@ error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 + --> $DIR/hrtb-exists-forall-trait-invariant.rs:32:5 | LL | foo::<()>(); | ^^^^^^^^^ implementation of `Trait` is not general enough diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr index cb2ce8a4116..58d59f60379 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.nll.stderr @@ -1,5 +1,5 @@ error: implementation of `Trait` is not general enough - --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 + --> $DIR/hrtb-exists-forall-trait-invariant.rs:32:5 | LL | foo::<()>(); | ^^^^^^^^^^^ implementation of `Trait` is not general enough diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs index 9b9e4496a87..c779bc3f46c 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! // // In particular, we test this pattern in trait solving, where it is not connected diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.base.stderr index ffc83aab4af..6e20b100664 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.base.stderr @@ -1,5 +1,5 @@ error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:24:5 + --> $DIR/hrtb-just-for-static.rs:28:5 | LL | want_hrtb::<StaticInt>() | ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough @@ -8,7 +8,7 @@ LL | want_hrtb::<StaticInt>() = note: ...but it actually implements `Foo<&'static isize>` error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:30:5 + --> $DIR/hrtb-just-for-static.rs:34:5 | LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough diff --git a/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr b/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr index a5770431eaf..090bd9f68ad 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr @@ -1,5 +1,5 @@ error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:24:5 + --> $DIR/hrtb-just-for-static.rs:28:5 | LL | want_hrtb::<StaticInt>() | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough @@ -8,7 +8,7 @@ LL | want_hrtb::<StaticInt>() = note: ...but it actually implements `Foo<&'static isize>` error: lifetime may not live long enough - --> $DIR/hrtb-just-for-static.rs:30:5 + --> $DIR/hrtb-just-for-static.rs:34:5 | LL | fn give_some<'a>() { | -- lifetime `'a` defined here @@ -16,7 +16,7 @@ LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: implementation of `Foo` is not general enough - --> $DIR/hrtb-just-for-static.rs:30:5 + --> $DIR/hrtb-just-for-static.rs:34:5 | LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough diff --git a/src/test/ui/hrtb/hrtb-just-for-static.rs b/src/test/ui/hrtb/hrtb-just-for-static.rs index 88d5ce8e640..dc70609c168 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.rs +++ b/src/test/ui/hrtb/hrtb-just-for-static.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Test a case where you have an impl of `Foo<X>` for all `X` that // is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. @@ -27,7 +31,10 @@ fn give_static() { // AnyInt implements Foo<&'a isize> for any 'a, so it is a match. impl<'a> Foo<&'a isize> for &'a u32 { } fn give_some<'a>() { - want_hrtb::<&'a u32>() //~ ERROR + want_hrtb::<&'a u32>() + //[base]~^ ERROR + //[nll]~^^ ERROR lifetime may not live long enough + //[nll]~| ERROR implementation of `Foo` is not general enough } fn main() { } diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.base.stderr index 07ff9b96e44..678a1137cd6 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.base.stderr @@ -1,5 +1,5 @@ error: implementation of `Bar` is not general enough - --> $DIR/hrtb-perfect-forwarding.rs:43:5 + --> $DIR/hrtb-perfect-forwarding.rs:47:5 | LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough @@ -8,7 +8,7 @@ LL | foo_hrtb_bar_not(&mut t); = note: ...but it actually implements `Bar<&'b isize>` error: implementation of `Bar` is not general enough - --> $DIR/hrtb-perfect-forwarding.rs:43:5 + --> $DIR/hrtb-perfect-forwarding.rs:47:5 | LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr index 68da46d46bd..3643ce62d40 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:16:1 + --> $DIR/hrtb-perfect-forwarding.rs:20:1 | LL | / fn no_hrtb<'b, T>(mut t: T) LL | | where @@ -15,7 +15,7 @@ LL | | } = help: a `loop` may express intention better if this is on purpose warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:25:1 + --> $DIR/hrtb-perfect-forwarding.rs:29:1 | LL | / fn bar_hrtb<T>(mut t: T) LL | | where @@ -30,7 +30,7 @@ LL | | } = help: a `loop` may express intention better if this is on purpose warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:35:1 + --> $DIR/hrtb-perfect-forwarding.rs:39:1 | LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T) LL | | where @@ -39,7 +39,7 @@ LL | | { ... | LL | | foo_hrtb_bar_not(&mut t); | | ------------------------ recursive call site -LL | | +... | LL | | LL | | } | |_^ cannot return without recursing @@ -47,7 +47,7 @@ LL | | } = help: a `loop` may express intention better if this is on purpose error: lifetime may not live long enough - --> $DIR/hrtb-perfect-forwarding.rs:43:5 + --> $DIR/hrtb-perfect-forwarding.rs:47:5 | LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) | -- lifetime `'b` defined here @@ -56,7 +56,7 @@ LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` error: implementation of `Bar` is not general enough - --> $DIR/hrtb-perfect-forwarding.rs:43:5 + --> $DIR/hrtb-perfect-forwarding.rs:47:5 | LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Bar` is not general enough @@ -65,7 +65,7 @@ LL | foo_hrtb_bar_not(&mut t); = note: ...but it actually implements `Bar<&'1 isize>`, for some specific lifetime `'1` warning: function cannot return without recursing - --> $DIR/hrtb-perfect-forwarding.rs:48:1 + --> $DIR/hrtb-perfect-forwarding.rs:53:1 | LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T) LL | | where diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs index 441a788359e..2db9f661cf4 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Test a case where you have an impl of `Foo<X>` for all `X` that // is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. @@ -13,7 +17,7 @@ impl<'a, X, F> Foo<X> for &'a mut F where F: Foo<X> + Bar<X> {} impl<'a, X, F> Bar<X> for &'a mut F where F: Bar<X> {} -fn no_hrtb<'b, T>(mut t: T) +fn no_hrtb<'b, T>(mut t: T) //[nll]~ WARN function cannot return where T: Bar<&'b isize>, { @@ -22,7 +26,7 @@ where no_hrtb(&mut t); } -fn bar_hrtb<T>(mut t: T) +fn bar_hrtb<T>(mut t: T) //[nll]~ WARN function cannot return where T: for<'b> Bar<&'b isize>, { @@ -32,7 +36,7 @@ where bar_hrtb(&mut t); } -fn foo_hrtb_bar_not<'b, T>(mut t: T) +fn foo_hrtb_bar_not<'b, T>(mut t: T) //[nll]~ WARN function cannot return where T: for<'a> Foo<&'a isize> + Bar<&'b isize>, { @@ -42,10 +46,11 @@ where // clause only specifies `T : Bar<&'b isize>`. foo_hrtb_bar_not(&mut t); //~^ ERROR implementation of `Bar` is not general enough - //~| ERROR implementation of `Bar` is not general enough + //[base]~^^ ERROR implementation of `Bar` is not general enough + //[nll]~^^^ ERROR lifetime may not live long enough } -fn foo_hrtb_bar_hrtb<T>(mut t: T) +fn foo_hrtb_bar_hrtb<T>(mut t: T) //[nll]~ WARN function cannot return where T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>, { diff --git a/src/test/ui/hrtb/issue-30786.migrate.stderr b/src/test/ui/hrtb/issue-30786.base.stderr index 7157b186fc8..dba3911d99c 100644 --- a/src/test/ui/hrtb/issue-30786.migrate.stderr +++ b/src/test/ui/hrtb/issue-30786.base.stderr @@ -1,5 +1,5 @@ -error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:127:22 +error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:122:22 | LL | pub struct Map<S, F> { | -------------------- @@ -8,13 +8,13 @@ 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@$DIR/issue-30786.rs:126:27: 126:36]>` due to unsatisfied trait bounds + | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` - `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` - `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` - --> $DIR/issue-30786.rs:105:50 + `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>: Stream` + `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>: Stream` + `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>: Stream` + --> $DIR/issue-30786.rs:100:50 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here @@ -23,8 +23,8 @@ help: one of the expressions' fields has a method of the same name LL | let filter = map.stream.filterx(|x: &_| true); | +++++++ -error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:140:24 +error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:134:24 | LL | pub struct Filter<S, F> { | ----------------------- @@ -33,13 +33,13 @@ LL | pub struct Filter<S, F> { | doesn't satisfy `_: StreamExt` ... LL | let count = filter.countx(); - | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>` due to unsatisfied trait bounds + | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` - `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` - `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` - --> $DIR/issue-30786.rs:105:50 + `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>: Stream` + `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>: Stream` + `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>: Stream` + --> $DIR/issue-30786.rs:100:50 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here diff --git a/src/test/ui/hrtb/issue-30786.nll.stderr b/src/test/ui/hrtb/issue-30786.nll.stderr index 7157b186fc8..dba3911d99c 100644 --- a/src/test/ui/hrtb/issue-30786.nll.stderr +++ b/src/test/ui/hrtb/issue-30786.nll.stderr @@ -1,5 +1,5 @@ -error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:127:22 +error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:122:22 | LL | pub struct Map<S, F> { | -------------------- @@ -8,13 +8,13 @@ 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@$DIR/issue-30786.rs:126:27: 126:36]>` due to unsatisfied trait bounds + | ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` - `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` - `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:126:27: 126:36]>: Stream` - --> $DIR/issue-30786.rs:105:50 + `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>: Stream` + `&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>: Stream` + `&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:121:27: 121:36]>: Stream` + --> $DIR/issue-30786.rs:100:50 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here @@ -23,8 +23,8 @@ help: one of the expressions' fields has a method of the same name LL | let filter = map.stream.filterx(|x: &_| true); | +++++++ -error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>`, but its trait bounds were not satisfied - --> $DIR/issue-30786.rs:140:24 +error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>`, but its trait bounds were not satisfied + --> $DIR/issue-30786.rs:134:24 | LL | pub struct Filter<S, F> { | ----------------------- @@ -33,13 +33,13 @@ LL | pub struct Filter<S, F> { | doesn't satisfy `_: StreamExt` ... LL | let count = filter.countx(); - | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>` due to unsatisfied trait bounds + | ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>` due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` - `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` - `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:139:30: 139:42]>: Stream` - --> $DIR/issue-30786.rs:105:50 + `&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>: Stream` + `&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>: Stream` + `&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:133:30: 133:42]>: Stream` + --> $DIR/issue-30786.rs:100:50 | LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here diff --git a/src/test/ui/hrtb/issue-30786.rs b/src/test/ui/hrtb/issue-30786.rs index 540c26c358b..c2e01909870 100644 --- a/src/test/ui/hrtb/issue-30786.rs +++ b/src/test/ui/hrtb/issue-30786.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // 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 @@ -6,15 +10,6 @@ // This tests double-checks that we do not allow such behavior to leak // through again. -// revisions: migrate nll -//[nll]compile-flags: -Z borrowck=mir - -// Since we are testing nll (and migration) explicitly as a separate -// revisions, don't worry about the --compare-mode=nll on this test. - -// ignore-compare-mode-nll -// ignore-compare-mode-polonius - pub trait Stream { type Item; fn next(self) -> Option<Self::Item>; @@ -125,8 +120,7 @@ fn variant1() { // guess. let map = source.mapx(|x: &_| x); let filter = map.filterx(|x: &_| true); - //[migrate]~^ ERROR the method - //[nll]~^^ ERROR the method + //~^ ERROR the method } fn variant2() { @@ -138,8 +132,7 @@ fn variant2() { let map = source.mapx(identity); let filter = map.filterx(|x: &_| true); let count = filter.countx(); - //[migrate]~^ ERROR the method - //[nll]~^^ ERROR the method + //~^ ERROR the method } fn main() {} diff --git a/src/test/ui/hrtb/issue-46989.stderr b/src/test/ui/hrtb/issue-46989.base.stderr index f3d906cae4c..d1f6fed10fd 100644 --- a/src/test/ui/hrtb/issue-46989.stderr +++ b/src/test/ui/hrtb/issue-46989.base.stderr @@ -1,5 +1,5 @@ error: implementation of `Foo` is not general enough - --> $DIR/issue-46989.rs:38:5 + --> $DIR/issue-46989.rs:42:5 | LL | assert_foo::<fn(&i32)>(); | ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough diff --git a/src/test/ui/hrtb/issue-46989.nll.stderr b/src/test/ui/hrtb/issue-46989.nll.stderr index 309e1a676ed..e1ddd7235f5 100644 --- a/src/test/ui/hrtb/issue-46989.nll.stderr +++ b/src/test/ui/hrtb/issue-46989.nll.stderr @@ -1,5 +1,5 @@ error: implementation of `Foo` is not general enough - --> $DIR/issue-46989.rs:38:5 + --> $DIR/issue-46989.rs:42:5 | LL | assert_foo::<fn(&i32)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough diff --git a/src/test/ui/hrtb/issue-46989.rs b/src/test/ui/hrtb/issue-46989.rs index 4a09f4be156..0bb6d7a18eb 100644 --- a/src/test/ui/hrtb/issue-46989.rs +++ b/src/test/ui/hrtb/issue-46989.rs @@ -1,3 +1,7 @@ +// revisions: base nll +// ignore-compare-mode-nll +//[nll] compile-flags: -Z borrowck=mir + // Regression test for #46989: // // In the move to universes, this test started passing. |
