Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
}

ty::PredicateKind::RegionOutlives(data) => {
if infcx.considering_regions || data.has_placeholders() {
if infcx.considering_regions {
infcx.region_outlives_predicate(&obligation.cause, Binder::dummy(data));
}

Expand Down
29 changes: 29 additions & 0 deletions src/test/ui/higher-rank-trait-bounds/issue-100689.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 32 additions & 0 deletions src/test/ui/higher-rank-trait-bounds/issue-102899.rs
Original file line number Diff line number Diff line change
@@ -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() {}