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

slint_build::compile panic #7784

Open
petiaccja opened this issue Mar 3, 2025 · 1 comment
Open

slint_build::compile panic #7784

petiaccja opened this issue Mar 3, 2025 · 1 comment
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working

Comments

@petiaccja
Copy link

petiaccja commented Mar 3, 2025

crash_repro.zip

Bug Description

slint_build crashes with a panic. I've attached an minimal cargo project to reproduce.

PS PATH\crash_repro> cargo build
   Compiling crash-repro v0.1.0 (PATH\crash_repro)
error: failed to run custom build command for `crash-repro v0.1.0 (PATH

[crash_repro.zip](https://github.com/user-attachments/files/19056701/crash_repro.zip)

\crash_repro)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `PATH\build-script-build` (exit code: 101)
  --- stderr

  thread 'main' panicked at PATH\i-slint-compiler-1.10.0\llr\lower_expression.rs:43:34:
  called `Option::unwrap()` on a `None` value
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\std\src\panicking.rs:692
     1: core::panicking::panic_fmt
               at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\core\src\panicking.rs:75
     2: core::panicking::panic
               at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\core\src\panicking.rs:145
     3: core::option::unwrap_failed
               at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\core\src\option.rs:2015
     4: i_slint_compiler::llr::lower_expression::ExpressionLoweringCtx::map_property_reference
     5: i_slint_compiler::llr::lower_expression::lower_expression
     6: i_slint_compiler::llr::lower_expression::lower_expression
     7: i_slint_compiler::llr::lower_expression::lower_expression
     8: i_slint_compiler::llr::lower_expression::lower_expression
     9: i_slint_compiler::llr::lower_expression::lower_expression::{{closure}}
    10: i_slint_compiler::llr::lower_expression::lower_expression
    11: i_slint_compiler::llr::lower_expression::lower_expression::{{closure}}
    12: core::iter::adapters::map::map_fold::{{closure}}
    13: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::fold
    14: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
    15: core::iter::traits::iterator::Iterator::for_each
    16: alloc::vec::Vec<T,A>::extend_trusted
    17: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
    18: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
    19: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
    20: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
    21: core::iter::traits::iterator::Iterator::collect
    22: i_slint_compiler::llr::lower_expression::lower_expression
    23: i_slint_compiler::llr::lower_to_item_tree::lower_component_container::{{closure}}
    24: i_slint_compiler::llr::lower_to_item_tree::lower_to_item_tree
    25: i_slint_compiler::generator::rust::generate
    26: slint_build::compile_with_config::{{closure}}
    27: core::num::nonzero::NonZero<T>::new_unchecked::precondition_check
    28: slint_build::compile
    29: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::size_hint
    30: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Reproducible Code (if applicable)

Environment Details

  • Slint Version: 1.10.0
  • Platform/OS: Windows 11
  • Programming Language: Slint (via slint_build)
  • Backend/Renderer: -

Product Impact

No response

@petiaccja petiaccja added bug Something isn't working need triaging Issue that the owner of the area still need to triage labels Mar 3, 2025
@ogoffart
Copy link
Member

ogoffart commented Mar 5, 2025

Thanks for your bug report and minimal example.

Here is the code that makes the compiler panic:

global State {
    in property <int> tab-names;
}

export component AppWindow inherits Window {
    private property <int> current-tab;
    in property <int> tab-names <=> State.tab-names;
    changed tab-names => {
        current-tab = tab-names;
    }
}

@ogoffart ogoffart added a:compiler Slint compiler internal (not the codegen, not the parser) and removed need triaging Issue that the owner of the area still need to triage labels Mar 5, 2025
@ogoffart ogoffart marked this as a duplicate of #7729 Mar 5, 2025
@ogoffart ogoffart mentioned this issue Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:compiler Slint compiler internal (not the codegen, not the parser) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants