Do not register placeholder region outlives when considering_regions is false
This commit is contained in:
parent
db0597f561
commit
3021598fdb
3 changed files with 62 additions and 1 deletions
|
@ -355,7 +355,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::PredicateKind::RegionOutlives(data) => {
|
ty::PredicateKind::RegionOutlives(data) => {
|
||||||
if infcx.considering_regions || data.has_placeholders() {
|
if infcx.considering_regions {
|
||||||
infcx.region_outlives_predicate(&obligation.cause, Binder::dummy(data));
|
infcx.region_outlives_predicate(&obligation.cause, Binder::dummy(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
29
src/test/ui/higher-rank-trait-bounds/issue-100689.rs
Normal file
29
src/test/ui/higher-rank-trait-bounds/issue-100689.rs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
struct Foo<'a> {
|
||||||
|
foo: &'a mut usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Bar<'a> {
|
||||||
|
type FooRef<'b>
|
||||||
|
where
|
||||||
|
'a: 'b;
|
||||||
|
fn uwu(foo: Foo<'a>, f: impl for<'b> FnMut(Self::FooRef<'b>));
|
||||||
|
}
|
||||||
|
impl<'a> Bar<'a> for () {
|
||||||
|
type FooRef<'b>
|
||||||
|
=
|
||||||
|
&'b Foo<'a>
|
||||||
|
where
|
||||||
|
'a : 'b,
|
||||||
|
;
|
||||||
|
|
||||||
|
fn uwu(
|
||||||
|
foo: Foo<'a>,
|
||||||
|
mut f: impl for<'b> FnMut(&'b Foo<'a>), //relevant part
|
||||||
|
) {
|
||||||
|
f(&foo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
32
src/test/ui/higher-rank-trait-bounds/issue-102899.rs
Normal file
32
src/test/ui/higher-rank-trait-bounds/issue-102899.rs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
pub trait BufferTrait<'buffer> {
|
||||||
|
type Subset<'channel>
|
||||||
|
where
|
||||||
|
'buffer: 'channel;
|
||||||
|
|
||||||
|
fn for_each_subset<F>(&self, f: F)
|
||||||
|
where
|
||||||
|
F: for<'channel> Fn(Self::Subset<'channel>);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SomeBuffer<'buffer> {
|
||||||
|
samples: &'buffer [()],
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'buffer> BufferTrait<'buffer> for SomeBuffer<'buffer> {
|
||||||
|
type Subset<'subset> = Subset<'subset> where 'buffer: 'subset;
|
||||||
|
|
||||||
|
fn for_each_subset<F>(&self, _f: F)
|
||||||
|
where
|
||||||
|
F: for<'subset> Fn(Subset<'subset>),
|
||||||
|
{
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Subset<'subset> {
|
||||||
|
buffer: &'subset [()],
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Add a link
Reference in a new issue