https://github.com/rtfeldman/roc/issues/2875 Include the file name/path in compiler warnings/errors
I have a PR almost ready. I was going to have it show the full path to the file, such as /home/cone/roc/interactive/echo.roc
, however since the path is unique per-machine it doesn't jive well with unit tests. So for now I'm just showing the file name, no path. I'm open to suggestions on how to mitigate:
#[cfg(test)]
but it didn't work.roc/interactive/echo.roc
. I think this would be compatible with the unit tests. I don't know offhand a good way to get the working directory during the call to Report.pretty
Somehow remove the working directory from the path, so it would show the relative path instead such as roc/interactive/echo.roc
In my mind this would be the best thing to do, since if you're invoking from a command line you're working relative to a directory anyway. Once there is a better notion of an application/package root we could use that as the relative base, but I think relative to pwd is a good idea
We have the app folder and use it to find the platform. That would probably be the best if it is available there
I have most of the tests passing but not sure what to do about some of the tests such as test_load::parse_problem
. It's writing the source files to a random platform-dependent temp dir:
── OPAQUE TYPE DECLARED OUTSIDE SCOPE ─────────────────── /tmp/.tmpWQAZ9p/Main ─
Would it be fine to change these tests to write the source files to a deterministic relative dir? If so, any recommendations?
If you browse through some of the the .gitignore
files in the project you'll find some of them are in test directories, ignoring output similar to this. So that might give you an idea of what others have done before.
But I'd say it's OK to just pick whatever name makes sense to you!
Perfect thanks!
PR at https://github.com/rtfeldman/roc/pull/2906
All tests are passing locally, however after updating to latest and running cargo test
, git status
shows these files as untracked
cli/tests/fixtures/multi-dep-str/platform/dynhost
cli/tests/fixtures/multi-dep-str/platform/libapp.so
cli/tests/fixtures/multi-dep-str/platform/metadata
cli/tests/fixtures/multi-dep-str/platform/preprocessedhost
cli/tests/fixtures/multi-dep-thunk/platform/dynhost
cli/tests/fixtures/multi-dep-thunk/platform/libapp.so
cli/tests/fixtures/multi-dep-thunk/platform/metadata
cli/tests/fixtures/multi-dep-thunk/platform/preprocessedhost
Also a test is failing for me on trunk:
---- gen_num::upcast_of_int_checked_is_zext stdout ----
thread 'gen_num::upcast_of_int_checked_is_zext' panicked at 'assertion failed: `(left == right)`
left: `257`,
right: `1`: LLVM test failed', compiler/test_gen/src/gen_num.rs:3144:5
but it isn't failing for me on this branch, even tho the branch has been rebased to trunk head. Not sure what that's about...
github CI found some more tests I need to update
Gitignore those untracked files
They are from surgical linking. Probably can be ignored across the entire repo instead of just the examples folder like it is currently
Eventually they need to move into the roc cache dir that doesn't exist yet
For the test failing on trunk but not your branch, did you accidentally merge in a way to remove or disable the test?
Nah I don't think the test was disabled, but it may have been an intermittent failure. I tried syncing latest trunk again, but cargo test
is failing for me:
[nix-shell:~/roc]$ cargo test
Compiling roc_can v0.1.0 (/home/cone/roc/compiler/can)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.58.0 (02072b482 2022-01-11) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `roc_can`
warning: build failed, waiting for other jobs to finish...
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs:18:85
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.58.0 (02072b482 2022-01-11) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
error: build failed
I'm actually still able to compile roc and run the echo example, just seems to be an issue with cargo test
I tried a clean sync with git fetch --prune origin && git reset --hard origin/trunk && git clean -f -d
, tried removing and reinstalling nix, but still getting that error with cargo test
I was able to resolve this with cargo clean
. Still getting some other errors when doing cargo test
but no more panics from the rust compiler
Jared Cone has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC