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

confusing diagnostic about allocator_api feature #82452

Closed
matthiaskrgr opened this issue Feb 23, 2021 · 2 comments
Closed

confusing diagnostic about allocator_api feature #82452

matthiaskrgr opened this issue Feb 23, 2021 · 2 comments
Labels
A-allocators Area: Custom and system allocators A-collections Area: `std::collection` A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@matthiaskrgr
Copy link
Member

struct Stats {
    list: Vec<String, String>,
}

The Strings were supposed to be inside a tuple,

struct Stats {
    list: Vec<(String, String)>,
}

but instead of a some kind of a mismatched argument number message, I got a warning about allocator_api 😅


  Compiling playground v0.0.1 (/playground)
error[E0658]: use of unstable library feature 'allocator_api'
 --> src/lib.rs:2:23
  |
2 |     list: Vec<String, String>,
  |                       ^^^^^^
  |
  = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
@jyn514
Copy link
Member

jyn514 commented Feb 23, 2021

Hmm, I'm not sure how the compiler could improve here - it's correct, Vec has two type parameters, one of which defaults to the global allocator: https://doc.rust-lang.org/stable/src/alloc/vec.rs.html#301-304.

@jyn514 jyn514 added A-allocators Area: Custom and system allocators A-collections Area: `std::collection` A-diagnostics Area: Messages for errors, warnings, and lints labels Feb 23, 2021
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Dec 11, 2021

#90856 has already solved this problem.

@TaKO8Ki TaKO8Ki closed this as completed Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-allocators Area: Custom and system allocators A-collections Area: `std::collection` A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants