Skip to content

Commit 432134e

Browse files
committed
---
yaml --- r: 39349 b: refs/heads/incoming c: 6047dd3 h: refs/heads/master i: 39347: 70a787c v: v3
1 parent 250b3a1 commit 432134e

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 0494b078a9555f77d9cd4fbe2a4ff910bfba29b8
9+
refs/heads/incoming: 6047dd35bbe5b0b7c14cab6184bd39c607be19c1
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/librustc/middle/trans/meth.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -515,15 +515,7 @@ fn combine_impl_and_methods_origins(bcx: block,
515515
let m_boundss = vec::view(*r_m_bounds, n_r_m_tps - n_m_tps, n_r_m_tps);
516516
517517
// Flatten out to find the number of vtables the method expects.
518-
let m_vtables = m_boundss.foldl(0, |sum, m_bounds| {
519-
m_bounds.foldl(*sum, |sum, m_bound| {
520-
(*sum) + match (*m_bound) {
521-
ty::bound_copy | ty::bound_owned |
522-
ty::bound_send | ty::bound_const => 0,
523-
ty::bound_trait(_) => 1
524-
}
525-
})
526-
});
518+
let m_vtables = ty::count_traits_and_supertraits(tcx, m_boundss);
527519
528520
// Find the vtables we computed at type check time and monomorphize them
529521
let r_m_origins = match node_vtables(bcx, callee_id) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pub trait Number: NumConv {
2+
static pure fn from<T:Number>(n: T) -> self;
3+
}
4+
5+
pub impl float: Number {
6+
static pure fn from<T:Number>(n: T) -> float { n.to_float() }
7+
}
8+
9+
pub trait NumConv {
10+
pure fn to_float(&self) -> float;
11+
}
12+
13+
pub impl float: NumConv {
14+
pure fn to_float(&self) -> float { *self }
15+
}
16+
17+
fn main() {
18+
let _: float = Number::from(0.0f);
19+
}

0 commit comments

Comments
 (0)