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

fix: fix compile error by low version of backon in old project #2781

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

silver-ymz
Copy link
Member

Update:

  • bump backon to 0.4.1

Xuanwo/backon#54 feature can only be used in 0.4.1. As result, if backon version is 0.4.0, it won't pass compile.

Compiler Output:

error[E0308]: mismatched types
   --> /Volumes/haha/code/project/incubator-opendal/core/src/layers/retry.rs:300:21
    |
300 |               .notify(|err, dur: Duration| {
    |  ______________------_^
    | |              |
    | |              arguments to this method are incorrect
301 | |                 self.notify.intercept(
302 | |                     err,
303 | |                     dur,
...   |
308 | |                 )
309 | |             })
    | |_____________^ expected fn pointer, found closure
    |
    = note: expected fn pointer `for<'a> fn(&'a types::error::Error, std::time::Duration)`
                  found closure `[closure@/Volumes/haha/code/project/incubator-opendal/core/src/layers/retry.rs:300:21: 300:41]`
note: closures can only be coerced to `fn` types if they do not capture any variables
   --> /Volumes/haha/code/project/incubator-opendal/core/src/layers/retry.rs:301:17
    |
301 |                 self.notify.intercept(
    |                 ^^^^ `__self` captured here
...
306 |                         ("path", path),
    |                                  ^^^^ `path` captured here
note: method defined here
   --> /Users/silver/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backon-0.4.0/src/retry.rs:182:12
    |
182 |     pub fn notify(mut self, notify: fn(&E, Duration)) -> Self {
    |            ^^^^^^

For old project without cargo update, this will happen.

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Xuanwo Xuanwo merged commit 2c2dfc8 into main Aug 4, 2023
@Xuanwo Xuanwo deleted the fix/bump-backon branch August 4, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants