Skip to content

v0.10.0: common widget methods now require qualified calls when importing prelude or multiple traits #2118

@awused

Description

@awused

Bug description

I've defined a MainWindow for my application, but after updating to 0.10.0 many common method names are duplicated across many traits when I import the gtk4-rs prelude. This example isn't complete but I think it's enough to illustrate the problem:

glib::wrapper! {                                                                                                                                                                                                                 
    pub struct MainWindow(ObjectSubclass<imp::MainWindow>)                                                                                                                                                                       
        @extends gtk::Widget, gtk::ApplicationWindow, gtk::Window,                                                                                                                                                               
        @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager, gtk::Native, gtk::Root, ActionGroup, ActionMap;                                                                                
}

use gtk::prelude::*;

let window = MainWindow::new(application);
let display = window.display(); // newly ambiguous with v0.10.0;
let focus = window.focus(); // ditto

Backtrace

error[E0034]: multiple applicable items in scope
  --> src/gui/applications/open_with.rs:82:34
   |
82 |         let display = window.display();
   |                                  ^^^^^^^ multiple `display` found
   |
   = note: candidate #1 is defined in an impl of the trait `gtk4::prelude::AppLaunchContextExt` for the type `O`
   = note: candidate #2 is defined in an impl of the trait `gtk4::prelude::DeviceExt` for the type `O`
   = note: candidate #3 is defined in an impl of the trait `gtk4::prelude::DragExt` for the type `O`
   = note: candidate #4 is defined in an impl of the trait `gtk4::prelude::DrawContextExt` for the type `O`
   = note: and 9 others

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions