-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Regression test for #114056. Fixed by #111516. | ||
struct P<Q>(Q); | ||
impl<Q> P<Q> { | ||
fn foo(&self) { | ||
self.partial_cmp(()) | ||
//~^ ERROR the method `partial_cmp` exists for reference `&P<Q>` | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error[E0599]: the method `partial_cmp` exists for reference `&P<Q>`, but its trait bounds were not satisfied | ||
--> $DIR/leaked-vars-issue-114056.rs:5:14 | ||
| | ||
LL | struct P<Q>(Q); | ||
| ----------- doesn't satisfy `P<Q>: Iterator` or `P<Q>: PartialOrd<_>` | ||
... | ||
LL | self.partial_cmp(()) | ||
| ^^^^^^^^^^^ method cannot be called on `&P<Q>` due to unsatisfied trait bounds | ||
| | ||
= note: the following trait bounds were not satisfied: | ||
`P<Q>: PartialOrd<_>` | ||
which is required by `&P<Q>: PartialOrd<&_>` | ||
`&P<Q>: Iterator` | ||
which is required by `&mut &P<Q>: Iterator` | ||
`P<Q>: Iterator` | ||
which is required by `&mut P<Q>: Iterator` | ||
note: the trait `Iterator` must be implemented | ||
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | ||
help: consider annotating `P<Q>` with `#[derive(PartialEq, PartialOrd)]` | ||
| | ||
LL + #[derive(PartialEq, PartialOrd)] | ||
LL | struct P<Q>(Q); | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Regression test for #122098. Has been slightly minimized, fixed by #122189. | ||
trait LendingIterator: Sized { | ||
type Item<'q>; | ||
|
||
fn for_each(self, f: Box<dyn FnMut(Self::Item<'_>)>) {} | ||
} | ||
|
||
struct Query; | ||
fn main() { | ||
LendingIterator::for_each(Query, Box::new); | ||
//~^ ERROR the trait bound `Query: LendingIterator` is not satisfied | ||
//~| ERROR mismatched types | ||
//~| ERROR the trait bound `Query: LendingIterator` is not satisfied | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
error[E0277]: the trait bound `Query: LendingIterator` is not satisfied | ||
--> $DIR/leaked-vars-issue-122098.rs:10:31 | ||
| | ||
LL | LendingIterator::for_each(Query, Box::new); | ||
| ------------------------- ^^^^^ the trait `LendingIterator` is not implemented for `Query` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/leaked-vars-issue-122098.rs:2:1 | ||
| | ||
LL | trait LendingIterator: Sized { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/leaked-vars-issue-122098.rs:10:38 | ||
| | ||
LL | LendingIterator::for_each(Query, Box::new); | ||
| ------------------------- ^^^^^^^^ expected `Box<dyn FnMut(...)>`, found fn item | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
= note: expected struct `Box<(dyn for<'a> FnMut(<Query as LendingIterator>::Item<'a>) + 'static)>` | ||
found fn item `fn(_) -> Box<_> {Box::<_>::new}` | ||
note: method defined here | ||
--> $DIR/leaked-vars-issue-122098.rs:5:8 | ||
| | ||
LL | fn for_each(self, f: Box<dyn FnMut(Self::Item<'_>)>) {} | ||
| ^^^^^^^^ --------------------------------- | ||
|
||
error[E0277]: the trait bound `Query: LendingIterator` is not satisfied | ||
--> $DIR/leaked-vars-issue-122098.rs:10:38 | ||
| | ||
LL | LendingIterator::for_each(Query, Box::new); | ||
| ^^^^^^^^ the trait `LendingIterator` is not implemented for `Query` | ||
| | ||
help: this trait has no implementations, consider adding one | ||
--> $DIR/leaked-vars-issue-122098.rs:2:1 | ||
| | ||
LL | trait LendingIterator: Sized { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0277, E0308. | ||
For more information about an error, try `rustc --explain E0277`. |