Skip to content

Commit 9891e47

Browse files
committed
Also ignore typeoutlives predicates
1 parent 07ee86a commit 9891e47

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

compiler/rustc_mir/src/borrow_check/type_check/input_output.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
182182
matches!(
183183
o.predicate.kind().skip_binder(),
184184
ty::PredicateKind::RegionOutlives(_)
185+
| ty::PredicateKind::TypeOutlives(_)
185186
)
186187
}) {
187188
n.value
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// build-pass
2+
3+
// Ensures that we don't regress on "implementation is not general enough" when
4+
// normalizating under binders. Unlike `normalization-generality.rs`, this also produces
5+
// type outlives predicates that we must ignore.
6+
7+
pub unsafe trait Yokeable<'a> {
8+
type Output: 'a;
9+
}
10+
pub struct Yoke<Y: for<'a> Yokeable<'a>> {
11+
_marker: std::marker::PhantomData<Y>,
12+
}
13+
impl<Y: for<'a> Yokeable<'a>> Yoke<Y> {
14+
pub fn project<P>(
15+
&self,
16+
_f: for<'a> fn(&<Y as Yokeable<'a>>::Output, &'a ()) -> <P as Yokeable<'a>>::Output,
17+
) -> Yoke<P>
18+
where
19+
P: for<'a> Yokeable<'a>,
20+
{
21+
unimplemented!()
22+
}
23+
}
24+
pub fn slice(y: Yoke<&'static str>) -> Yoke<&'static [u8]> {
25+
y.project(move |yk, _| yk.as_bytes())
26+
}
27+
unsafe impl<'a, T: 'static + ?Sized> Yokeable<'a> for &'static T {
28+
type Output = &'a T;
29+
}
30+
fn main() {}

0 commit comments

Comments
 (0)