When I run cargo update it updates the async-trait version to 0.1.46 and cargo clippy reports errors
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
--> src/lib.rs:2:12
|
2 | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
error[E0308]: mismatched types
--> src/client/filesystem.rs:2004:26
|
229 | type DirEntryPlusStream = impl Stream<Item = Result<DirectoryEntryPlus>> + Send;
| ----------------------------------------------------- the expected opaque type
...
1971 | let entries = dir_entries.into_iter().filter_map(move |dir_entry| {
| ______________________________________________________________-
1972 | | let attr = if let Some(attr) = dir_entry.attr {
1973 | | attr
1974 | | } else {
... |
2000 | | })
2001 | | });
| |_____________- the found closure
...
2004 | entries: stream::iter(entries).map(Ok),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found struct `futures_util::stream::Map`
|
= note: expected opaque type `impl std::marker::Send+tokio_stream::Stream`
found struct `futures_util::stream::Map<futures_util::stream::Iter<std::iter::FilterMap<std::vec::IntoIter<pb::read_dir_response::DirEntry>, [closure@src/client/filesystem.rs:1971:62: 2001:14]>>, fn(fuse3::path::reply::DirectoryEntryPlus) -> std::result::Result<fuse3::path::reply::DirectoryEntryPlus, _> {std::result::Result::<fuse3::path::reply::DirectoryEntryPlus, _>::Ok}>`
error[E0698]: type inside `async` block must be known in this context
--> src/client/filesystem.rs:1916:18
|
1916 | for _ in 0..3 {
| ^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/client/filesystem.rs:1948:25
|
1948 | time::sleep(Duration::from_secs(1)).await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0698]: type inside `async` block must be known in this context
--> src/client/filesystem.rs:1916:21
|
1916 | for _ in 0..3 {
| ^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/client/filesystem.rs:1948:25
|
1948 | time::sleep(Duration::from_secs(1)).await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0698]: type inside `async` block must be known in this context
--> src/client/filesystem.rs:1916:18
|
1916 | for _ in 0..3 {
| ^^^^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/client/filesystem.rs:1948:25
|
1948 | time::sleep(Duration::from_secs(1)).await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0698]: type inside `async` block must be known in this context
--> src/client/filesystem.rs:1916:18
|
1916 | for _ in 0..3 {
| ^^^^ cannot infer type for type `{integer}`
|
note: the type is part of the `async` block because of this `await`
--> src/client/filesystem.rs:1948:25
|
1948 | time::sleep(Duration::from_secs(1)).await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: could not find defining uses
--> src/client/filesystem.rs:229:31
|
229 | type DirEntryPlusStream = impl Stream<Item = Result<DirectoryEntryPlus>> + Send;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors; 1 warning emitted
Some errors have detailed explanations: E0308, E0698.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `rfs`
To learn more, run the command again with --verbose.
I think the important point is the mismatched types
When I downgrade async-trait to 0.1.42, cargo clippy doesn't report errors.
Compiling rfs v0.4.0 (/home/sherlock/git/rfs)
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
--> src/lib.rs:2:12
|
2 | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
warning: this function has too many arguments (9/7)
--> src/client/filesystem.rs:1447:5
|
1447 | / async fn getlk(
1448 | | &self,
1449 | | _req: Request,
1450 | | _path: Option<&OsStr>,
... |
1456 | | pid: u32,
1457 | | ) -> Result<ReplyLock> {
| |__________________________^
|
= note: `#[warn(clippy::too_many_arguments)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
warning: this function has too many arguments (10/7)
--> src/client/filesystem.rs:1542:5
|
1542 | / async fn setlk(
1543 | | &self,
1544 | | req: Request,
1545 | | _path: Option<&OsStr>,
... |
1552 | | block: bool,
1553 | | ) -> Result<()> {
| |___________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
warning: this function has too many arguments (10/7)
--> src/client/filesystem.rs:2033:5
|
2033 | / async fn copy_file_range(
2034 | | &self,
2035 | | _req: Request,
2036 | | _from_path: Option<&OsStr>,
... |
2043 | | flags: u64,
2044 | | ) -> Result<ReplyCopyFileRange> {
| |___________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
warning: manual implementation of `Option::map`
--> src/server/rpc/server.rs:774:20
|
774 | atime: if let Some(atime) = attr.access_time {
| ____________________^
775 | | Some(convert_proto_time_to_system_time(Some(atime)))
776 | | } else {
777 | | None
778 | | },
| |_____________^ help: try this: `attr.access_time.map(|atime| convert_proto_time_to_system_time(Some(atime)))`
|
= note: `#[warn(clippy::manual_map)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
warning: manual implementation of `Option::map`
--> src/server/rpc/server.rs:779:20
|
779 | mtime: if let Some(mtime) = attr.modify_time {
| ____________________^
780 | | Some(convert_proto_time_to_system_time(Some(mtime)))
781 | | } else {
782 | | None
783 | | },
| |_____________^ help: try this: `attr.modify_time.map(|mtime| convert_proto_time_to_system_time(Some(mtime)))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
warning: manual implementation of `Option::map`
--> src/server/rpc/server.rs:784:20
|
784 | ctime: if let Some(ctime) = attr.change_time {
| ____________________^
785 | | Some(convert_proto_time_to_system_time(Some(ctime)))
786 | | } else {
787 | | None
788 | | },
| |_____________^ help: try this: `attr.change_time.map(|ctime| convert_proto_time_to_system_time(Some(ctime)))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
warning: 7 warnings emitted
Finished dev [unoptimized + debuginfo] target(s) in 1.77s
I try to write the smallest reproduction codes but failed :(
my project https://github.com/Sherlock-Holo/rfs/tree/new-fuse use your
async-trait
to create a trait with async fn, but today some problems happened.When I run
cargo update
it updates theasync-trait
version to 0.1.46 andcargo clippy
reports errorsI think the important point is the
mismatched types
When I downgrade
async-trait
to 0.1.42,cargo clippy
doesn't report errors.I try to write the smallest reproduction codes but failed :(
Could you tell me how to fix this problem?