Skip to content

Commit bd751c8

Browse files
committed
---
yaml --- r: 111535 b: refs/heads/master c: aa4bc89 h: refs/heads/master i: 111533: b92d18f 111531: 87ec933 111527: 8d0ca23 111519: 06a3d03 v: v3
1 parent a0e0645 commit bd751c8

File tree

138 files changed

+3801
-4065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+3801
-4065
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 30fe55066a29a14fffd2a5f41e0ab21e7056fb34
2+
refs/heads/master: aa4bc89b17f2dd2f8c5ecad0a63cec39f24449bc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b5dd3f05fe95168b5569d0f519636149479eb6ac
55
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c

trunk/src/doc/guide-tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ be distributed on the available cores.
306306
fn partial_sum(start: uint) -> f64 {
307307
let mut local_sum = 0f64;
308308
for num in range(start*100000, (start+1)*100000) {
309-
local_sum += (num as f64 + 1.0).powf(-2.0);
309+
local_sum += (num as f64 + 1.0).powf(&-2.0);
310310
}
311311
local_sum
312312
}
@@ -343,7 +343,7 @@ extern crate sync;
343343
use sync::Arc;
344344
345345
fn pnorm(nums: &[f64], p: uint) -> f64 {
346-
nums.iter().fold(0.0, |a, b| a + b.powf(p as f64)).powf(1.0 / (p as f64))
346+
nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
347347
}
348348
349349
fn main() {

trunk/src/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pleasant high-level features include:
3333
This is an introductory tutorial for the Rust programming language. It
3434
covers the fundamentals of the language, including the syntax, the
3535
type system and memory model, generics, and modules. [Additional
36-
tutorials](#what-next?) cover specific language features in greater
36+
tutorials](#what-next) cover specific language features in greater
3737
depth.
3838

3939
This tutorial assumes that the reader is already familiar with one or
@@ -2253,7 +2253,7 @@ defining one.
22532253
22542254
The type parameters bound by a trait are in scope in each of the
22552255
method declarations. So, re-declaring the type parameter
2256-
`T` as an explicit type parameter for `length`, in either the trait or
2256+
`T` as an explicit type parameter for `len`, in either the trait or
22572257
the impl, would be a compile-time error.
22582258
22592259
Within a trait definition, `Self` is a special type that you can think

trunk/src/libhexfloat/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) ->
105105
Some(Ident{ident, span}) => match token::get_ident(ident).get() {
106106
"f32" => Some(ast::TyF32),
107107
"f64" => Some(ast::TyF64),
108-
"f128" => Some(ast::TyF128),
109108
_ => {
110109
cx.span_err(span, "invalid floating point type in hexfloat!");
111110
None

trunk/src/libnum/complex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ impl<T: Clone + Float> Cmplx<T> {
8282
/// Calculate |self|
8383
#[inline]
8484
pub fn norm(&self) -> T {
85-
self.re.hypot(self.im)
85+
self.re.hypot(&self.im)
8686
}
8787
}
8888

8989
impl<T: Clone + Float> Cmplx<T> {
9090
/// Calculate the principal Arg of self.
9191
#[inline]
9292
pub fn arg(&self) -> T {
93-
self.im.atan2(self.re)
93+
self.im.atan2(&self.re)
9494
}
9595
/// Convert to polar form (r, theta), such that `self = r * exp(i
9696
/// * theta)`

trunk/src/libnum/rational.rs

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use Integer;
1515
use std::cmp;
1616
use std::fmt;
1717
use std::from_str::FromStr;
18-
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
18+
use std::num::{Zero,One,ToStrRadix,FromStrRadix,Round};
1919
use bigint::{BigInt, BigUint, Sign, Plus, Minus};
2020

2121
/// Represents the ratio between 2 numbers.
@@ -113,40 +113,6 @@ impl<T: Clone + Integer + Ord>
113113
pub fn recip(&self) -> Ratio<T> {
114114
Ratio::new_raw(self.denom.clone(), self.numer.clone())
115115
}
116-
117-
pub fn floor(&self) -> Ratio<T> {
118-
if *self < Zero::zero() {
119-
Ratio::from_integer((self.numer - self.denom + One::one()) / self.denom)
120-
} else {
121-
Ratio::from_integer(self.numer / self.denom)
122-
}
123-
}
124-
125-
pub fn ceil(&self) -> Ratio<T> {
126-
if *self < Zero::zero() {
127-
Ratio::from_integer(self.numer / self.denom)
128-
} else {
129-
Ratio::from_integer((self.numer + self.denom - One::one()) / self.denom)
130-
}
131-
}
132-
133-
#[inline]
134-
pub fn round(&self) -> Ratio<T> {
135-
if *self < Zero::zero() {
136-
Ratio::from_integer((self.numer - self.denom + One::one()) / self.denom)
137-
} else {
138-
Ratio::from_integer((self.numer + self.denom - One::one()) / self.denom)
139-
}
140-
}
141-
142-
#[inline]
143-
pub fn trunc(&self) -> Ratio<T> {
144-
Ratio::from_integer(self.numer / self.denom)
145-
}
146-
147-
pub fn fract(&self) -> Ratio<T> {
148-
Ratio::new_raw(self.numer % self.denom, self.denom.clone())
149-
}
150116
}
151117

152118
impl Ratio<BigInt> {
@@ -272,6 +238,45 @@ impl<T: Clone + Integer + Ord>
272238
impl<T: Clone + Integer + Ord>
273239
Num for Ratio<T> {}
274240

241+
/* Utils */
242+
impl<T: Clone + Integer + Ord>
243+
Round for Ratio<T> {
244+
245+
fn floor(&self) -> Ratio<T> {
246+
if *self < Zero::zero() {
247+
Ratio::from_integer((self.numer - self.denom + One::one()) / self.denom)
248+
} else {
249+
Ratio::from_integer(self.numer / self.denom)
250+
}
251+
}
252+
253+
fn ceil(&self) -> Ratio<T> {
254+
if *self < Zero::zero() {
255+
Ratio::from_integer(self.numer / self.denom)
256+
} else {
257+
Ratio::from_integer((self.numer + self.denom - One::one()) / self.denom)
258+
}
259+
}
260+
261+
#[inline]
262+
fn round(&self) -> Ratio<T> {
263+
if *self < Zero::zero() {
264+
Ratio::from_integer((self.numer - self.denom + One::one()) / self.denom)
265+
} else {
266+
Ratio::from_integer((self.numer + self.denom - One::one()) / self.denom)
267+
}
268+
}
269+
270+
#[inline]
271+
fn trunc(&self) -> Ratio<T> {
272+
Ratio::from_integer(self.numer / self.denom)
273+
}
274+
275+
fn fract(&self) -> Ratio<T> {
276+
Ratio::new_raw(self.numer % self.denom, self.denom.clone())
277+
}
278+
}
279+
275280
/* String conversions */
276281
impl<T: fmt::Show> fmt::Show for Ratio<T> {
277282
/// Renders as `numer/denom`.
@@ -631,19 +636,19 @@ mod test {
631636

632637
// f32
633638
test(3.14159265359f32, ("13176795", "4194304"));
634-
test(2f32.powf(100.), ("1267650600228229401496703205376", "1"));
635-
test(-2f32.powf(100.), ("-1267650600228229401496703205376", "1"));
636-
test(1.0 / 2f32.powf(100.), ("1", "1267650600228229401496703205376"));
639+
test(2f32.powf(&100.), ("1267650600228229401496703205376", "1"));
640+
test(-2f32.powf(&100.), ("-1267650600228229401496703205376", "1"));
641+
test(1.0 / 2f32.powf(&100.), ("1", "1267650600228229401496703205376"));
637642
test(684729.48391f32, ("1369459", "2"));
638643
test(-8573.5918555f32, ("-4389679", "512"));
639644

640645
// f64
641646
test(3.14159265359f64, ("3537118876014453", "1125899906842624"));
642-
test(2f64.powf(100.), ("1267650600228229401496703205376", "1"));
643-
test(-2f64.powf(100.), ("-1267650600228229401496703205376", "1"));
647+
test(2f64.powf(&100.), ("1267650600228229401496703205376", "1"));
648+
test(-2f64.powf(&100.), ("-1267650600228229401496703205376", "1"));
644649
test(684729.48391f64, ("367611342500051", "536870912"));
645650
test(-8573.5918555, ("-4713381968463931", "549755813888"));
646-
test(1.0 / 2f64.powf(100.), ("1", "1267650600228229401496703205376"));
651+
test(1.0 / 2f64.powf(&100.), ("1", "1267650600228229401496703205376"));
647652
}
648653

649654
#[test]

trunk/src/librand/distributions/gamma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl IndependentSample<f64> for GammaSmallShape {
147147
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
148148
let Open01(u) = rng.gen::<Open01<f64>>();
149149

150-
self.large_shape.ind_sample(rng) * u.powf(self.inv_shape)
150+
self.large_shape.ind_sample(rng) * u.powf(&self.inv_shape)
151151
}
152152
}
153153
impl IndependentSample<f64> for GammaLargeShape {

trunk/src/librustc/driver/driver.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
299299
last_private_map: last_private_map
300300
} =
301301
time(time_passes, "resolution", (), |_|
302-
middle::resolve::resolve_crate(&sess, &lang_items, krate));
302+
middle::resolve::resolve_crate(&sess, lang_items, krate));
303303

304304
// Discard MTWT tables that aren't required past resolution.
305305
syntax::ext::mtwt::clear_tables();
@@ -316,7 +316,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
316316
sess.diagnostic(), krate)));
317317

318318
let freevars = time(time_passes, "freevar finding", (), |_|
319-
freevars::annotate_freevars(&def_map, krate));
319+
freevars::annotate_freevars(def_map, krate));
320320

321321
let region_map = time(time_passes, "region resolution", (), |_|
322322
middle::region::resolve_crate(&sess, krate));
@@ -328,7 +328,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
328328
freevars, region_map, lang_items);
329329

330330
// passes are timed inside typeck
331-
typeck::check_crate(&ty_cx, trait_map, krate);
331+
let (method_map, vtable_map) = typeck::check_crate(&ty_cx, trait_map, krate);
332332

333333
time(time_passes, "check static items", (), |_|
334334
middle::check_static::check_crate(&ty_cx, krate));
@@ -338,52 +338,56 @@ pub fn phase_3_run_analysis_passes(sess: Session,
338338
middle::const_eval::process_crate(krate, &ty_cx));
339339

340340
time(time_passes, "const checking", (), |_|
341-
middle::check_const::check_crate(krate, &ty_cx));
341+
middle::check_const::check_crate(krate, def_map, method_map, &ty_cx));
342342

343343
let maps = (external_exports, last_private_map);
344344
let (exported_items, public_items) =
345345
time(time_passes, "privacy checking", maps, |(a, b)|
346-
middle::privacy::check_crate(&ty_cx, &exp_map2, a, b, krate));
346+
middle::privacy::check_crate(&ty_cx, &method_map, &exp_map2,
347+
a, b, krate));
347348

348349
time(time_passes, "effect checking", (), |_|
349-
middle::effect::check_crate(&ty_cx, krate));
350+
middle::effect::check_crate(&ty_cx, method_map, krate));
350351

351352
let middle::moves::MoveMaps {moves_map, moved_variables_set,
352353
capture_map} =
353354
time(time_passes, "compute moves", (), |_|
354-
middle::moves::compute_moves(&ty_cx, krate));
355+
middle::moves::compute_moves(&ty_cx, method_map, krate));
355356

356357
time(time_passes, "match checking", (), |_|
357-
middle::check_match::check_crate(&ty_cx, &moves_map, krate));
358+
middle::check_match::check_crate(&ty_cx, method_map,
359+
&moves_map, krate));
358360

359361
time(time_passes, "liveness checking", (), |_|
360-
middle::liveness::check_crate(&ty_cx, &capture_map, krate));
362+
middle::liveness::check_crate(&ty_cx, method_map,
363+
&capture_map, krate));
361364

362365
let root_map =
363366
time(time_passes, "borrow checking", (), |_|
364-
middle::borrowck::check_crate(&ty_cx, &moves_map,
365-
&moved_variables_set,
367+
middle::borrowck::check_crate(&ty_cx, method_map,
368+
&moves_map, &moved_variables_set,
366369
&capture_map, krate));
367370

368371
drop(moves_map);
369372
drop(moved_variables_set);
370373

371374
time(time_passes, "kind checking", (), |_|
372-
kind::check_crate(&ty_cx, krate));
375+
kind::check_crate(&ty_cx, method_map, krate));
373376

374377
let reachable_map =
375378
time(time_passes, "reachability checking", (), |_|
376-
reachable::find_reachable(&ty_cx, &exported_items));
379+
reachable::find_reachable(&ty_cx, method_map, &exported_items));
377380

378381
time(time_passes, "death checking", (), |_| {
379382
middle::dead::check_crate(&ty_cx,
383+
method_map,
380384
&exported_items,
381385
&reachable_map,
382386
krate)
383387
});
384388

385389
time(time_passes, "lint checking", (), |_|
386-
lint::check_crate(&ty_cx, &exported_items, krate));
390+
lint::check_crate(&ty_cx, method_map, &exported_items, krate));
387391

388392
CrateAnalysis {
389393
exp_map2: exp_map2,
@@ -392,6 +396,8 @@ pub fn phase_3_run_analysis_passes(sess: Session,
392396
public_items: public_items,
393397
maps: astencode::Maps {
394398
root_map: root_map,
399+
method_map: method_map,
400+
vtable_map: vtable_map,
395401
capture_map: RefCell::new(capture_map)
396402
},
397403
reachable: reachable_map

trunk/src/librustc/front/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ fn fold_item_underscore(cx: &mut Context, item: &ast::Item_) -> ast::Item_ {
103103
.map(|x| *x).collect();
104104
ast::ItemImpl((*a).clone(), (*b).clone(), c, methods)
105105
}
106-
ast::ItemTrait(ref a, b, ref c, ref methods) => {
106+
ast::ItemTrait(ref a, ref b, ref methods) => {
107107
let methods = methods.iter()
108108
.filter(|m| trait_method_in_cfg(cx, *m) )
109109
.map(|x| (*x).clone())
110110
.collect();
111-
ast::ItemTrait((*a).clone(), b, (*c).clone(), methods)
111+
ast::ItemTrait((*a).clone(), (*b).clone(), methods)
112112
}
113113
ast::ItemStruct(def, ref generics) => {
114114
ast::ItemStruct(fold_struct(cx, def), generics.clone())

trunk/src/librustc/front/feature_gate.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
5757
("linkage", Active),
5858
("struct_inherit", Active),
5959

60-
("quad_precision_float", Active),
61-
6260
// These are used to test this portion of the compiler, they don't actually
6361
// mean anything
6462
("test_accepted_feature", Accepted),
@@ -79,15 +77,13 @@ enum Status {
7977

8078
/// A set of features to be used by later passes.
8179
pub struct Features {
82-
pub default_type_params: Cell<bool>,
83-
pub quad_precision_float: Cell<bool>
80+
pub default_type_params: Cell<bool>
8481
}
8582

8683
impl Features {
8784
pub fn new() -> Features {
8885
Features {
89-
default_type_params: Cell::new(false),
90-
quad_precision_float: Cell::new(false)
86+
default_type_params: Cell::new(false)
9187
}
9288
}
9389
}
@@ -368,5 +364,4 @@ pub fn check_crate(sess: &Session, krate: &ast::Crate) {
368364
sess.abort_if_errors();
369365

370366
sess.features.default_type_params.set(cx.has_feature("default_type_params"));
371-
sess.features.quad_precision_float.set(cx.has_feature("quad_precision_float"));
372367
}

0 commit comments

Comments
 (0)