Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default name instead of unwrap when getting workspace root file name #326

Merged

Conversation

MikeDevresse
Copy link
Contributor

When trying to execute my tests in a docker container, I encountered the following error which was quite unclear. This PR aims to add more context to this error.

called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7f0ce1e7510f - <unknown>
   1:     0x7f0ce1d6eb7c - <unknown>
   2:     0x7f0ce1e3e4cd - <unknown>
   3:     0x7f0ce1e7696e - <unknown>
   4:     0x7f0ce1e76553 - <unknown>
   5:     0x7f0ce1e77519 - <unknown>
   6:     0x7f0ce1e77018 - <unknown>
   7:     0x7f0ce1e76fa6 - <unknown>
   8:     0x7f0ce1e76f91 - <unknown>
   9:     0x7f0ce1c486d4 - <unknown>
  10:     0x7f0ce1c488a2 - <unknown>
  11:     0x7f0ce1c91911 - <unknown>
  12:     0x7f0ce1ca1f89 - <unknown>
  13:     0x7f0ce1ca9c9a - <unknown>
  14:     0x7f0ce1ca9598 - <unknown>
  15:     0x7f0ce1c63033 - <unknown>
  16:     0x7f0ce1cc7a29 - <unknown>

@taiki-e
Copy link
Owner

taiki-e commented Dec 11, 2023

Thanks for the PR. We may want to allow this rather than keep the panic here (by setting the default name).

@MikeDevresse
Copy link
Contributor Author

MikeDevresse commented Dec 11, 2023

The issue is from Utf8Path from camino it says that the function file_name() will return None if we have / as name.
I guess you can set a default name (with unwrap_or for example) but I guess you will have to decide what to set, I don't really now what it is used for, I wanted to give extra context for other users that may encounter this.

@taiki-e
Copy link
Owner

taiki-e commented Dec 11, 2023

This is only used for the name of the profdata file, so something like unwrap_or("default") would be fine.

@taiki-e taiki-e changed the title Added an expect instead of an unwrap when getting workspace root file name Use default name instead of unwrap when getting workspace root file name Dec 13, 2023
@taiki-e taiki-e merged commit 238900d into taiki-e:main Dec 13, 2023
18 checks passed
@taiki-e
Copy link
Owner

taiki-e commented Dec 13, 2023

Published in 0.5.38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants