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

'allocator_api' error has a higher priority than 'unexpected type argument' #80237

Closed
rossmacarthur opened this issue Dec 20, 2020 · 3 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@rossmacarthur
Copy link
Contributor

I tried this code:

fn test() -> Vec<i64, i64> {
    let vals = vec![(1, 2), (3, 4)];
    vals.into_iter().collect()
}

I expected to see this happen:

error[E0107]: wrong number of type arguments: expected 1, found 2
 --> src/main.rs:1:23
  |
1 | fn test() -> Vec<i64, i64> {
  |                       ^^^ unexpected type argument

Instead, this happened:

error[E0658]: use of unstable library feature 'allocator_api'
 --> src/main.rs:1:23
  |
1 | fn test() -> Vec<i64, i64> {
  |                       ^^^
  |
  = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
  = help: add `#![feature(allocator_api)]` to the crate attributes to enable

This was very confusing to me, took me a while to figure out what the real error was.

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (1f5bc176b 2020-12-19)
binary: rustc
commit-hash: 1f5bc176b0e54a8e464704adcd7e571700207fe9
commit-date: 2020-12-19
host: x86_64-apple-darwin
release: 1.50.0-nightly
@rossmacarthur rossmacarthur added the C-bug Category: This is a bug. label Dec 20, 2020
@rossmacarthur
Copy link
Contributor Author

@rustbot modify labels: +A-diagnostics +D-confusing +D-papercut +C-enhancement -C-bug

@rustbot rustbot added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-papercut Diagnostics: An error or lint that needs small tweaks. and removed C-bug Category: This is a bug. labels Dec 20, 2020
@JohnTitor JohnTitor added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 31, 2020
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Dec 11, 2021

#90856 has already solved this problem.

@TaKO8Ki TaKO8Ki closed this as completed Dec 11, 2021
@paulyoung
Copy link

I'm using Rust 1.63.0 (rustc 1.63.0 (4b91a6ea7 2022-08-08)) and just ran into this.

Here's a minimal example:

use std::collections::BTreeSet;

pub type Foo = BTreeSet<String, String>;
error[E0658]: use of unstable library feature 'allocator_api'
  --> crates/<my_crate>/src/main.rs:3:33
  |
3 | pub type Foo = BTreeSet<String, String>;
  |                                 ^^^^^^
  |
   = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information

For more information about this error, try `rustc --explain E0658`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants