-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-collectionsArea: `std::collections`Area: `std::collections`A-iteratorsArea: IteratorsArea: IteratorsC-bugCategory: This is a bug.Category: This is a bug.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.perf-regressionPerformance regression.Performance regression.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Description
Test failure found in the beta crater run:
[INFO] [stdout] thread 'atom::tests::test_possible_states_eq' (22) panicked at src/value.rs:63:18:
[INFO] [stdout] can't compare values String("a") and Number(0)
https://crater-reports.s3.amazonaws.com/beta-1.92-4/beta-2025-11-10/gh/ttaubert.tlc/log.txt
Minimized reproducer:
use std::cmp::Ordering;
use std::collections::BTreeSet;
#[derive(Debug)]
pub(crate) enum Value {
One,
Two(i32),
}
impl Ord for Value {
fn cmp(&self, other: &Value) -> Ordering {
match (self, other) {
(Value::One, Value::One) => Ordering::Equal,
(Value::Two(x), Value::Two(y)) => x.cmp(y),
_ => panic!("can't compare values {:?} and {:?}", self, other),
}
}
}
impl PartialOrd for Value {
fn partial_cmp(&self, other: &Value) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl PartialEq for Value {
fn eq(&self, other: &Value) -> bool {
match (self, other) {
(Value::One, Value::One) => true,
(Value::Two(x), Value::Two(y)) => x == y,
_ => panic!("can't compare values {:?} and {:?}", self, other),
}
}
}
impl Eq for Value {}
fn main() {
let lhs = BTreeSet::from([Value::One]);
let rhs = BTreeSet::from([Value::Two(1), Value::Two(2)]);
let _ = lhs == rhs;
}This code runs without errors on stable, but panics on beta.
It's reasonable to say that this code should have panicked in the first place, but still, it's strange that the behavior changed. So, maybe this needs some investigation on what happened?
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`A-iteratorsArea: IteratorsArea: IteratorsC-bugCategory: This is a bug.Category: This is a bug.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.perf-regressionPerformance regression.Performance regression.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.