Skip to content

Missing sum() and product() for u128/i128 #43235

Closed
@leonardo-m

Description

@leonardo-m
#![feature(i128_type)]
#![allow(unused_variables)]
fn main() {
    let r1: u128 = [10, 20].iter().sum();
    let r2: i128 = [10, 20].iter().sum();
    let r3: u128 = [10, 20].iter().product();
    let r4: i128 = [10, 20].iter().product();
}


error[E0277]: the trait bound `u128: std::iter::Sum<&{integer}>` is not satisfied
 --> ...\test.rs:4:36
  |
4 |     let r1: u128 = [10, 20].iter().sum();
  |                                    ^^^ the trait `std::iter::Sum<&{integer}>` is not implemented for `u128`

error[E0277]: the trait bound `i128: std::iter::Sum<&{integer}>` is not satisfied
 --> ...\test.rs:5:36
  |
5 |     let r2: i128 = [10, 20].iter().sum();
  |                                    ^^^ the trait `std::iter::Sum<&{integer}>` is not implemented for `i128`

error[E0277]: the trait bound `u128: std::iter::Product<&{integer}>` is not satisfied
 --> ...\test.rs:6:36
  |
6 |     let r3: u128 = [10, 20].iter().product();
  |                                    ^^^^^^^ the trait `std::iter::Product<&{integer}>` is not implemented for `u128`

error[E0277]: the trait bound `i128: std::iter::Product<&{integer}>` is not satisfied
 --> ...\test.rs:7:36
  |
7 |     let r4: i128 = [10, 20].iter().product();
  |                                    ^^^^^^^ the trait `std::iter::Product<&{integer}>` is not implemented for `i128`


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions