ritual icon indicating copy to clipboard operation
ritual copied to clipboard

QFlags generation fails across crate boundaries

Open jnbooth opened this issue 3 years ago • 0 comments

DEBUG [ritual::database]     source: qt_gui#8726
TRACE [ritual::database]     rust item data: Function(RustFunction { is_public: true, is_unsafe: false, path: RustPath { parts: ["qt_gui", "QRegularExpressionValidator", "regular_expression_changed"] }, kind: SignalOrSlotGetter(RustSignalOrSlotGetter), arguments: [RustFunctionArgument { argument_type: RustFinalType { ffi_type: PointerLike { kind: Reference { lifetime: None }, is_const: true, target: Common(RustCommonType { path: RustPath { parts: ["qt_gui", "QRegularExpressionValidator"] }, generic_arguments: None }) }, api_type: PointerLike { kind: Reference { lifetime: None }, is_const: true, target: Common(RustCommonType { path: RustPath { parts: ["qt_gui", "QRegularExpressionValidator"] }, generic_arguments: None }) }, conversion: None }, name: "self", ffi_index: 42 }], return_type: RustFinalType { ffi_type: Common(RustCommonType { path: RustPath { parts: ["qt_core", "Signal"] }, generic_arguments: Some([Tuple([PointerLike { kind: Pointer, is_const: true, target: Common(RustCommonType { path: RustPath { parts: ["qt_core", "QRegularExpression"] }, generic_arguments: None }) }])]) }), api_type: Common(RustCommonType { path: RustPath { parts: ["qt_core", "Signal"] }, generic_arguments: Some([Tuple([PointerLike { kind: Pointer, is_const: true, target: Common(RustCommonType { path: RustPath { parts: ["qt_core", "QRegularExpression"] }, generic_arguments: None }) }])]) }), conversion: None } })
TRACE [ritual::rust_generator] process_cpp_class: DbItem { id: ItemId { crate_name: "qt_gui", id: 15981 }, source_id: Some(ItemId { crate_name: "qt_core", id: 116 }), item: CppTypeDeclaration { path: CppPath { items: ["QFlags"<Enum { path: CppPath { items: ["Qt", "KeyboardModifier"] } }>] }, kind: Class } }
ERROR [ritual::processor] Step failed! Aborting...
INFO [ritual::workspace] Saving data
ERROR [ritual_common::errors] Error:
ERROR [ritual_common::errors]    can't add rust item with different crate name: ExtraImpl(RustExtraImpl { parent_path: RustPath { parts: ["qt_core"] }, kind: FlagEnum(RustFlagEnumImpl { enum_path: RustPath { parts: ["qt_core", "KeyboardModifier"] } }) })

This occurs from running the command CLANG_SYSTEM_INCLUDE_PATH=/usr/lib/clang/12.0.0/include target/release/qt_ritual workspace -c all --local-paths true -o main -v 0.5.0 (which I'm mostly certain is the command I'm supposed to run), during the generation of qt_gui. Even if those bail! statements are commented out, a few extra Into<QFlags> implementations aren't generated, meaning the only way to call functions like QTextBlockFormat::set_alignment is to generate the QFlags manually, e.g. QFlags::from(AlignmentFlag::AlignLeft.to_int()).

Specifically, these QFlags are missing:

  • MouseButton
  • Orientation
  • KeyboardModifier
  • WindowType
  • AlignmentFlag
  • Edge
  • ImageConversionFlag
  • DockWidget
  • ToolBarArea
  • WindowState
  • ScreenOrientation
  • TextInteractionFlag
  • InputMethodQuery
  • InputMethodHint
  • TouchPointState
  • MouseEventFlag
  • GestureFlag

jnbooth avatar Jul 05 '21 07:07 jnbooth