roc icon indicating copy to clipboard operation
roc copied to clipboard

error on editor start: clap Must use `Arg::allow_invalid_utf8`

Open Anton-4 opened this issue 3 years ago • 2 comments

As reported by Gabriel Pickl:

Shortly after downloading the roc binary, the editor opened properly and created a new_roc_project folder. After clearing up some tooling to allow the default roc platform to build (my XCode was out of date and thus clang was broken), trying to run roc edit . again results in the following error:

thread 'main' panicked at 'Must use `Arg::allow_invalid_utf8` with `_os` lookups', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1784:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Notably, /Users/runner doesn't exist, as there is no runner user. My first assumption was that updating XCode broke some LLVM IR cargo was caching, but now I'm actually not sure what's going on.

Anton-4 avatar Oct 03 '22 10:10 Anton-4

Here's the back trace from my machine when it encountered the same problem:

thread 'main' panicked at 'Must use `Arg::allow_invalid_utf8` with `_os` lookups', /Users/chrisduncan/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1780:1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: clap::parser::matches::arg_matches::unwrap_os_string
             at /Users/chrisduncan/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1784:13
   3: clap::parser::matches::arg_matches::unwrap_os_string{{reify.shim}}
             at /Users/chrisduncan/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1780:1
   4: core::ops::function::FnMut::call_mut
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:150:5
   5: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:280:13
   6: core::option::Option<T>::map
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/option.rs:912:29
   7: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/iter/adapters/map.rs:103:9
   8: <clap::parser::matches::arg_matches::OsValues as core::iter::traits::iterator::Iterator>::next
             at /Users/chrisduncan/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1667:9
   9: roc::main::{{closure}}
             at /Users/chrisduncan/Development/open-source-forks/roc/crates/cli/src/main.rs:185:35
  10: core::option::Option<T>::map
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/option.rs:912:29
  11: roc::main
             at /Users/chrisduncan/Development/open-source-forks/roc/crates/cli/src/main.rs:183:19
  12: core::ops::function::FnOnce::call_once
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5

cjduncana avatar Oct 09 '22 21:10 cjduncana

Zulip topic for reference

cjduncana avatar Oct 09 '22 21:10 cjduncana

Can someone who encountered this error before try cargo run --release edit on the editor_launch_fix branch. The editor is working for me on nixos and macos 12 (apple silicon). On that branch I've also added a CI test that checks the editor can launch successfully.

Anton-4 avatar Oct 28 '22 16:10 Anton-4

The editor_launch_fix branch is merged.

Anton-4 avatar Nov 07 '22 14:11 Anton-4