Skip to content

nightly rustc breaks stable code for some type inferences #26279

Closed
@bombless

Description

@bombless
use std::ops::Add;
trait Zero: Add<Self, Output=Self> {
    fn zero()->Self;
}

impl Zero for i32 {
    fn zero()->i32 {
        0
    }
}

fn main() {
    let mut x = Vec::<i32>::new();
    x.extend(vec![Zero::zero()].into_iter())
}

nightly (breaking) : http://is.gd/5Pl8DA
stable (compiles) : http://is.gd/ZLTyOv

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-highHigh priorityT-langRelevant to the language team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions