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

client/transport/state.rs: Private types in public interface errors #319

Closed
jpds opened this issue Apr 11, 2024 · 3 comments
Closed

client/transport/state.rs: Private types in public interface errors #319

jpds opened this issue Apr 11, 2024 · 3 comments

Comments

@jpds
Copy link

jpds commented Apr 11, 2024

These appear to have been introduced in #317:

   Compiling opcua v0.13.0 (https://github.com/locka99/opcua.git?branch=master#eab4caab)
error[E0446]: crate-private type `OutgoingMessage` in public interface
  --> /home/user/.cargo/git/checkouts/opcua-49af4c4898b3317f/eab4caa/lib/src/client/transport/state.rs:23:1
   |
23 | pub type RequestSend = tokio::sync::mpsc::Sender<OutgoingMessage>;
   | ^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type
   |
  ::: /home/user/.cargo/git/checkouts/opcua-49af4c4898b3317f/eab4caa/lib/src/client/transport/core.rs:53:1
   |
53 | pub(crate) struct OutgoingMessage {
   | --------------------------------- `OutgoingMessage` declared as crate-private

error[E0446]: restricted type `client::transport::state::Request` in public interface
   --> /home/user/.cargo/git/checkouts/opcua-49af4c4898b3317f/eab4caa/lib/src/client/transport/state.rs:115:5
    |
42  |   pub(super) struct Request {
    |   ------------------------- `client::transport::state::Request` declared as restricted
...
115 | /     pub(crate) fn begin_issue_or_renew_secure_channel(
116 | |         &self,
117 | |         request_type: SecurityTokenRequestType,
118 | |         timeout: Duration,
119 | |         sender: RequestSend,
120 | |     ) -> Request {
    | |________________^ can't leak restricted type

For more information about this error, try `rustc --explain E0446`.
error: could not compile `opcua` (lib) due to 2 previous errors

CC: @einarmo

einarmo added a commit to einarmo/opcua that referenced this issue Apr 11, 2024
I can't actually reproduce this, but the error in the linked issue is
fairly clear, this should fix it.
@einarmo
Copy link
Contributor

einarmo commented Apr 11, 2024

I can't actually reproduce this, what's your rustc version?

That said the error is clear enough: #320

@jpds
Copy link
Author

jpds commented Apr 11, 2024

I got this error with cargo 1.73, but not with 1.75 or 1.76.

MSRV of the crate probably needs updating.

@einarmo
Copy link
Contributor

einarmo commented Apr 11, 2024

Interesting that it is only present in older rustc versions, a false positive maybe? We can just fix it. I'm on a newer rustc, but I'll try using a lower one when developing this project. I haven't been very careful about MSRV.

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

2 participants