Commit graph

150 commits

Author SHA1 Message Date
Ayaz Hafiz
70b80c275f
Avoid panic 2025-01-05 23:54:47 -05:00
Ayaz Hafiz
a003a16979
Catch panics that happen within repl step executions
Example session:

```
» 1 + 1
The Roc compiler had an internal error.
Please file a bug report at
    https://github.com/roc-lang/roc/issues/new
Please include the following data:

Error message: intentional panic
Stack backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2: std::backtrace::Backtrace::create
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/backtrace.rs:331:13
   3: panic_hook
             at ./crates/repl_cli/src/lib.rs:52:41
   4: call<fn(&core::panic::panic_info::PanicInfo), (&core::panic::panic_info::PanicInfo)>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:79:5
   5: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2029:9
   6: std::panicking::rust_panic_with_hook
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:785:13
   7: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:651:13
   8: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:171:18
   9: rust_begin_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
  10: core::panicking::panic_fmt
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
  11: step
             at ./crates/repl_ui/src/repl_state.rs:66:9
  12: {closure#1}
             at ./crates/repl_cli/src/lib.rs:109:21
  13: call_once<roc_repl_cli::main::{closure_env#1}, ()>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  14: call_once<roc_repl_ui::repl_state::ReplAction, roc_repl_cli::main::{closure_env#1}>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panic/unwind_safe.rs:272:9
  15: do_call<core::panic::unwind_safe::AssertUnwindSafe<roc_repl_cli::main::{closure_env#1}>, roc_repl_ui::repl_state::ReplAction>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  16: ___rust_try
  17: try<roc_repl_ui::repl_state::ReplAction, core::panic::unwind_safe::AssertUnwindSafe<roc_repl_cli::main::{closure_env#1}>>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  18: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<roc_repl_cli::main::{closure_env#1}>, roc_repl_ui::repl_state::ReplAction>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  19: main
             at ./crates/repl_cli/src/lib.rs:108:30
  20: main
             at ./crates/cli/src/main.rs:321:16
  21: call_once<fn() -> core::result::Result<(), std::io::error::Error>, ()>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
  22: __rust_begin_short_backtrace<fn() -> core::result::Result<(), std::io::error::Error>, core::result::Result<(), std::io::error::Error>>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:155:18
  23: {closure#0}<core::result::Result<(), std::io::error::Error>>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:166:18
  24: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:284:13
  25: std::panicking::try::do_call
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  26: std::panicking::try
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  27: std::panic::catch_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  28: std::rt::lang_start_internal::{{closure}}
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:148:48
  29: std::panicking::try::do_call
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
  30: std::panicking::try
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
  31: std::panic::catch_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
  32: std::rt::lang_start_internal
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:148:20
  33: lang_start<core::result::Result<(), std::io::error::Error>>
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:165:17
  34: _main

Machine Target: MacArm64
```
2025-01-05 23:54:47 -05:00
Brendan Hansknecht
f9ef233541
clippy 2024-12-11 17:36:01 -08:00
Brendan Hansknecht
87537b800e
merge llvm ir optimization locations 2024-12-11 17:33:20 -08:00
Luke Boswell
656a7bcd87
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-11-30 10:18:11 +11:00
Luke Boswell
6c6f6e08a9
replace cargo deps with workspace in linker, packaging, repl_* 2024-11-29 10:53:54 +11:00
Luke Boswell
2feb5d3c2e
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-11-29 08:58:47 +11:00
shua
621bd177e6
rm unused dependencies
left in perfcnt and criterion-perf-events because they are used in
nightly_benches, which is not included in the workspace so cargo doesn't
know about it. All the others are not currently used anywhere in the
repository.
2024-11-26 23:05:23 +01:00
Luke Boswell
dc3aa06d61
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-11-13 09:02:20 +11:00
Luke Boswell
915097d792
Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig 2024-10-08 18:21:24 +11:00
Brendan Hansknecht
a9d1327dd1
Enable multiple functions exposed to the host 2024-10-07 21:16:30 -07:00
Anton-4
a24774c801
improve dylib error
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-10-02 11:38:34 +02:00
jamin-eisenberg
7429f8a970
Initial attempt (failing tests?) 2024-08-28 18:15:23 -04:00
Luke Boswell
8090e99e75
cleanup llvm module optimisation passes 2024-08-04 12:13:01 +10:00
Agus Zubiaga
52f84910a7
Support importing local files in the REPL 2024-04-26 23:33:19 -03:00
Brendan Hansknecht
6dc5bfb1b7
Use roc_target over target_lexicon
Tailors a target class for our needs.
Replaces tons of uses across the entire compiler.
This is a base for later adding new targets like thumb.
2024-03-31 10:50:26 -07:00
Anton-4
adf88e7282
change underline color 2024-02-19 13:53:01 +01:00
Anton-4
c6b5e2f8c3
less colors more contrast 2024-02-14 17:20:44 +01:00
Folkert
b0d57587e3
List.get with negative index in repl 2024-01-28 22:21:40 +01:00
Brendan Hansknecht
496cd6710a
fix debug info and add it all to the llvm backend 2023-12-04 12:55:33 -08:00
Richard Feldman
b725a114cf
Remove fancy quote from rockin' roc repl 2023-11-18 22:16:14 -05:00
Folkert
7bcff253be
enable dev backend repl on macos (x86_64 and aarch64) 2023-10-10 15:12:50 +02:00
Richard Feldman
1f396871f9
Simplify repl tips 2023-09-18 15:26:09 -05:00
Richard Feldman
e6b9446755
Move WELCOME_MESSAGE to be cli-specific 2023-09-18 15:26:09 -05:00
Richard Feldman
074401fbdf
Remove the whole #var1 thing 2023-09-17 06:31:51 -04:00
Richard Feldman
f4937e72cc
Try printing #val1 at end of previous line 2023-09-17 01:01:58 -04:00
Folkert
287c893043
fix unused warning on macos 2023-09-14 14:53:44 +02:00
Folkert
2ddf0ce180
disable debugging flag 2023-09-14 14:43:29 +02:00
Folkert
5557fb7e34
repl helper codegen 2023-09-14 14:39:12 +02:00
Folkert
dcdaaf4328
enable dev backend repl 2023-09-14 14:38:31 +02:00
Folkert
5ca3d3bcf1
make llvm tests work again 2023-09-13 20:24:15 +02:00
Brian Carroll
ead3c33eb8
Tweak comments and factoring 2023-09-10 11:28:29 +01:00
Brian Carroll
6a47a99114
formatting & clippy 2023-09-09 16:13:17 +01:00
Brian Carroll
aa0e975845
clippy 2023-09-09 15:03:50 +01:00
Brian Carroll
fc7b831285
remove some more duplicated code (format_output) 2023-09-09 14:45:14 +01:00
Brian Carroll
3923dad203
Remove duplicated code from roc_repl_cli and get tests compiling 2023-09-09 13:01:31 +01:00
Brian Carroll
8f59ee9492
Create a new crate roc_repl_ui for shared CLI/web UI code 2023-09-09 11:55:55 +01:00
Richard Feldman
dbf928bc46
Reorganize ReplState logic for cli/wasm compat 2023-09-08 15:37:16 -04:00
Folkert
7fb4b60b21
move around hostexposedalias logic 2023-08-09 15:09:03 +02:00
Ayaz Hafiz
44c4797d9a
Parameterize program solving on a FunctionKind
This new flag determines whether we should introduce a new kind to
represent lambda sets, or whether lambdas should be erased. The latter
is not yet implemented.
2023-07-12 13:53:50 -05:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
eiei114
bf3f541331
Merge branch 'main' into fix/replace_panic_with_internal_error 2023-06-27 12:48:34 +09:00
eiei114
486558396f
replace panic 2023-06-25 18:13:44 +09:00
eiei114
c1d4a18c00
Revert "replace"
This reverts commit f43e346897.
2023-06-25 17:50:05 +09:00
eiei114
f43e346897
replace 2023-06-25 17:14:02 +09:00
Ayaz Hafiz
41597cbab7
Do not make LayoutInterner mutable 2023-06-17 18:13:03 -05:00
Gabriel Dertoni
a7640bc0ac
fix: repl panic on empty line 2023-04-27 02:01:17 -03:00
Folkert
4cd8f0a056 clippy --fix fixes 2023-04-21 12:05:51 +02:00
Folkert
fe15a2e79c
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-03-08 19:46:00 +01:00
Brendan Hansknecht
f42f61e271
run a toml formatter and then clean it up a bit 2023-03-06 19:47:57 -08:00