Skip to content

Commit 5497d6b

Browse files
committed
---
yaml --- r: 36684 b: refs/heads/try2 c: 6047dd3 h: refs/heads/master v: v3
1 parent 8651e51 commit 5497d6b

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 0494b078a9555f77d9cd4fbe2a4ff910bfba29b8
8+
refs/heads/try2: 6047dd35bbe5b0b7c14cab6184bd39c607be19c1
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/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)