From f090de88759ed9abc65074ff9926e03a3d550d77 Mon Sep 17 00:00:00 2001 From: Boxy Date: Wed, 3 Apr 2024 22:48:48 +0100 Subject: [PATCH] rebase oddity --- src/tools/tidy/src/issues.txt | 1 - ...om-env-universe-err-project.current.stderr | 12 +++++------ ...-from-env-universe-err-project.next.stderr | 18 ++++++++-------- ...candidate-from-env-universe-err-project.rs | 21 ++++++++++--------- ...0786-1.rs => hrtb-doesnt-borrow-self-1.rs} | 0 ...tderr => hrtb-doesnt-borrow-self-1.stderr} | 16 +++++++------- ...0786-2.rs => hrtb-doesnt-borrow-self-2.rs} | 0 ...tderr => hrtb-doesnt-borrow-self-2.stderr} | 14 ++++++------- 8 files changed, 41 insertions(+), 41 deletions(-) rename tests/ui/higher-ranked/trait-bounds/{issue-30786-1.rs => hrtb-doesnt-borrow-self-1.rs} (100%) rename tests/ui/higher-ranked/trait-bounds/{issue-30786-1.stderr => hrtb-doesnt-borrow-self-1.stderr} (57%) rename tests/ui/higher-ranked/trait-bounds/{issue-30786-2.rs => hrtb-doesnt-borrow-self-2.rs} (100%) rename tests/ui/higher-ranked/trait-bounds/{issue-30786-2.stderr => hrtb-doesnt-borrow-self-2.stderr} (66%) diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index f6b1d45ee94e..6b0573f5a3ff 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -1129,7 +1129,6 @@ "ui/generics/issue-98432.rs", "ui/higher-ranked/trait-bounds/issue-100689.rs", "ui/higher-ranked/trait-bounds/issue-102899.rs", -"ui/higher-ranked/trait-bounds/issue-30786.rs", "ui/higher-ranked/trait-bounds/issue-36139-normalize-closure-sig.rs", "ui/higher-ranked/trait-bounds/issue-39292.rs", "ui/higher-ranked/trait-bounds/issue-42114.rs", diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr index 16a6f549882e..bb0b2de788e8 100644 --- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr +++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr @@ -1,5 +1,5 @@ error: implementation of `Trait` is not general enough - --> $DIR/candidate-from-env-universe-err-project.rs:31:5 + --> $DIR/candidate-from-env-universe-err-project.rs:28:5 | LL | trait_bound::(); | ^^^^^^^^^^^^^^^^^^ implementation of `Trait` is not general enough @@ -8,7 +8,7 @@ LL | trait_bound::(); = note: ...but it actually implements `Trait<'static>` error: implementation of `Trait` is not general enough - --> $DIR/candidate-from-env-universe-err-project.rs:41:5 + --> $DIR/candidate-from-env-universe-err-project.rs:39:5 | LL | projection_bound::(); | ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Trait` is not general enough @@ -17,7 +17,7 @@ LL | projection_bound::(); = note: ...but it actually implements `Trait<'static>` error[E0308]: mismatched types - --> $DIR/candidate-from-env-universe-err-project.rs:41:5 + --> $DIR/candidate-from-env-universe-err-project.rs:39:5 | LL | projection_bound::(); | ^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -25,13 +25,13 @@ LL | projection_bound::(); = note: expected associated type `>::Assoc` found associated type `>::Assoc` note: the lifetime requirement is introduced here - --> $DIR/candidate-from-env-universe-err-project.rs:21:42 + --> $DIR/candidate-from-env-universe-err-project.rs:18:42 | LL | fn projection_bound Trait<'a, Assoc = usize>>() {} | ^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/candidate-from-env-universe-err-project.rs:56:30 + --> $DIR/candidate-from-env-universe-err-project.rs:55:30 | LL | let _higher_ranked_norm: for<'a> fn(>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -40,7 +40,7 @@ LL | let _higher_ranked_norm: for<'a> fn(>::Assoc) = |_| (); found associated type `>::Assoc` error[E0308]: mismatched types - --> $DIR/candidate-from-env-universe-err-project.rs:56:30 + --> $DIR/candidate-from-env-universe-err-project.rs:55:30 | LL | let _higher_ranked_norm: for<'a> fn(>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr index 57f2184b611e..2804d5bbe940 100644 --- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr +++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `for<'a> T: Trait<'a>` is not satisfied - --> $DIR/candidate-from-env-universe-err-project.rs:31:19 + --> $DIR/candidate-from-env-universe-err-project.rs:28:19 | LL | trait_bound::(); | ^ the trait `for<'a> Trait<'a>` is not implemented for `T` | note: required by a bound in `trait_bound` - --> $DIR/candidate-from-env-universe-err-project.rs:20:19 + --> $DIR/candidate-from-env-universe-err-project.rs:17:19 | LL | fn trait_bound Trait<'a>>() {} | ^^^^^^^^^^^^^^^^^ required by this bound in `trait_bound` @@ -15,13 +15,13 @@ LL | fn function1 + for<'a> Trait<'a>>() { | +++++++++++++++++++ error[E0277]: the trait bound `for<'a> T: Trait<'a>` is not satisfied - --> $DIR/candidate-from-env-universe-err-project.rs:41:24 + --> $DIR/candidate-from-env-universe-err-project.rs:39:24 | LL | projection_bound::(); | ^ the trait `for<'a> Trait<'a>` is not implemented for `T` | note: required by a bound in `projection_bound` - --> $DIR/candidate-from-env-universe-err-project.rs:21:24 + --> $DIR/candidate-from-env-universe-err-project.rs:18:24 | LL | fn projection_bound Trait<'a, Assoc = usize>>() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `projection_bound` @@ -31,30 +31,30 @@ LL | fn function2 + for<'a> Trait<'a>>() { | +++++++++++++++++++ error[E0271]: type mismatch resolving `>::Assoc == usize` - --> $DIR/candidate-from-env-universe-err-project.rs:41:24 + --> $DIR/candidate-from-env-universe-err-project.rs:39:24 | LL | projection_bound::(); | ^ type mismatch resolving `>::Assoc == usize` | note: types differ - --> $DIR/candidate-from-env-universe-err-project.rs:17:18 + --> $DIR/candidate-from-env-universe-err-project.rs:14:18 | LL | type Assoc = usize; | ^^^^^ note: required by a bound in `projection_bound` - --> $DIR/candidate-from-env-universe-err-project.rs:21:42 + --> $DIR/candidate-from-env-universe-err-project.rs:18:42 | LL | fn projection_bound Trait<'a, Assoc = usize>>() {} | ^^^^^^^^^^^^^ required by this bound in `projection_bound` error: higher-ranked subtype error - --> $DIR/candidate-from-env-universe-err-project.rs:56:30 + --> $DIR/candidate-from-env-universe-err-project.rs:55:30 | LL | let _higher_ranked_norm: for<'a> fn(>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: higher-ranked subtype error - --> $DIR/candidate-from-env-universe-err-project.rs:56:30 + --> $DIR/candidate-from-env-universe-err-project.rs:55:30 | LL | let _higher_ranked_norm: for<'a> fn(>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs index 7e5e5f3a8472..2f53bd019b78 100644 --- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs +++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs @@ -5,9 +5,6 @@ // the where-bound candidate for trait goals due to the leak check, but did // not do so for projection candidates and during normalization. // -// FIXME(-Znext-solver): We currently prefer the impl over the where-bound -// for trait goals because the impl does not result in any constraints. -// // This results in an inconsistency between `Trait` and `Projection` goals as // normalizing always constraints the normalized-to term. trait Trait<'a> { @@ -23,13 +20,14 @@ fn projection_bound Trait<'a, Assoc = usize>>() {} // We use a function with a trivial where-bound which is more // restrictive than the impl. fn function1>() { - // ok + // err // - // Proving `for<'a> T: Trait<'a>` using the where-bound results - // in a leak check failure, so we use the more general impl, - // causing this to succeed. + // Proving `for<'a> T: Trait<'a>` using the where-bound does not + // result in a leak check failure even though it does not apply. + // We prefer env candidates over impl candidatescausing this to succeed. trait_bound::(); - //[current]~^ ERROR mismatched types + //[next]~^ ERROR the trait bound `for<'a> T: Trait<'a>` is not satisfied + //[current]~^^ ERROR implementation of `Trait` is not general enough } fn function2>() { @@ -40,7 +38,8 @@ fn function2>() { // to prefer it over the impl, resulting in a placeholder error. projection_bound::(); //[next]~^ ERROR type mismatch resolving `>::Assoc == usize` - //[current]~^^ ERROR mismatched types + //[next]~| ERROR the trait bound `for<'a> T: Trait<'a>` is not satisfied + //[current]~^^^ ERROR implementation of `Trait` is not general enough //[current]~| ERROR mismatched types } @@ -54,7 +53,9 @@ fn function3>() { // leak check during candidate selection for normalization, this // case would still not compile. let _higher_ranked_norm: for<'a> fn(>::Assoc) = |_| (); - //[current]~^ ERROR mismatched types + //[next]~^ ERROR higher-ranked subtype error + //[next]~| ERROR higher-ranked subtype error + //[current]~^^^ ERROR mismatched types //[current]~| ERROR mismatched types } diff --git a/tests/ui/higher-ranked/trait-bounds/issue-30786-1.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.rs similarity index 100% rename from tests/ui/higher-ranked/trait-bounds/issue-30786-1.rs rename to tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.rs diff --git a/tests/ui/higher-ranked/trait-bounds/issue-30786-1.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr similarity index 57% rename from tests/ui/higher-ranked/trait-bounds/issue-30786-1.stderr rename to tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr index 56dfd124c5c3..ae364de8cc06 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-30786-1.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-1.stderr @@ -1,23 +1,23 @@ -error[E0599]: the method `filterx` exists for struct `Map`, but its trait bounds were not satisfied - --> $DIR/issue-30786-1.rs:116:22 +error[E0599]: the method `filterx` exists for struct `Map`, but its trait bounds were not satisfied + --> $DIR/hrtb-doesnt-borrow-self-1.rs:116:22 | LL | pub struct Map { | -------------------- method `filterx` not found for this struct because it doesn't satisfy `_: StreamExt` ... LL | let filter = map.filterx(|x: &_| true); - | ^^^^^^^ method cannot be called on `Map` due to unsatisfied trait bounds + | ^^^^^^^ method cannot be called due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Map: Stream` - `&'a mut &mut Map: Stream` - `&'a mut Map: Stream` - --> $DIR/issue-30786-1.rs:98:50 + `&'a mut &Map: Stream` + `&'a mut &mut Map: Stream` + `&'a mut Map: Stream` + --> $DIR/hrtb-doesnt-borrow-self-1.rs:98:50 | LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here = help: items from traits can only be used if the trait is implemented and in scope note: `StreamExt` defines an item `filterx`, perhaps you need to implement it - --> $DIR/issue-30786-1.rs:66:1 + --> $DIR/hrtb-doesnt-borrow-self-1.rs:66:1 | LL | pub trait StreamExt | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/higher-ranked/trait-bounds/issue-30786-2.rs b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs similarity index 100% rename from tests/ui/higher-ranked/trait-bounds/issue-30786-2.rs rename to tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.rs diff --git a/tests/ui/higher-ranked/trait-bounds/issue-30786-2.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr similarity index 66% rename from tests/ui/higher-ranked/trait-bounds/issue-30786-2.stderr rename to tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr index 36e420ce0a37..eeb4e12fa8b3 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-30786-2.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr @@ -1,5 +1,5 @@ -error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, {closure@issue-30786-2.rs:111:30}>`, but its trait bounds were not satisfied - --> $DIR/issue-30786-2.rs:112:24 +error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, {closure@hrtb-doesnt-borrow-self-2.rs:111:30}>`, but its trait bounds were not satisfied + --> $DIR/hrtb-doesnt-borrow-self-2.rs:112:24 | LL | pub struct Filter { | ----------------------- method `countx` not found for this struct because it doesn't satisfy `_: StreamExt` @@ -8,16 +8,16 @@ LL | let count = filter.countx(); | ^^^^^^ method cannot be called due to unsatisfied trait bounds | note: the following trait bounds were not satisfied: - `&'a mut &Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/issue-30786-2.rs:111:30: 111:37}>: Stream` - `&'a mut &mut Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/issue-30786-2.rs:111:30: 111:37}>: Stream` - `&'a mut Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/issue-30786-2.rs:111:30: 111:37}>: Stream` - --> $DIR/issue-30786-2.rs:98:50 + `&'a mut &Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` + `&'a mut &mut Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` + `&'a mut Filter fn(&'a u64) -> &'a u64 {identity::}>, {closure@$DIR/hrtb-doesnt-borrow-self-2.rs:111:30: 111:37}>: Stream` + --> $DIR/hrtb-doesnt-borrow-self-2.rs:98:50 | LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} | --------- - ^^^^^^ unsatisfied trait bound introduced here = help: items from traits can only be used if the trait is implemented and in scope note: `StreamExt` defines an item `countx`, perhaps you need to implement it - --> $DIR/issue-30786-2.rs:66:1 + --> $DIR/hrtb-doesnt-borrow-self-2.rs:66:1 | LL | pub trait StreamExt | ^^^^^^^^^^^^^^^^^^^