gtk-rs / gtk3-rs

Rust bindings for GTK 3
https://gtk-rs.org
MIT License
508 stars 90 forks source link

[BUG] The examples don't compile due compilation error on atk v0.19.0 #855

Open a-bentofreire opened 4 months ago

a-bentofreire commented 4 months ago

When I attempt to compile examples/basics (but it's not restricted to this example, also I can't compile none of my programs).

Executed on 2024-03-03:

  1. Download the https://github.com/gtk-rs/gtk3-rs into an empty folder
  2. cd examples/basics
  3. cargo b

Error

It fails with this message:

error[E0405]: cannot find trait `IsA` in crate `glib`
 --> atk/src/editable_text.rs:9:19
  |
9 |     impl<T: glib::IsA<crate::EditableText>> Sealed for T {}
  |                   ^^^ not found in `glib`
  |
help: consider importing one of these items
  |
8 +     use crate::editable_text::IsA;
  |
8 +     use glib::prelude::IsA;
  |
help: if you import `IsA`, refer to it directly
  |
9 -     impl<T: glib::IsA<crate::EditableText>> Sealed for T {}
9 +     impl<T: IsA<crate::EditableText>> Sealed for T {}
  |

error[E0405]: cannot find trait `IsA` in crate `glib`
 --> atk/src/table.rs:9:19
  |
9 |     impl<T: glib::IsA<crate::Table>> Sealed for T {}
  |                   ^^^ not found in `glib`
  |
help: consider importing one of these items
  |
8 +     use crate::table::IsA;
  |
8 +     use glib::prelude::IsA;
  |
help: if you import `IsA`, refer to it directly
  |
9 -     impl<T: glib::IsA<crate::Table>> Sealed for T {}
9 +     impl<T: IsA<crate::Table>> Sealed for T {}
  |

For more information about this error, try `rustc --explain E0405`.
error: could not compile `atk` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

--explain

The code refers to a trait that is not in scope.

Erroneous code example:

struct Foo;

impl SomeTrait for Foo {} // error: trait `SomeTrait` is not in scope

Please verify that the name of the trait wasn't misspelled and ensure that it was imported. Example:

// solution 1:
use some_file::SomeTrait;

// solution 2:
trait SomeTrait {
    // some functions
}

struct Foo;

impl SomeTrait for Foo { // ok!
    // implements functions
}

Printout

warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
    Updating git repository `https://github.com/gtk-rs/gtk-rs-core`
    Skipping git submodule `https://github.com/gtk-rs/gir` due to update strategy in .gitmodules
    Skipping git submodule `https://github.com/gtk-rs/gir-files` due to update strategy in .gitmodules
    Updating crates.io index
  Downloaded event-listener v5.2.0
  Downloaded futures-sink v0.3.30
  Downloaded futures v0.3.30
  Downloaded parking v2.2.0
  Downloaded concurrent-queue v2.4.0
  Downloaded num-traits v0.2.18
  Downloaded crossbeam-utils v0.8.19
  Downloaded chrono v0.4.34
  Downloaded iana-time-zone v0.1.60
  Downloaded event-listener-strategy v0.5.0
  Downloaded async-channel v2.2.0
  Downloaded 11 crates (507.1 KB) in 1.07s
   Compiling serde v1.0.197
   Compiling equivalent v1.0.1
   Compiling hashbrown v0.14.3
   Compiling target-lexicon v0.12.14
   Compiling winnow v0.6.5
   Compiling indexmap v2.2.5
   Compiling heck v0.4.1
   Compiling smallvec v1.13.1
   Compiling pkg-config v0.3.30
   Compiling cfg-expr v0.15.7
   Compiling version-compare v0.1.1
   Compiling proc-macro2 v1.0.78
   Compiling autocfg v1.1.0
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.153
   Compiling pin-project-lite v0.2.13
   Compiling winnow v0.5.40
   Compiling quote v1.0.35
   Compiling syn v2.0.52
   Compiling slab v0.4.9
   Compiling futures-core v0.3.30
   Compiling toml_datetime v0.6.5
   Compiling serde_spanned v0.6.5
   Compiling toml_edit v0.22.6
   Compiling futures-sink v0.3.30
   Compiling futures-channel v0.3.30
   Compiling futures-io v0.3.30
   Compiling memchr v2.7.1
   Compiling futures-task v0.3.30
   Compiling pin-utils v0.1.0
   Compiling toml_edit v0.21.1
   Compiling thiserror v1.0.57
   Compiling toml v0.8.10
   Compiling system-deps v6.2.0
   Compiling proc-macro-crate v3.1.0
   Compiling glib-sys v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling gobject-sys v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling gio-sys v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling bitflags v2.4.2
   Compiling gio v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling futures-macro v0.3.30
   Compiling thiserror-impl v1.0.57
   Compiling glib-macros v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling futures-util v0.3.30
   Compiling version_check v0.9.4
   Compiling gdk-pixbuf-sys v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling atk-sys v0.19.0 (/home/abf/Downloads/gtk3-rs-master/atk/sys)
   Compiling cairo-sys-rs v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling pango-sys v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling gdk-sys v0.19.0 (/home/abf/Downloads/gtk3-rs-master/gdk/sys)
   Compiling semver v1.0.22
   Compiling crossbeam-utils v0.8.19
   Compiling futures-executor v0.3.30
   Compiling proc-macro-error-attr v1.0.4
   Compiling syn v1.0.109
   Compiling rustc_version v0.4.0
   Compiling proc-macro-error v1.0.4
   Compiling gtk-sys v0.19.0 (/home/abf/Downloads/gtk3-rs-master/gtk/sys)
   Compiling memoffset v0.9.0
   Compiling concurrent-queue v2.4.0
   Compiling field-offset v0.3.6
   Compiling glib v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling toml_edit v0.19.15
   Compiling num-traits v0.2.18
   Compiling parking v2.2.0
   Compiling once_cell v1.19.0
   Compiling event-listener v5.2.0
   Compiling gtk v0.19.0 (/home/abf/Downloads/gtk3-rs-master/gtk)
   Compiling event-listener-strategy v0.5.0
   Compiling proc-macro-crate v1.3.1
   Compiling iana-time-zone v0.1.60
   Compiling chrono v0.4.34
   Compiling gtk3-macros v0.19.0 (/home/abf/Downloads/gtk3-rs-master/gtk3-macros)
   Compiling async-channel v2.2.0
   Compiling futures v0.3.30
   Compiling cairo-rs v0.20.0 (https://github.com/gtk-rs/gtk-rs-core#8e5054e4)
   Compiling atk v0.19.0 (/home/abf/Downloads/gtk3-rs-master/atk)