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

cargo build fails with E0107 #15

Closed
p-alik opened this issue Feb 11, 2023 · 3 comments
Closed

cargo build fails with E0107 #15

p-alik opened this issue Feb 11, 2023 · 3 comments

Comments

@p-alik
Copy link

p-alik commented Feb 11, 2023

We've face the issue for the first in the CI yesterday

20:38 $ rustc --version 
rustc 1.67.0 (fc594f156 2023-01-24)
20:38 $ git clone [email protected]:arcnmx/qapi-rs.git
20:38 $ cd qapi-rs/
Cloning into 'qapi-rs'...
remote: Enumerating objects: 5257, done.
remote: Counting objects: 100% (460/460), done.
remote: Compressing objects: 100% (206/206), done.
remote: Total 5257 (delta 188), reused 446 (delta 178), pack-reused 4797
Receiving objects: 100% (5257/5257), 2.58 MiB | 1.26 MiB/s, done.
Resolving deltas: 100% (4185/4185), done.
20:43 $ git submodule update --init --force --remote
Submodule 'schema' (https://github.com/arcnmx/qemu-qapi-filtered.git) registered for path 'schema'
Cloning into '/tmp/qapi-rs/schema'...
Submodule path 'schema': checked out '2b5045f111d3a208bc841ce80c72c5fbdbc4fa2e'
20:44 $ cargo build 
   Compiling proc-macro2 v1.0.51
   Compiling unicode-ident v1.0.6
   Compiling quote v1.0.23
   Compiling syn v1.0.107
   Compiling serde_derive v1.0.152
   Compiling serde v1.0.152
   Compiling serde_json v1.0.93
   Compiling libc v0.2.139
   Compiling autocfg v1.1.0
   Compiling memchr v2.5.0
   Compiling itoa v1.0.5
   Compiling ryu v1.0.12
   Compiling futures-core v0.3.26
   Compiling cfg-if v1.0.0
   Compiling pin-project-lite v0.2.9
   Compiling log v0.4.17
   Compiling futures-task v0.3.26
   Compiling futures-channel v0.3.26
   Compiling futures-sink v0.3.26
   Compiling io-lifetimes v1.0.5
   Compiling futures-util v0.3.26
   Compiling slab v0.4.7
   Compiling tokio v1.25.0
   Compiling base64 v0.21.0
   Compiling pin-utils v0.1.0
   Compiling rustix v0.36.8
   Compiling futures-io v0.3.26
   Compiling once_cell v1.17.0
   Compiling linux-raw-sys v0.1.4
   Compiling bytes v1.4.0
   Compiling tracing-core v0.1.30
   Compiling bitflags v1.3.2
   Compiling aho-corasick v0.7.20
   Compiling regex-syntax v0.6.28
   Compiling termcolor v1.2.0
   Compiling humantime v2.1.0
   Compiling tracing v0.1.37
   Compiling socket2 v0.4.7
   Compiling mio v0.8.5
   Compiling num_cpus v1.15.0
   Compiling regex v1.7.1
   Compiling is-terminal v0.4.3
   Compiling env_logger v0.10.0
   Compiling futures-macro v0.3.26
   Compiling tokio-macros v1.8.2
   Compiling futures-executor v0.3.26
   Compiling futures v0.3.26
   Compiling tokio-util v0.7.6
   Compiling qapi-parser v0.9.1 (/tmp/qapi-rs/parser)
   Compiling qapi-spec v0.3.1 (/tmp/qapi-rs/spec)
   Compiling qapi-codegen v0.10.2 (/tmp/qapi-rs/codegen)
   Compiling qapi-qmp v0.11.0 (/tmp/qapi-rs/qmp)
   Compiling qapi-qga v0.10.1 (/tmp/qapi-rs/qga)
   Compiling qapi v0.11.0 (/tmp/qapi-rs/qapi)
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
   --> qapi/src/futures/tokio.rs:175:57
    |
175 |         let mut lines = Framed::from_parts(FramedParts::new::<()>(read, JsonLinesCodec::<QapiCapabilities>::new()));
    |                                                         ^^^------ help: remove these generics
    |                                                         |
    |                                                         expected 0 generic arguments
    |
note: associated function defined here, with 0 generic parameters
   --> /home/apastuchov/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.7.6/src/codec/framed.rs:371:12
    |
371 |     pub fn new(io: T, codec: U) -> FramedParts<T, U> {
    |            ^^^

error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
   --> qapi/src/futures/tokio.rs:182:37
    |
182 |         let mut read = FramedParts::new::<()>(lines.io, JsonLinesCodec::new());
    |                                     ^^^------ help: remove these generics
    |                                     |
    |                                     expected 0 generic arguments
    |
note: associated function defined here, with 0 generic parameters
   --> /home/apastuchov/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.7.6/src/codec/framed.rs:371:12
    |
371 |     pub fn new(io: T, codec: U) -> FramedParts<T, U> {
    |            ^^^

error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
   --> qapi/src/futures/tokio.rs:26:53
    |
26  |             stream: Framed::from_parts(FramedParts::new::<()>(stream, JsonLinesCodec::new())),
    |                                                     ^^^------ help: remove these generics
    |                                                     |
    |                                                     expected 0 generic arguments
    |
note: associated function defined here, with 0 generic parameters
   --> /home/apastuchov/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.7.6/src/codec/framed.rs:371:12
    |
371 |     pub fn new(io: T, codec: U) -> FramedParts<T, U> {
    |            ^^^

error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
   --> qapi/src/futures/tokio.rs:166:53
    |
166 |             stream: Framed::from_parts(FramedParts::new::<()>(stream, JsonLinesCodec::<QmpMessageAny>::new())),
    |                                                     ^^^------ help: remove these generics
    |                                                     |
    |                                                     expected 0 generic arguments
    |
note: associated function defined here, with 0 generic parameters
   --> /home/apastuchov/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.7.6/src/codec/framed.rs:371:12
    |
371 |     pub fn new(io: T, codec: U) -> FramedParts<T, U> {
    |            ^^^

For more information about this error, try `rustc --explain E0107`.
error: could not compile `qapi` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

That patch solves the issue

21:34 $ git diff qapi/src/futures/tokio.rs
diff --git a/qapi/src/futures/tokio.rs b/qapi/src/futures/tokio.rs
index cac5e0d..06d322f 100644
--- a/qapi/src/futures/tokio.rs
+++ b/qapi/src/futures/tokio.rs
@@ -23,7 +23,7 @@ pub struct QgaStreamTokio<S> {
 impl<S> QgaStreamTokio<S> {
     fn new(stream: S) -> Self {
         Self {
-            stream: Framed::from_parts(FramedParts::new::<()>(stream, JsonLinesCodec::new())),
+            stream: Framed::from_parts(FramedParts::new::<>(stream, JsonLinesCodec::new())),
         }
     }
 
@@ -163,7 +163,7 @@ impl<S: AsyncWrite, C: QmpCommand, I: serde::Serialize> Sink<Execute<C, I>> for
 impl<S> QmpStreamTokio<S> {
     pub fn new(stream: S) -> Self {
         Self {
-            stream: Framed::from_parts(FramedParts::new::<()>(stream, JsonLinesCodec::<QmpMessageAny>::new())),
+            stream: Framed::from_parts(FramedParts::new::<>(stream, JsonLinesCodec::<QmpMessageAny>::new())),
         }
     }
 
@@ -172,14 +172,14 @@ impl<S> QmpStreamTokio<S> {
     {
         use futures::StreamExt;
 
-        let mut lines = Framed::from_parts(FramedParts::new::<()>(read, JsonLinesCodec::<QapiCapabilities>::new()));
+        let mut lines = Framed::from_parts(FramedParts::new::<>(read, JsonLinesCodec::<QapiCapabilities>::new()));
 
         let capabilities = lines.next().await.ok_or_else(||
             io::Error::new(io::ErrorKind::UnexpectedEof, "QMP greeting expected")
         )??;
 
         let lines = lines.into_parts();
-        let mut read = FramedParts::new::<()>(lines.io, JsonLinesCodec::new());
+        let mut read = FramedParts::new::<>(lines.io, JsonLinesCodec::new());
         read.read_buf = lines.read_buf;
         let stream = Framed::from_parts(read);
@arcnmx
Copy link
Owner

arcnmx commented Feb 11, 2023

This is a regression caused by tokio-util, which will be fixed in its next release. In the meantime, you can cargo update -p tokio-util --precise 0.7.4 to avoid updating past the broken version (a version spec of tokio-util = "<0.7.5" in your Cargo.toml might also work if you don't have control over Cargo.lock)

@p-alik
Copy link
Author

p-alik commented Feb 12, 2023

Thank for your quick replay. We could resolve the issue.

@arcnmx
Copy link
Owner

arcnmx commented Feb 14, 2023

tokio-util 0.7.7 has been released, so you can just cargo update to fix the issue!

@arcnmx arcnmx closed this as completed Feb 14, 2023
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