rust/tests/ui/lifetimes/noisy-follow-up-erro.rs

24 lines
544 B
Rust
Raw Normal View History

2024-05-27 03:22:32 -05:00
struct Foo<'c, 'd>(&'c (), &'d ());
impl<'c, 'd> Foo<'c, 'd> {
fn acc(&mut self, _bar: &Bar) -> &'d () {
todo!()
}
}
struct Bar;
impl<'a> Bar {
fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> {
//~^ ERROR: struct takes 2 lifetime arguments but 3 lifetime arguments were supplied
self.bar().map_err(|()| foo.acc(self))?;
//~^ ERROR: explicit lifetime required in the type of `foo`
Ok(())
}
fn bar(&self) -> Result<(), &'a ()> {
todo!()
}
}
fn main() {}