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

Not possible to name a property "error" #1067

Closed
A6GibKm opened this issue Mar 24, 2023 · 0 comments · Fixed by #1077
Closed

Not possible to name a property "error" #1067

A6GibKm opened this issue Mar 24, 2023 · 0 comments · Fixed by #1077

Comments

@A6GibKm
Copy link
Contributor

A6GibKm commented Mar 24, 2023

The following code does not compile

use glib::Properties;
use std::cell::Cell;

mod imp {
    use super::*;

    #[derive(Debug, Default, Properties)]
    #[properties(wrapper_type = super::Test)]
    pub struct Test {
        #[property(get, set)]
        error: Cell<i32>,
    }

    #[glib::object_subclass]
    impl ObjectSubclass for Test {
        const NAME: &'static str = "Test";
        type Type = super::Test;
        type ParentType = glib::Object;
    }

    impl ObjectImpl for Test {
        fn properties() -> &'static [glib::ParamSpec] {
            Self::derived_properties()
        }

        fn property(&self, id: usize, pspec: &glib::ParamSpec) -> glib::Value {
            Self::derived_property(self, id, pspec)
        }

        fn set_property(&self, id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
            Self::derived_set_property(self, id, value, pspec)
        }
    }
}

glib::wrapper! {
    pub struct Test(ObjectSubclass<imp::Test>);
}

with error

error: ambiguous associated item
   --> src/torrent_model.rs:139:30
    |
139 |     #[derive(Debug, Default, Properties)]
    |                              ^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644>
note: `Error` could refer to the variant defined here
   --> src/torrent_model.rs:139:30
    |
139 |     #[derive(Debug, Default, Properties)]
    |                              ^^^^^^^^^^
note: `Error` could also refer to the associated type defined here
   --> /var/home/deathwish/.local/share/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/convert/mod.rs:648:5
    |
648 |     type Error;
    |     ^^^^^^^^^^
    = note: `#[deny(ambiguous_associated_items)]` on by default
    = note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `transmission-gobject` due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants