awslabs / tough

Rust libraries and tools for using and generating TUF repositories

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: no method named `absolutize_from` found for struct `PathBuf`

taoohong opened this issue · comments

I met this error when I was trying to build my rust project that has one submodule using tough v0.12.5

   ...
   Compiling tonic v0.5.2
   Compiling reqwest v0.11.14
   Compiling oauth2 v4.3.0
   Compiling oci-distribution v0.9.4
   Compiling tough v0.12.5
   Compiling openidconnect v2.5.0
error[E0599]: no method named `absolutize_from` found for struct `PathBuf` in the current scope
   --> /home/anuser/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/tough-0.12.5/src/target_name.rs:121:14
    |
121 |             .absolutize_from(&PathBuf::from("/"))
    |              ^^^^^^^^^^^^^^^ method not found in `PathBuf`

For more information about this error, try `rustc --explain E0599`.

I wanna know how to fix this error.

I update path-absolutize from v3.0.8 to v3.0.14,then I got the right result.

cargo update -p path-absolutize --precise 3.0.14

I wish this would be helpful.

It appears .absolutize_from was first introduced in the v3.0.11 release of path-absolutize: magiclen/path-absolutize@2fbfa97

tough v0.12.5 (and newer) all require a version newer than path-absolutize v3.0.11, so this should not be an issue: https://github.com/awslabs/tough/blob/tough-v0.12.5/Cargo.lock#L1240

It appears something must have overridden the requirements in your local environment. Check to make sure you had not modified any of the project's Cargo files.

Closing since we have verified the versions specified in tough are the correct versions, so this is not an issue with tough itself.