Skip to content

Transitioning a 3rd party crate (conrod) to 2018 edition #56029

Closed
@ghost

Description

Hello!

I am trying to migrate https://github.com/PistonDevelopers/conrod to 2018 edition.

https://rust-lang-nursery.github.io/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html states that:

It's our intention that the migration to new editions is as smooth an experience as possible. If it's difficult for you to upgrade to Rust 2018, we consider that a bug. If you run into problems with this process, please file a bug. Thank you!

So, here I am, although this may very well be a layer 8 problem.

What I did: I checked out conrod and first migrated conrod_derive via

cargo fix --edition

But it turned out to be quite tedious until I found out about:

cargo fix --prepare-for 2018 (any reason this is not more prominently mentioned in the guide?)

Then all the low hanging fruits were done automagically - great! (My compliments/gratitude here!)

I then proceeded enabling edition = 2018 in the Cargo.toml file and then the nightmare started:

error[E0412]: cannot find type Theme in the crate root
--> src/widget/toggle.rs:38:50
|
38 | #[derive(Copy, Clone, Debug, Default, PartialEq, WidgetStyle_)]
| ^^^^^^^^^^^^ not found in the crate root
help: possible candidate is found in another module, you can import it into scope
|
3 | use crate::theme::Theme;

Appears a few dozen times for different files! (and if it's not WidgetStyle_ then it's the WidgetCommon_ macro)

use crate::theme::Theme; does not help at all, sadly.

When I try to use use conrod_derive::WidgetStyle_ nothing changes.

When I use: use conrod_derive::style::WidgetStyle_; I get a lot more errors, now saying:

error[E0658]: The attribute conrod is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> src/widget/toggle.rs:49:5
|
49 | #[conrod(default = "theme.border_color")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

if I follow that hint, I get the same errors as before adding the crate attribute with the addition of

error[E0432]: unresolved import conrod_derive::style
--> src/widget/toggle.rs:18:20
|
18 | use conrod_derive::style::WidgetStyle_;
| ^^^^^ Could not find style in conrod_derive

because style is not public... but I made it public already and the same error is still present.

Here is where I give up and let someone smarter than me point me in the right direction, because obviously I am doing something wrong.

Sorry for bothering the bugtracker with what is probably my fault and mine alone, but it was suggested and I am kind of desperate to understand this now (how else can I improve?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions