Open
Description
Code
I tried this code:
pub struct Bigger<'a> {
_marker: &'a (),
}
impl<'a> Bigger<'a> {
pub fn get_addr(byte_list: &'a mut Vec<u8>) -> &mut u8 {
byte_list.iter_mut().find_map(|item| {
Self::other(item);
Some(())
});
byte_list.push(0);
byte_list.last_mut().unwrap()
}
pub fn other<'b: 'a>(_value: &'b mut u8) {
todo!()
}
}
I expected to see this happen: I don't know what should be the behavior. Looks like it all boils down to what is going to be 'a
within Bigger::<'a>::other
. In stable version of Rust, the code was accepted.
Instead, this happened: Using nightly version of the compiler a borrow checker error happened.
Version it worked on
It most recently worked on: cargo 1.63.0 (fd9c4297c 2022-07-01) / rustc 1.63.0 (4b91a6e 2022-08-08)
Version with regression
rustc --version --verbose
:
rustc 1.65.0-nightly (9c20b2a8c 2022-08-17)
binary: rustc
commit-hash: 9c20b2a8cc7588decb6de25ac6a7912dcef24d65
commit-date: 2022-08-17
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0