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

Running cargo test fails #1109

Closed
kdheepak opened this issue May 14, 2024 · 6 comments · Fixed by #1117
Closed

Running cargo test fails #1109

kdheepak opened this issue May 14, 2024 · 6 comments · Fixed by #1117
Labels
enhancement New feature or request

Comments

@kdheepak
Copy link
Collaborator

Problem

Running cargo test fails:

error[E0405]: cannot find trait `WidgetRef` in this scope
   --> src/widgets.rs:271:6
    |
24  | impl WidgetRef for Farewell {
    |      ^^^^^^^^^ help: a trait with a similar name exists: `Widget`
    |
...
error[E0405]: cannot find trait `WidgetRef` in this scope
   --> src/widgets.rs:293:26
    |
46  | let widgets: Vec<Box<dyn WidgetRef>> = vec![Box::new(greeting), Box::new(farewell)];
    |                          ^^^^^^^^^ help: a trait with a similar name exists: `Widget`
    |
...
etc

These are the tests that fail:

Couldn't compile the test.

failures:
    src/terminal/frame.rs - terminal::frame::Frame<'_>::render_stateful_widget_ref (line 140)
    src/terminal/frame.rs - terminal::frame::Frame<'_>::render_widget_ref (line 85)
    src/widgets.rs - widgets::Option<W> (line 323)
    src/widgets.rs - widgets::StatefulWidgetRef (line 370)
    src/widgets.rs - widgets::WidgetRef (line 250)

test result: FAILED. 309 passed; 5 failed; 8 ignored; 0 measured; 0 filtered out; finished in 31.93s

I'm assuming that these need to be feature gated differently?

@kdheepak kdheepak added the enhancement New feature or request label May 14, 2024
@TadoTheMiner
Copy link
Contributor

Paradoxically cargo make test works

@kdheepak
Copy link
Collaborator Author

I believe that is because --features=all-widgets is included in that command.

@TadoTheMiner
Copy link
Contributor

So they should have #[cfg(feature = "all-widgets")] on them.

@kdheepak
Copy link
Collaborator Author

My bad, it's not all-widgets, it's either unstable-widget-ref or unstable.

@TadoTheMiner
Copy link
Contributor

Well the problem is that we can't add #[cfg(feature = "unstrable-widget-ref")] to the impl
because it would break code not using the feature. It could be in fututre realease as a breaking change

@joshka
Copy link
Member

joshka commented May 19, 2024

Well the problem is that we can't add #[cfg(feature = "unstrable-widget-ref")] to the impl because it would break code not using the feature. It could be in fututre realease as a breaking change

You can however add this to the top of the doc tests which break. See #1117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants