summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-11-14 05:37:17 +0000
committerbors <bors@rust-lang.org>2014-11-14 05:37:17 +0000
commit6f7081fad5889c7b41460103fc8abc98f3285c60 (patch)
tree1c6785eb621540294408e54c1e811ba81e9412de /src/libsyntax/parse
parenta58fc68223f177b6790a6b4027bb6761031e9fa8 (diff)
parentc9e6bda9c758538e795ab387915543e076c35805 (diff)
downloadrust-6f7081fad5889c7b41460103fc8abc98f3285c60.tar.gz
rust-6f7081fad5889c7b41460103fc8abc98f3285c60.zip
auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichton
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below:

[breaking-change]

- `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`.
- `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead.
- `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers.
- `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value.
- `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that
- `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically.
- `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead.
- The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt`
- `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types.
- `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/mod.rs3
-rw-r--r--src/libsyntax/parse/parser.rs1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 996708b2174..51738ece80f 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -20,6 +20,7 @@ use ptr::P;
 use std::cell::{Cell, RefCell};
 use std::io::File;
 use std::rc::Rc;
+use std::num::Int;
 use std::str;
 use std::iter;
 
@@ -63,7 +64,7 @@ impl ParseSess {
     pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId {
         let v = self.node_id.get();
 
-        match v.checked_add(&count) {
+        match v.checked_add(count) {
             Some(next) => { self.node_id.set(next); }
             None => panic!("Input too large, ran out of node ids!")
         }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 90ada8a687c..42ec1e80342 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -87,6 +87,7 @@ use std::collections::HashSet;
 use std::io::fs::PathExtensions;
 use std::mem::replace;
 use std::mem;
+use std::num::Float;
 use std::rc::Rc;
 use std::iter;