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

Mismatch Type Between Time and Chrono #294

Closed
NothinRandom opened this issue Oct 10, 2023 · 8 comments
Closed

Mismatch Type Between Time and Chrono #294

NothinRandom opened this issue Oct 10, 2023 · 8 comments

Comments

@NothinRandom
Copy link

elapsed >= sampling_interval

Hello,

Sorry if this is a silly question, but I'm getting error, and I'm not sure why it's happening. Currently running cargo 1.73.0:

   Compiling opcua v0.11.0
error[E0308]: mismatched types
   --> /home/test/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opcua-0.11.0/src/server/subscriptions/monitored_item.rs:263:28
    |
263 |                 elapsed >= sampling_interval
    |                 -------    ^^^^^^^^^^^^^^^^^ expected `chrono::Duration`, found `time::Duration`
    |                 |
    |                 expected because this is `chrono::Duration`
    |
    = note: `time::Duration` and `chrono::Duration` have similar names, but are actually distinct types
note: `time::Duration` is defined in crate `time`

error[E0308]: mismatched types
   --> /home/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opcua-0.11.0/src/server/subscriptions/subscription.rs:410:23
    |
410 |         if elapsed >= publishing_interval {
    |            -------    ^^^^^^^^^^^^^^^^^^^ expected `chrono::Duration`, found `time::Duration`
    |            |
    |            expected because this is `chrono::Duration`
    |
    = note: `time::Duration` and `chrono::Duration` have similar names, but are actually distinct types
note: `time::Duration` is defined in crate `time`

rror[E0308]: mismatched types
   --> /home/test/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opcua-0.11.0/src/server/subscriptions/subscriptions.rs:321:63
    |
321 |             if now.signed_duration_since(request_timestamp) > publish_request_timeout {
    |                --------------------------------------------   ^^^^^^^^^^^^^^^^^^^^^^^ expected `chrono::Duration`, found `time::Duration`
    |                |
    |                expected because this is `chrono::Duration`
    |
    = note: `time::Duration` and `chrono::Duration` have similar names, but are actually distinct types
@Simontaga
Copy link

I got around it by targeting the repo when including the dependency.

The latest version (v0.12.0) does not seem to be pushed to crates.io

[dependencies]
opcua = { git = "https://github.com/locka99/opcua.git", branch = "master", features = ["console-logging", "server"] }

@NothinRandom
Copy link
Author

I manually went into registry and changed time to chrono and fixed that just to be sure. I guess strict check is getting more strict with each revision. Anyway, pulling directly from repo since v12 doesn't exists in crates yet seems to fix the issue. Hopefully, it will appear on there soon. Now off to other mismatch types to fix... le sigh.

@theodoreOnzGit
Copy link

Facing the same issue but the fix seems to work when pulling a bleeding edge version of opcua. Simontaga's solution works. Hope the new opc-ua version is put on crates io soon

diconico07 added a commit to diconico07/akri that referenced this issue Oct 18, 2023
Opcua crate patch update required because of
[opcua#294](locka99/opcua#294)

h2 patch needed because of the bad/missing Authority header, using
upstream PR branch for this
[h2#612](hyperium/h2#612)

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
diconico07 added a commit to diconico07/akri that referenced this issue Oct 18, 2023
Opcua crate patch update required because of
[opcua#294](locka99/opcua#294)

h2 patch needed because of the bad/missing Authority header, using
upstream PR branch for this
[h2#612](hyperium/h2#612)

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
@NothinRandom
Copy link
Author

@locka99 Thank you for your amazing contribution on this repo!

Is there any chance you could push v0.12.0 to crates to resolve some of these annoying issues? It looks like the build tool that I'm using enforces a specific version, so pulling from git solves the mismatched types errors, but ultimately fails the build process.

diconico07 added a commit to diconico07/akri that referenced this issue Oct 23, 2023
Opcua crate patch update required because of
[opcua#294](locka99/opcua#294)

h2 patch needed because of the bad/missing Authority header, using
upstream PR branch for this
[h2#612](hyperium/h2#612)

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
@NothinRandom
Copy link
Author

@diconico07 thanks for the info! Unfortunately, the internal build system that I'm dealing with is still throwing an error for not having being able to identify v0.12.0 in crates.

diconico07 added a commit to diconico07/akri that referenced this issue Nov 16, 2023
Opcua crate patch update required because of
[opcua#294](locka99/opcua#294)

h2 patch needed because of the bad/missing Authority header, using
upstream PR branch for this
[h2#612](hyperium/h2#612)

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
diconico07 added a commit to diconico07/akri that referenced this issue Nov 17, 2023
Opcua crate patch update required because of
[opcua#294](locka99/opcua#294)

h2 patch needed because of the bad/missing Authority header, using
upstream PR branch for this
[h2#612](hyperium/h2#612)

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
diconico07 added a commit to project-akri/akri that referenced this issue Jan 23, 2024
* Use upstream version of h2

Go back to upstream h2 version as the go-grpc bug is long solved

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* webhook: Upgrade actix

Upgrade actix, actix-web and actix-rt to latest,
This solves the following audit issues:
 - RUSTSEC-2020-0016
 - RUSTSEC-2020-0056
 - RUSTSEC-2021-0124
 - RUSTSEC-2023-0034

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Update all dependencies

Opcua crate patch update required because of
[opcua#294](locka99/opcua#294)

h2 patch needed because of the bad/missing Authority header, using
upstream PR branch for this
[h2#612](hyperium/h2#612)

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Upgrade to 2021 edition

This is needed to be able to upgrade prost dependency

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Update to rust 1.73.0

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Fix clippy errors/warning with new rust version and edition

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Update tonic and prost

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Change uri used for patched h2

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Update patch version

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Remove patch for opcua as upstream made release

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

* Also upgrade mockall

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>

---------

Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@AiyionPrime
Copy link
Contributor

The version has been published to crates.io 7 months ago:
https://crates.io/crates/opcua/0.12.0

@NothinRandom has your problem been resolved with the release of 0.12.0?

@NothinRandom
Copy link
Author

@ AiyionPrime, Yes. Sorry, forgot to close this.

@AiyionPrime
Copy link
Contributor

Thank you!

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

No branches or pull requests

4 participants