Skip to content

Commit c19de5f

Browse files
committed
---
yaml --- r: 33941 b: refs/heads/snap-stage3 c: 4f3cc01 h: refs/heads/master i: 33939: 3f06722 v: v3
1 parent e512f87 commit c19de5f

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5bf9e6f58be43957b3e79f47b3020667a81630ef
4+
refs/heads/snap-stage3: 4f3cc01487ff4c49f6a72725ae47533da06835db
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/trans/inline.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use syntax::ast;
1313
use syntax::ast_util::local_def;
1414
use syntax::ast_map::{path, path_mod, path_name};
1515
use base::{trans_item, get_item_val, self_arg, trans_fn, impl_owned_self,
16-
impl_self, get_insn_ctxt};
16+
impl_self, no_self, get_insn_ctxt};
1717

1818
// `translate` will be true if this function is allowed to translate the
1919
// item and false otherwise. Currently, this parameter is set to false when
@@ -83,14 +83,18 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id,
8383
let path = vec::append(
8484
ty::item_path(ccx.tcx, impl_did),
8585
~[path_name(mth.ident)]);
86-
let self_ty = ty::node_id_to_type(ccx.tcx, mth.self_id);
87-
debug!("calling inline trans_fn with self_ty %s",
88-
ty_to_str(ccx.tcx, self_ty));
89-
let self_kind;
90-
match mth.self_ty.node {
91-
ast::sty_value => self_kind = impl_owned_self(self_ty),
92-
_ => self_kind = impl_self(self_ty),
93-
}
86+
let self_kind = match mth.self_ty.node {
87+
ast::sty_static => no_self,
88+
_ => {
89+
let self_ty = ty::node_id_to_type(ccx.tcx, mth.self_id);
90+
debug!("calling inline trans_fn with self_ty %s",
91+
ty_to_str(ccx.tcx, self_ty));
92+
match mth.self_ty.node {
93+
ast::sty_value => impl_owned_self(self_ty),
94+
_ => impl_self(self_ty),
95+
}
96+
}
97+
};
9498
trans_fn(ccx,
9599
path,
96100
mth.decl,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
pub mod num {
3+
pub trait Num2 {
4+
static pure fn from_int2(n: int) -> self;
5+
}
6+
}
7+
8+
pub mod float {
9+
impl float: num::Num2 {
10+
#[inline]
11+
static pure fn from_int2(n: int) -> float { return n as float; }
12+
}
13+
}
14+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// aux-build:static_fn_inline_xc_aux.rs
2+
3+
extern mod mycore(name ="static_fn_inline_xc_aux");
4+
5+
use mycore::num;
6+
7+
fn main() {
8+
let _1:float = num::from_int2(1i);
9+
}

0 commit comments

Comments
 (0)