Skip to content

Conversation

a-zmuth
Copy link

@a-zmuth a-zmuth commented Sep 29, 2024

Overview

The change specifically addresses a bug fix in the parse_owned function and issues faced while installing the Anchor framework using AVM.

Bug Fix in the parse_owned Function

Problem

The parse_owned function had compilation issues due to improper type handling in collecting format_items, leading to an error related to type conversion.

Error Encountered

A compilation error indicated that OwnedFormatItem could not be created from Box<Vec<_>>.

error[E0282]: type annotations needed for `Box<_>`
  --> C:\Users\Username\.cargo\registry\src\index.crates.io-6f17d22bba15001f\time-0.3.29\src\format_description\parse\mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++

Solution

The issue was fixed by explicitly specifying the type of collected format_items to Box<[format_item::Item<'_>]>, resolving the compilation error and improving type compatibility.

Copy link

codecov bot commented Sep 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.7%. Comparing base (4a74924) to head (2706901).
Report is 44 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #711     +/-   ##
=======================================
- Coverage   97.8%   97.7%   -0.1%     
=======================================
  Files         81      83      +2     
  Lines       9378    8977    -401     
=======================================
- Hits        9169    8770    -399     
+ Misses       209     207      -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dennisorlando
Copy link

Hmm are you sure about the origin of this bug?
The provided logs refers to time version 0.3.29, which I just compiled successfully without reproducing such error.
Do you have a list of steps to reproduce this bug?

@a-zmuth
Copy link
Author

a-zmuth commented Sep 29, 2024

Hmm are you sure about the origin of this bug? The provided logs refers to time version 0.3.29, which I just compiled successfully without reproducing such error. Do you have a list of steps to reproduce this bug?

The error specifically occurs when installing anchor with avm and the error comes from mod.rs in my time directory: I gave more details here: Stackoverflow

To recreate the bug, first instal avm:

cargo install --git https://github.com/coral-xyz/anchor avm --force

After installation, you install anchor with avm:

avm use latest It will give a prompt to download the latest anchor version.

I believe this error only occurs with avm others install directly with cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli. This gives rise to other errors too, but that can be resolved as shown in the StackOverflow link.

Also, check the error from the block of code between line 75-88. It's resolved by removing the ambiguity by specifying the item_type It was exhausting figuring this out.

@jhpratt
Copy link
Member

jhpratt commented Sep 29, 2024

Come on, this is beyond ridiculous. A basic search or even looking at the pinned issues would show you that this was resolved months ago.

@jhpratt jhpratt closed this Sep 29, 2024
@jhpratt jhpratt added the C-invalid Category: no issue exists or the issue cannot be reproduced label Sep 29, 2024
@a-zmuth
Copy link
Author

a-zmuth commented Sep 29, 2024

Come on, this is beyond ridiculous. A basic search or even looking at the pinned issues would show you that this was resolved months ago.

Doesn't seem so, since it keeps coming up.

@jhpratt
Copy link
Member

jhpratt commented Sep 29, 2024

You're using a months-old version of time. No kidding it doesn't seem resolved. Common sense, please.

@a-zmuth
Copy link
Author

a-zmuth commented Sep 29, 2024

You're using a months-old version of time. No kidding it doesn't seem resolved. Common sense, please.

My bad. It appears avm uses that older version as the default.
Appreciate the clarification.

@dennisorlando
Copy link

dennisorlando commented Sep 29, 2024

Come on, this is beyond ridiculous. A basic search or even looking at the pinned issues would show you that this was resolved months ago.

Doesn't seem so, since it keeps coming up.

Perhaps https://github.com/coral-xyz/anchor would be a better place for this issue?
It might be just a "you should update time.rs" problem

EDIT: here's the mentioned issue: #681
you should tell the Anchor folks to update time.rs

@time-rs time-rs locked as resolved and limited conversation to collaborators Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

C-invalid Category: no issue exists or the issue cannot be reproduced

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants