Don't check RPITITs that are Self:Sized for PointerLike
This commit is contained in:
parent
a7fa4cbcb4
commit
57e8a1c9c3
2 changed files with 18 additions and 0 deletions
|
@ -1197,6 +1197,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RPITITs with `Self: Sized` don't need to be checked.
|
||||||
|
if tcx.generics_require_sized_self(assoc_item) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let pointer_like_goal = pointer_like_goal_for_rpitit(
|
let pointer_like_goal = pointer_like_goal_for_rpitit(
|
||||||
tcx,
|
tcx,
|
||||||
supertrait,
|
supertrait,
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
// Make sure that we don't enforce that an RPIT that has `where Self: Sized` is pointer-like.
|
||||||
|
|
||||||
|
trait Foo {
|
||||||
|
fn foo() -> impl Sized where Self: Sized {}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Foo for () {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let x: &dyn Foo = &();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue