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

Default trait is not implemented for rodeo with spur types other than Spur #26

Open
lo48576 opened this issue May 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@lo48576
Copy link

lo48576 commented May 8, 2021

I tried this code

#[derive(Default)]
struct Foo {
    strings: Rodeo<lasso::MiniSpur>,
}

I expected this to happen

The code compiles.

Instead this happened

This does not compile.
Compiler says error[E0277]: the trait bound `lasso::Rodeo<lasso::MiniSpur>: std::default::Default` is not satisfied.

Meta

Lasso version: 0.5.0

Rustc version: 1.52.0

> rustc -Vv
rustc 1.52.0 (88f19c6da 2021-05-03)
binary: rustc
commit-hash: 88f19c6dab716c6281af7602e30f413e809c5974
commit-date: 2021-05-03
host: x86_64-unknown-linux-gnu
release: 1.52.0
LLVM version: 12.0.0

Additional context

impl Default for Rodeo<Spur, RandomState> redirects to Self::new(), and Self::new() is implemented for any Rodeo<K, RandomState> where K: Key.
Is there any reason not to implement impl<K: Key> Default for Rodeo<K, RandomState>?

@lo48576 lo48576 added the bug Something isn't working label May 8, 2021
@Kixiron
Copy link
Owner

Kixiron commented May 8, 2021

That's a good question, thanks! Originally the concrete types for Default were made with the idea that "Spur is the default type, so that's what Default should make", but I think I just forgot to update the definition of Default when I messed with new(). It still does have the downside that it no longer allows Rodeo::default() to "just work" due to inference, but that probably doesn't matter very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants