Better binder treatment

This commit is contained in:
Michael Goulet 2022-09-20 16:39:39 +00:00
parent 4136b59b7d
commit 83e6128b57
3 changed files with 42 additions and 1 deletions

View File

@ -2765,7 +2765,7 @@ fn binders<T>(
where
T: relate::Relate<'tcx>,
{
Ok(ty::Binder::dummy(self.relate(a.skip_binder(), b.skip_binder())?))
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?))
}
fn consts(

View File

@ -0,0 +1,27 @@
use std::marker::PhantomData;
type Component = fn(&());
struct Wrapper {
router: Router<(Component, Box<Self>)>,
}
struct Match<C>(PhantomData<C>);
struct Router<T>(PhantomData<T>);
impl<T> Router<T> {
pub fn at(&self) -> Result<Match<&T>, ()> {
todo!()
}
}
impl Wrapper {
fn at(&self, path: &str) -> Result<(Component, Box<Self>), ()> {
let (cmp, router) = self.router.at()?;
//~^ ERROR mismatched types
todo!()
}
}
fn main() {}

View File

@ -0,0 +1,14 @@
error[E0308]: mismatched types
--> $DIR/issue-101984.rs:21:13
|
LL | let (cmp, router) = self.router.at()?;
| ^^^^^^^^^^^^^ ----------------- this expression has type `Match<&(for<'r> fn(&'r ()), Box<Wrapper>)>`
| |
| expected struct `Match`, found tuple
|
= note: expected struct `Match<&(for<'r> fn(&'r ()), Box<Wrapper>)>`
found tuple `(_, _)`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.