Skip to content

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

Merged
Xuanwo merged 1 commit intomainfrom
fix/bump-backon
Aug 4, 2023
Merged

fix: fix compile error by low version of backon in old project#2781
Xuanwo merged 1 commit intomainfrom
fix/bump-backon

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.

Signed-off-by: silver-ymz <yinmingzhuo@gmail.com>
@silver-ymz silver-ymz requested a review from Xuanwo as a code owner August 4, 2023 13:55
@github-actions github-actions bot added the releases-note/fix The PR fixes a bug or has a title that begins with "fix" label Aug 4, 2023
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

Labels

releases-note/fix The PR fixes a bug or has a title that begins with "fix"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants