slint icon indicating copy to clipboard operation
slint copied to clipboard

Build failed when the Popup in a Row

Open puli1027 opened this issue 9 months ago • 0 comments

code as follows:

   GridLayout {
          Row {
              popup2 := PopupWindow {
                  Rectangle {
                      height: 100px;
                      width: 100px;
                      background: yellow;
                  }
  
                  x: 20px;
                  y: 20px;
                  height: 50px;
                  width: 50px;
              }
  
              TouchArea {
                  height: 100px;
                  width: 100px;
                  clicked => {
                      popup2.show();
                  }
              }
          }
   }

error message:

   error: failed to run custom build command for `rust_slint_app v0.1.0 (E:\2 Puli.Project\9 Rust\Slint\slint_app)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `E:\2 Puli.Project\9 Rust\Slint\slint_app\target\release\build\rust_slint_app-d4d6382b94d06419\build-script-build` (exit code: 101)
  --- stdout
  slint build

  --- stderr
  thread 'main' panicked at D:\AppInstall\rust\.cargo\registry\src\rsproxy.cn-0dccff568467c15b\i-slint-compiler-1.6.0\llr\lower_to_item_tree.rs:97:65:
  called `Option::unwrap()` on a `None` value
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
     1: core::panicking::panic_fmt
               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:72
     2: core::panicking::panic
               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:145
     3: core::option::unwrap_failed
               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\option.rs:1985
     4: i_slint_compiler::llr::lower_to_item_tree::LoweredSubComponentMapping::map_property_reference
     5: i_slint_compiler::llr::lower_expression::ExpressionContext::map_property_reference
     6: i_slint_compiler::llr::lower_expression::lower_expression
     7: i_slint_compiler::llr::lower_expression::lower_expression::{{closure}}
     8: i_slint_compiler::llr::lower_expression::lower_expression
     9: i_slint_compiler::llr::lower_expression::lower_expression::{{closure}}
    10: core::iter::adapters::map::map_fold::{{closure}}
    11: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::fold
    12: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
    13: core::iter::traits::iterator::Iterator::for_each
    14: alloc::vec::Vec<T,A>::extend_trusted
    15: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
    16: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
    17: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
    18: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
    19: core::iter::traits::iterator::Iterator::collect
    20: i_slint_compiler::llr::lower_expression::lower_expression
    21: i_slint_compiler::llr::lower_to_item_tree::lower_sub_component::{{closure}}
    22: i_slint_compiler::generator::handle_property_bindings_init::handle_property_inner
    23: i_slint_compiler::generator::handle_property_bindings_init::{{closure}}
    24: i_slint_compiler::object_tree::recurse_elem
    25: i_slint_compiler::object_tree::recurse_elem
    26: i_slint_compiler::generator::handle_property_bindings_init
    27: i_slint_compiler::llr::lower_to_item_tree::LoweringState::map_property_reference
    28: i_slint_compiler::llr::lower_to_item_tree::lower_sub_component::{{closure}}
    29: i_slint_compiler::llr::lower_to_item_tree::lower_sub_component::{{closure}}
    30: core::iter::adapters::map::map_fold::{{closure}}
    31: core::iter::traits::iterator::Iterator::fold
    32: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
    33: core::iter::traits::iterator::Iterator::for_each
    34: alloc::vec::Vec<T,A>::extend_trusted
    35: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
    36: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
    37: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
    38: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
    39: core::iter::traits::iterator::Iterator::collect
    40: i_slint_compiler::llr::lower_to_item_tree::LoweringState::map_property_reference
    41: i_slint_compiler::llr::lower_to_item_tree::lower_to_item_tree
    42: i_slint_compiler::generator::rust::generate
    43: slint_build::compile_with_config
    44: <i_slint_compiler::diagnostics::BuildDiagnostics as core::default::Default>::default
    45: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

and the code as follow can build success:

      GridLayout{
              Row {
                  TouchArea {
                      height: 100px;
                      width: 100px;
                      clicked => {
                          popup.show();
                      }
                  }
              }
             popup := PopupWindow {
                  Rectangle {
                      height: 100px;
                      width: 100px;
                      background: yellow;
                  }
      
                  x: 20px;
                  y: 20px;
                  height: 50px;
                  width: 50px;
              }
      }

I don't know if this is a usage error, or a bug. If it is a usage error, it is best for LSP to provide a prompt

puli1027 avatar May 17 '24 05:05 puli1027