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

Stash WIP of future potential use of #[diagnostic::on_unimplemented] #1420

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

clux
Copy link
Member

@clux clux commented Mar 10, 2024

Quick test of rust-lang/rust#119888 playground using

cargo +nightly run --example dynamic_watcher

Stashing this here for my own memory.
Currently does not seem to be super helpful as it doesn't give me the warning via a trait bound:

error[E0599]: the function or associated item `all_with` exists for struct `Api<MyStruct>`, but its trait bounds were not satisfied
   --> examples/dynamic_watcher.rs:33:32
    |
12  | struct MyStruct {}
    | --------------- doesn't satisfy `MyStruct: Resource`
...
33  |     let api = Api::<MyStruct>::all_with(client, &ar);
    |                                ^^^^^^^^ function or associated item cannot be called on `Api<MyStruct>` due to unsatisfied trait bounds
    |
note: if you're trying to build a new `kube::Api<MyStruct>` consider using one of the following associated functions:
      kube::Api::<K>::all_with
      kube::Api::<K>::namespaced_with
      kube::Api::<K>::default_namespaced_with
      kube::Api::<K>::all
      and 2 others
   --> /home/clux/kube/kube/kube-client/src/api/mod.rs:78:5
    |
78  |       pub fn all_with(client: Client, dyntype: &K::DynamicType) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
91  | /     pub fn namespaced_with(client: Client, ns: &str, dyntype: &K::DynamicType) -> Self
92  | |     where
93  | |         K: Resource<Scope = DynamicResourceScope>,
    | |__________________________________________________^
...
112 | /     pub fn default_namespaced_with(client: Client, dyntype: &K::DynamicType) -> Self
113 | |     where
114 | |         K: Resource<Scope = DynamicResourceScope>,
    | |__________________________________________________^
...
162 |       pub fn all(client: Client) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: the following trait bounds were not satisfied:
            `MyStruct: Resource`
note: the trait `Resource` must be implemented
   --> /home/clux/kube/kube/kube-core/src/resource.rs:33:1
    |
33  | pub trait Resource {
    | ^^^

Signed-off-by: clux <sszynrae@gmail.com>
@clux clux changed the title Stash WIP of future potential use of #[diagnostic] Stash WIP of future potential use of #[diagnostic::on_unimplemented] Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant