Skip to content

Possible regression: Updating 2.8.0 to 2.9.0 causes "type annotations needed" for BTreeSet::range etc. #105

@TonalidadeHidrica

Description

@TonalidadeHidrica

See the following code:

use std::collections::BTreeSet;
use ordered_float::NotNan;

fn main() {
    let a = BTreeSet::<NotNan<f64>>::new();
    let b = a.range(..);
}

In 2.8.0, this code compiles. In 2.9.0 and 2.10.0, it causes the following error:

image

Copyable text
error[E0283]: type annotations needed
 --> src/main.rs:6:15
  |
6 |     let b = a.range(..);
  |               ^^^^^ cannot infer type for type parameter `K` declared on the associated function `range`
  |
  = note: cannot satisfy `_: Ord`

I cannot figure out at all why this error happens, but this is indeed a regression.

$ rustc --version
rustc 1.57.0 (f1edd0429 2021-11-29)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions