Stream: project-error-handling

Topic: Implement Error for &(impl Error) crate fixes


view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:20):

I am currently fixing the crates that broke due to #75180 and have stumbled upon some small issues. For example crate neptungen fails with linker errors when I fix the errors introduced by this PR

view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:21):

         /usr/bin/ld: /mnt/games/Projects/OpenSourceFixes/rust_pr_75180/neptungen/target/debug/deps/libmd6-438a994c8a2766cb.rlib(md6_compress.o):/home/jduchniewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/md6-1.1.1/ext/md6/md6.h:425: multiple definition of `compression_hook'; /mnt/games/Projects/OpenSourceFixes/rust_pr_75180/neptungen/target/debug/deps/libmd6-438a994c8a2766cb.rlib(md6_nist.o):/home/jduchniewicz/.cargo/registry/src/github.com-1ecc6299db9ec823/md6-1.1.1/ext/md6/md6.h:425: first defined here
          collect2: error: ld returned 1 exit status

view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:22):

It seems like I am getting the same symbol twice (once due to my custom toolchain and once due to regular one?)

view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:29):

Besides, I try to wrap my head around as to WHY does removing as_ref() causes this to work with the implementation introduced by this PR

view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:30):

[INFO] [stdout] error[E0283]: type annotations needed for `std::string::String`
[INFO] [stdout]    --> src/sync.rs:282:76
[INFO] [stdout]     |
[INFO] [stdout] 282 |                         format!("Error during ftp put operation: {:?}", e).as_ref(),
[INFO] [stdout]     |                         -------------------------------------------------- ^^^^^^ cannot infer type for struct `std::string::String`
[INFO] [stdout]     |                         |
[INFO] [stdout]     |                         consider giving `res` a type
[INFO] [stdout]     |
[INFO] [stdout]     = note: cannot satisfy `std::string::String: std::convert::AsRef<_>`

view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:35):

I guess I still know too little about the library :slight_frown:

view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:50):

As for other breakage:
chainerror - fixed, PR waiting for merge
neptungen - weird error
mars-discovery is a no-star repo without any forks
c_string - no longer maintained
sv - not sure how to fix this error to be honest (again too brisk knowledge of the library yet)

view this post on Zulip Jakub Duchniewicz (Jan 12 2021 at 12:50):

eyre and strerror I have not yet tried

view this post on Zulip Jane Lusby (Jan 12 2021 at 12:57):

You can leave eyre to me

view this post on Zulip Jane Lusby (Jan 12 2021 at 12:57):

And I'll get back to u once I've woken up about the as_ref stuff

view this post on Zulip Jane Lusby (Jan 12 2021 at 12:57):

_passes back out_

view this post on Zulip Jane Lusby (Jan 12 2021 at 19:35):

okay im back

view this post on Zulip Jane Lusby (Jan 12 2021 at 19:37):

Jakub Duchniewicz said:

[INFO] [stdout] error[E0283]: type annotations needed for `std::string::String`
[INFO] [stdout]    --> src/sync.rs:282:76
[INFO] [stdout]     |
[INFO] [stdout] 282 |                         format!("Error during ftp put operation: {:?}", e).as_ref(),
[INFO] [stdout]     |                         -------------------------------------------------- ^^^^^^ cannot infer type for struct `std::string::String`
[INFO] [stdout]     |                         |
[INFO] [stdout]     |                         consider giving `res` a type
[INFO] [stdout]     |
[INFO] [stdout]     = note: cannot satisfy `std::string::String: std::convert::AsRef<_>`

Where is this error from?

view this post on Zulip Jane Lusby (Jan 12 2021 at 19:37):

Jakub Duchniewicz said:

I am currently fixing the crates that broke due to #75180 and have stumbled upon some small issues. For example crate neptungen fails with linker errors when I fix the errors introduced by this PR

Not sure, you could try using cargo tree -d to see if you've ended up with any duplicate dependencies

view this post on Zulip Jane Lusby (Jan 12 2021 at 19:37):

that's my best bet as to why the symbol would be found twice

view this post on Zulip Jakub Duchniewicz (Jan 13 2021 at 09:40):

Jane Lusby said:

Jakub Duchniewicz said:

[INFO] [stdout] error[E0283]: type annotations needed for `std::string::String`
[INFO] [stdout]    --> src/sync.rs:282:76
[INFO] [stdout]     |
[INFO] [stdout] 282 |                         format!("Error during ftp put operation: {:?}", e).as_ref(),
[INFO] [stdout]     |                         -------------------------------------------------- ^^^^^^ cannot infer type for struct `std::string::String`
[INFO] [stdout]     |                         |
[INFO] [stdout]     |                         consider giving `res` a type
[INFO] [stdout]     |
[INFO] [stdout]     = note: cannot satisfy `std::string::String: std::convert::AsRef<_>`

Where is this error from?

this is from the rust-sv library and matches on String stored in self

            Message::Other(s) => Err(io::Error::new(io::ErrorKind::InvalidData, s.as_ref())),

view this post on Zulip Jakub Duchniewicz (Jan 13 2021 at 09:41):

oh and returns io::Result<()>

view this post on Zulip Jakub Duchniewicz (Jan 13 2021 at 09:42):

so I guess there is some ownership problem involved as we cannot move out of self the String contained within

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:26):

not sure

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:27):

let me checkout the rust-sv library and see what you mean

view this post on Zulip Jakub Duchniewicz (Jan 13 2021 at 20:27):

it is probably something quite simple :grimacing:

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:28):

@Jakub Duchniewicz are you using the current nightly to get these errors or did you have to compile a custom toolchain?

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:28):

im assuming nightly because I think I recall this change already landed

view this post on Zulip Jakub Duchniewicz (Jan 13 2021 at 20:29):

hmm it's this change

view this post on Zulip Jakub Duchniewicz (Jan 13 2021 at 20:29):

https://github.com/rust-lang/rust/pull/75180

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:29):

oh it didnt land

view this post on Zulip Jakub Duchniewicz (Jan 13 2021 at 20:29):

It is still open

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:29):

lol darn

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:29):

so I have to compile rustc

view this post on Zulip Jane Lusby (Jan 13 2021 at 20:29):

alright

view this post on Zulip Ashley Mannix (Jan 13 2021 at 22:55):

@Jakub Duchniewicz Ah I think that error with as_ref is inference failing now that there are more ways to make a String satisfy the impl Into<Box<dyn Error + Send + Sync + ‘static>> bound that io::Error::new wants. I’ll check it out when I’m back in front of a machine 🙂

view this post on Zulip Jakub Duchniewicz (Jan 14 2021 at 07:53):

Right, so I should do explicit calls using the the turbofish syntax right?


Last updated: Jan 26 2022 at 14:20 UTC