Skip to content

Tracking Issue for comparing values in const items #92391

Closed
@fee1-dead

Description

@fee1-dead

Feature gate: #![feature(const_cmp)]

This is a tracking issue for various const PartialEq, PartialOrd, Ord impls in the standard library

Public API

// core::cmp

impl<T: ~const PartialOrd> const PartialOrd for Reverse<T> {}
impl const Ord for Ordering {}
impl const PartialOrd for Ordering {}
impl const PartialEq for Ordering {}
pub const fn min<T: ~const Ord + ~const Drop>(v1: T, v2: T) -> T;
pub const fn max<T: ~const Ord + ~const Drop>(v1: T, v2: T) -> T;
impl const PartialEq for {bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 () !}
impl const PartialOrd for {bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 () !}
impl const Ord for {bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 () !}


pub const fn min_by<T, F: ~const FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T
where
    T: ~const Destruct,
    F: ~const Destruct;

pub const fn min_by_key<T, F: ~const FnMut(&T) -> K, K: ~const Ord>(v1: T, v2: T, mut f: F) -> T
where
    T: ~const Destruct,
    F: ~const Destruct,
    K: ~const Destruct;

pub const fn max_by<T, F: ~const FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T
where
    T: ~const Destruct,
    F: ~const Destruct;

pub const fn max_by_key<T, F: ~const FnMut(&T) -> K, K: ~const Ord>(v1: T, v2: T, mut f: F) -> T
where
    T: ~const Destruct,
    F: ~const Destruct,
    K: ~const Destruct;

Steps / History

Unresolved Questions

  • None yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions