Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function specialization #290

Closed
rust-highfive opened this issue Sep 24, 2014 · 1 comment
Closed

Function specialization #290

rust-highfive opened this issue Sep 24, 2014 · 1 comment

Comments

@rust-highfive
Copy link

Issue by jensnockert
Tuesday Jun 11, 2013 at 13:58 GMT

For earlier discussion, see rust-lang/rust#7059

This issue was labelled with: B-RFC in the Rust repository


Code like this should work, preferably picking the most specialized function (and/or just picking a random one, or the first that matches &c. or just throw a warning)

pub fn abs<T: Signed>(value: T) -> T { value.abs() }
pub fn abs<T: Ord + Zero + Neg<T>>(v: T) -> T { if v < Zero::zero() { v.neg() } else { v } }
@nikomatsakis
Copy link
Contributor

This issue is subsumed by the more general #1053, so I'm going to close it.

wycats pushed a commit to wycats/rust-rfcs that referenced this issue Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants