Giter Club home page Giter Club logo

Comments (11)

NobodyXu avatar NobodyXu commented on June 5, 2024 1

Closing this since rebooting seemed to fix the issue.

from openssh-sftp-client.

jonhoo avatar jonhoo commented on June 5, 2024

From what I can tell, the error is in the lint that checks for valid links in documentation, not a rustc error per se. My guess is that you're running into the backwards-incompatibility from rust-lang/rust#97030 where Rust 1.62.0+ will actually interpret the documentation of private macros whereas earlier versions would not (and thus would not error on bad links there either).

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

@jonhoo I actually encountered such lifetime error in src/fs/mod.rs, but I cannot reproduce it for now.

I will close this since it cannot be reproduced, but if I encounter it again in the future, I will capture the entire output from cargo and as much information as possible.

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

@jonhoo I finally was able to reproduce it in bug:

❯ ../check.sh
+++ realpath ../check.sh
++ dirname /Users/nobodyxu/Dev/openssh-sftp-client/check.sh
+ cd /Users/nobodyxu/Dev/openssh-sftp-client
+ for workspace in openssh-sftp-error openssh-sftp-client-lowlevel
+ cd openssh-sftp-error
+ run_check
+ cargo fmt --all -- --check
+ cargo clippy --all --no-deps
   Compiling sftp-test-common v0.1.0 (/Users/nobodyxu/Dev/openssh-sftp-client/sftp-test-common)
    Checking openssh-sftp-error v0.1.0 (/Users/nobodyxu/Dev/openssh-sftp-client/openssh-sftp-error)
    Checking openssh-sftp-client-lowlevel v0.1.0 (/Users/nobodyxu/Dev/openssh-sftp-client/openssh-sftp-cl
ient-lowlevel)
    Checking openssh-sftp-client v0.10.3 (/Users/nobodyxu/Dev/openssh-sftp-client)
error: lifetime may not live long enough
  --> src/fs/mod.rs:73:78
   |
73 |       async fn open_dir_impl(&mut self, path: &Path) -> Result<Dir<'_>, Error> {
   |  ____________________________-________________-________________________________^
   | |                            |                |
   | |                            |                let's call the lifetime of this reference `'1`
   | |                            let's call the lifetime of this reference `'2`
74 | |         let path = self.concat_path_if_needed(path);
75 | |
76 | |         self.write_end
...  |
79 | |             .map(|handle| Dir(OwnedHandle::new(self.write_end.clone(), handle)))
80 | |     }
   | |_____^ associated function was supposed to return data with lifetime `'1` but it is returning data
with lifetime `'2`

error: lifetime may not live long enough
  --> src/fs/mod.rs:73:78
   |
73 |       async fn open_dir_impl(&mut self, path: &Path) -> Result<Dir<'_>, Error> {
   |  ____________________________-________________-________________________________^
   | |                            |                |
   | |                            |                let's call the lifetime of this reference `'1`
   | |                            let's call the lifetime of this reference `'2`
74 | |         let path = self.concat_path_if_needed(path);
75 | |
76 | |         self.write_end
...  |
79 | |             .map(|handle| Dir(OwnedHandle::new(self.write_end.clone(), handle)))
80 | |     }
   | |_____^ associated function was supposed to return data with lifetime `'2` but it is returning data
with lifetime `'1`

error: lifetime may not live long enough
  --> src/fs/mod.rs:76:9
   |
72 |   impl<'s> Fs<'s> {
   |        -- lifetime `'s` defined here
73 |       async fn open_dir_impl(&mut self, path: &Path) -> Result<Dir<'_>, Error> {
   |                                               - let's call the lifetime of this reference `'1`
...
76 | /         self.write_end
77 | |             .send_request(|write_end, id| Ok(write_end.send_opendir_request(id, path)?.wait()))
78 | |             .await
79 | |             .map(|handle| Dir(OwnedHandle::new(self.write_end.clone(), handle)))
   | |________________________________________________________________________________^ associated functi
on was supposed to return data with lifetime `'1` but it is returning data with lifetime `'s`

error: could not compile `openssh-sftp-client` due to 3 previous errors


from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

./run_tests.sh did not give any error.

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

rustc -vV:

rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: aarch64-apple-darwin
release: 1.62.0
LLVM version: 14.0.5

uname -a:

Darwin Jiahaos-Air.nifi 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.1
21.3~4/RELEASE_ARM64_T8101 arm64

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

@jonhoo I was also able to reproduce that on this commit once I changed create_dir implementation to this:

    /// Creates a new, empty directory at the provided path.
    pub async fn create_dir(&mut self, path: impl AsRef<Path>) -> Result<(), Error> {
        async fn inner(this: &mut Fs<'_>, path: &Path) -> Result<(), Error> {
            this.dir_builder().create(path).await
        }

        inner(self, path.as_ref()).await
    }

then I would get:

   Compiling openssh-sftp-client v0.10.3 (/Users/nobodyxu/Dev/openssh-sftp-client)
error: lifetime may not live long enough
  --> src/fs/mod.rs:75:86
   |
75 |           async fn inner<'s>(this: &mut Fs<'s>, path: &Path) -> Result<Dir<'s>, Error> {
   |  ________________________--___________________________-________________________________^
   | |                        |                            |
   | |                        |                            let's call the lifetime of this reference `'1`
   | |                        lifetime `'s` defined here
76 | |             let path = this.concat_path_if_needed(path);
77 | |
78 | |             this.write_end
...  |
81 | |                 .map(|handle| Dir(OwnedHandle::new(this.write_end.clone(), handle)))
82 | |         }
   | |_________^ function was supposed to return data with lifetime `'s` but it is returning data with lif
etime `'1`

error: lifetime may not live long enough
  --> src/fs/mod.rs:78:13
   |
75 |           async fn inner<'s>(this: &mut Fs<'s>, path: &Path) -> Result<Dir<'s>, Error> {
   |                          --                           - let's call the lifetime of this reference `'1
`
   |                          |
   |                          lifetime `'s` defined here
...
78 | /             this.write_end
79 | |                 .send_request(|write_end, id| Ok(write_end.send_opendir_request(id, path)?.wait()))
80 | |                 .await
81 | |                 .map(|handle| Dir(OwnedHandle::new(this.write_end.clone(), handle)))
   | |____________________________________________________________________________________^ function was s
upposed to return data with lifetime `'1` but it is returning data with lifetime `'s`

error: could not compile `openssh-sftp-client` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

Hmmm, once I removed target, it seems to be working just fine again.

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

I encountered it again in commit.

Once I modify src/file/mod.rs, it gives me error in fs/mod.rs again:

error: lifetime may not live long enough
  --> src/fs/mod.rs:75:86
   |
75 |           async fn inner<'s>(this: &mut Fs<'s>, path: &Path) -> Result<Dir<'s>, Error> {
   |  ________________________--________-___________________________________________________^
   | |                        |         |
   | |                        |         let's call the lifetime of this reference `'1`
   | |                        lifetime `'s` defined here
76 | |             let path = this.concat_path_if_needed(path);
77 | |
78 | |             this.write_end
...  |
81 | |                 .map(|handle| Dir(OwnedHandle::new(this.write_end.clone(), handle)))
82 | |         }
   | |_________^ function was supposed to return data with lifetime `'s` but it is returning data with lif
etime `'1`

error: could not compile `openssh-sftp-client` due to previous error
warning: build failed, waiting for other jobs to finish...

@jonhoo And once again, if I remove target/, everything works just fine.

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

This appears that 1.62 has problem with caching build artifacts in target.
Every time this happens, I just need to remove target/ to fix it.

Edit:

Could this be a problem with MacOS?
Like a corruption happens somewhere in the system.

from openssh-sftp-client.

NobodyXu avatar NobodyXu commented on June 5, 2024

This might just be bugs in MacOS.

I restarted my MacBook yesterday and it hasn't yet happened today.

from openssh-sftp-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.