mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-22 15:41:15 +00:00
got meaningful error:
error[E0521]: borrowed data escapes outside of method
--> repro-problem/src/virtual_file.rs:702:51
|
692 | impl<'a> FileGuard<'a> {
| -- lifetime `'a` defined here
...
695 | fn with_std_file<F, R>(&mut self, with: F) -> R
| --------- `self` is a reference that is only valid in the method body
...
702 | let mut file = unsafe { File::from_raw_fd(self.as_ref().as_raw_fd()) };
| ^^^^^^^^^^^^^
| |
| `self` escapes the method body here
| argument requires that `'a` must outlive `'static`
|
= note: requirement occurs because of a mutable reference to `FileGuard<'_>`
= note: mutable references are invariant over their type parameter
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
This commit is contained in:
@@ -4,8 +4,8 @@ mod virtual_file;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
||||
let file = VirtualFile::open(camino::Utf8Path::new("foo")).await.unwrap();
|
||||
file.read_exact_at().await;
|
||||
|
||||
let file = VirtualFile::open(camino::Utf8Path::new("foo"))
|
||||
.await
|
||||
.unwrap();
|
||||
file.read_exact_at(vec![0; 8], 0).await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user