-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #100691 - compiler-errors:issue-100690, r=estebank
Make `same_type_modulo_infer` a proper `TypeRelation` Specifically, this fixes #100690 because we no longer consider a `ReLateBound` and a `ReVar` to be equal. `ReVar` can only be equal to free regions or static.
- Loading branch information
Showing
4 changed files
with
150 additions
and
53 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
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
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,45 @@ | ||
// This code (probably) _should_ compile, but it currently does not because we | ||
// are not smart enough about implied bounds. | ||
|
||
use std::io; | ||
|
||
fn real_dispatch<T, F>(f: F) -> Result<(), io::Error> | ||
//~^ NOTE required by a bound in this | ||
where | ||
F: FnOnce(&mut UIView<T>) -> Result<(), io::Error> + Send + 'static, | ||
//~^ NOTE required by this bound in `real_dispatch` | ||
//~| NOTE required by a bound in `real_dispatch` | ||
{ | ||
todo!() | ||
} | ||
|
||
#[derive(Debug)] | ||
struct UIView<'a, T: 'a> { | ||
_phantom: std::marker::PhantomData<&'a mut T>, | ||
} | ||
|
||
trait Handle<'a, T: 'a, V, R> { | ||
fn dispatch<F>(&self, f: F) -> Result<(), io::Error> | ||
where | ||
F: FnOnce(&mut V) -> R + Send + 'static; | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
struct TUIHandle<T> { | ||
_phantom: std::marker::PhantomData<T>, | ||
} | ||
|
||
impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandle<T> { | ||
fn dispatch<F>(&self, f: F) -> Result<(), io::Error> | ||
where | ||
F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static, | ||
{ | ||
real_dispatch(f) | ||
//~^ ERROR expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` | ||
//~| NOTE expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` | ||
//~| NOTE expected a closure with arguments | ||
//~| NOTE required by a bound introduced by this call | ||
} | ||
} | ||
|
||
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,22 @@ | ||
error[E0277]: expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` | ||
--> $DIR/issue-100690.rs:37:23 | ||
| | ||
LL | real_dispatch(f) | ||
| ------------- ^ expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= note: expected a closure with arguments `(&mut UIView<'a, T>,)` | ||
found a closure with arguments `(&mut UIView<'_, T>,)` | ||
note: required by a bound in `real_dispatch` | ||
--> $DIR/issue-100690.rs:9:8 | ||
| | ||
LL | fn real_dispatch<T, F>(f: F) -> Result<(), io::Error> | ||
| ------------- required by a bound in this | ||
... | ||
LL | F: FnOnce(&mut UIView<T>) -> Result<(), io::Error> + Send + 'static, | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `real_dispatch` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |