Skip to content

Commit d8f82e8

Browse files
committed
---
yaml --- r: 128627 b: refs/heads/try c: c186b4b h: refs/heads/master i: 128625: 3937005 128623: efb754a v: v3
1 parent f325a44 commit d8f82e8

File tree

36 files changed

+146
-499
lines changed

36 files changed

+146
-499
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: 4879ca79240387d18723a324d92c603c5057d342
5+
refs/heads/try: c186b4be6b773243b6f066df450be77508fe31a6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ OS X, the install page provides links to native installers.
7676
> the precise details of which are not discussed here.
7777
7878
For Linux and OS X, the install page provides links to binary tarballs.
79-
To install the Rust compiler from the from a binary tarball, download
79+
To install the Rust compiler from a binary tarball, download
8080
the binary package, extract it, and execute the `install.sh` script in
8181
the root directory of the package.
8282

branches/try/src/librustc/lint/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ impl<'a> Visitor<()> for Context<'a> {
576576
run_lints!(self, check_lifetime_ref, lt);
577577
}
578578

579-
fn visit_lifetime_decl(&mut self, lt: &ast::LifetimeDef, _: ()) {
579+
fn visit_lifetime_decl(&mut self, lt: &ast::Lifetime, _: ()) {
580580
run_lints!(self, check_lifetime_decl, lt);
581581
}
582582

branches/try/src/librustc/lint/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub trait LintPass {
150150
fn check_variant(&mut self, _: &Context, _: &ast::Variant, _: &ast::Generics) { }
151151
fn check_opt_lifetime_ref(&mut self, _: &Context, _: Span, _: &Option<ast::Lifetime>) { }
152152
fn check_lifetime_ref(&mut self, _: &Context, _: &ast::Lifetime) { }
153-
fn check_lifetime_decl(&mut self, _: &Context, _: &ast::LifetimeDef) { }
153+
fn check_lifetime_decl(&mut self, _: &Context, _: &ast::Lifetime) { }
154154
fn check_explicit_self(&mut self, _: &Context, _: &ast::ExplicitSelf) { }
155155
fn check_mac(&mut self, _: &Context, _: &ast::Mac) { }
156156
fn check_path(&mut self, _: &Context, _: &ast::Path, _: ast::NodeId) { }

branches/try/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,8 +1755,7 @@ fn encode_reachable_extern_fns(ecx: &EncodeContext, rbml_w: &mut Encoder) {
17551755
match ecx.tcx.map.find(*id) {
17561756
Some(ast_map::NodeItem(i)) => {
17571757
match i.node {
1758-
ast::ItemFn(_, _, abi, ref generics, _)
1759-
if abi != abi::Rust && !generics.is_type_parameterized() => {
1758+
ast::ItemFn(_, _, abi, _, _) if abi != abi::Rust => {
17601759
rbml_w.wr_tagged_u32(tag_reachable_extern_fn_id, *id);
17611760
}
17621761
_ => {}

branches/try/src/librustc/middle/resolve_lifetime.rs

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ struct LifetimeContext<'a> {
5959
enum ScopeChain<'a> {
6060
/// EarlyScope(i, ['a, 'b, ...], s) extends s with early-bound
6161
/// lifetimes, assigning indexes 'a => i, 'b => i+1, ... etc.
62-
EarlyScope(subst::ParamSpace, &'a Vec<ast::LifetimeDef>, Scope<'a>),
62+
EarlyScope(subst::ParamSpace, &'a Vec<ast::Lifetime>, Scope<'a>),
6363
/// LateScope(binder_id, ['a, 'b, ...], s) extends s with late-bound
6464
/// lifetimes introduced by the declaration binder_id.
65-
LateScope(ast::NodeId, &'a Vec<ast::LifetimeDef>, Scope<'a>),
65+
LateScope(ast::NodeId, &'a Vec<ast::Lifetime>, Scope<'a>),
6666
/// lifetimes introduced by items within a code block are scoped
6767
/// to that block.
6868
BlockScope(ast::NodeId, Scope<'a>),
@@ -136,7 +136,7 @@ impl<'a, 'b> Visitor<Scope<'a>> for LifetimeContext<'b> {
136136
fn push_fn_scope(this: &mut LifetimeContext,
137137
ty: &ast::Ty,
138138
scope: Scope,
139-
lifetimes: &Vec<ast::LifetimeDef>) {
139+
lifetimes: &Vec<ast::Lifetime>) {
140140
let scope1 = LateScope(ty.id, lifetimes, scope);
141141
this.check_lifetime_names(lifetimes);
142142
debug!("pushing fn scope id={} due to type", ty.id);
@@ -216,7 +216,7 @@ impl<'a> LifetimeContext<'a> {
216216
walk(self, &scope1)
217217
} else {
218218
let (early, late) = generics.lifetimes.clone().partition(
219-
|l| referenced_idents.iter().any(|&i| i == l.lifetime.name));
219+
|l| referenced_idents.iter().any(|&i| i == l.name));
220220

221221
let scope1 = EarlyScope(subst::FnSpace, &early, scope);
222222
let scope2 = LateScope(n, &late, &scope1);
@@ -334,39 +334,29 @@ impl<'a> LifetimeContext<'a> {
334334
token::get_name(lifetime_ref.name)).as_slice());
335335
}
336336

337-
fn check_lifetime_names(&self, lifetimes: &Vec<ast::LifetimeDef>) {
337+
fn check_lifetime_names(&self, lifetimes: &Vec<ast::Lifetime>) {
338338
for i in range(0, lifetimes.len()) {
339339
let lifetime_i = lifetimes.get(i);
340340

341341
let special_idents = [special_idents::static_lifetime];
342342
for lifetime in lifetimes.iter() {
343-
if special_idents.iter().any(|&i| i.name == lifetime.lifetime.name) {
343+
if special_idents.iter().any(|&i| i.name == lifetime.name) {
344344
self.sess.span_err(
345-
lifetime.lifetime.span,
345+
lifetime.span,
346346
format!("illegal lifetime parameter name: `{}`",
347-
token::get_name(lifetime.lifetime.name))
348-
.as_slice());
347+
token::get_name(lifetime.name)).as_slice());
349348
}
350349
}
351350

352351
for j in range(i + 1, lifetimes.len()) {
353352
let lifetime_j = lifetimes.get(j);
354353

355-
if lifetime_i.lifetime.name == lifetime_j.lifetime.name {
354+
if lifetime_i.name == lifetime_j.name {
356355
self.sess.span_err(
357-
lifetime_j.lifetime.span,
356+
lifetime_j.span,
358357
format!("lifetime name `{}` declared twice in \
359358
the same scope",
360-
token::get_name(lifetime_j.lifetime.name))
361-
.as_slice());
362-
}
363-
}
364-
365-
for bound in lifetime_i.bounds.iter() {
366-
if !self.sess.features.issue_5723_bootstrap.get() {
367-
self.sess.span_err(
368-
bound.span,
369-
"region bounds require `issue_5723_bootstrap`");
359+
token::get_name(lifetime_j.name)).as_slice());
370360
}
371361
}
372362
}
@@ -389,28 +379,28 @@ impl<'a> LifetimeContext<'a> {
389379
}
390380
}
391381

392-
fn search_lifetimes(lifetimes: &Vec<ast::LifetimeDef>,
382+
fn search_lifetimes(lifetimes: &Vec<ast::Lifetime>,
393383
lifetime_ref: &ast::Lifetime)
394384
-> Option<(uint, ast::NodeId)> {
395385
for (i, lifetime_decl) in lifetimes.iter().enumerate() {
396-
if lifetime_decl.lifetime.name == lifetime_ref.name {
397-
return Some((i, lifetime_decl.lifetime.id));
386+
if lifetime_decl.name == lifetime_ref.name {
387+
return Some((i, lifetime_decl.id));
398388
}
399389
}
400390
return None;
401391
}
402392

403393
///////////////////////////////////////////////////////////////////////////
404394

405-
pub fn early_bound_lifetimes<'a>(generics: &'a ast::Generics) -> Vec<ast::LifetimeDef> {
395+
pub fn early_bound_lifetimes<'a>(generics: &'a ast::Generics) -> Vec<ast::Lifetime> {
406396
let referenced_idents = free_lifetimes(&generics.ty_params);
407397
if referenced_idents.is_empty() {
408398
return Vec::new();
409399
}
410400

411401
generics.lifetimes.iter()
412-
.filter(|l| referenced_idents.iter().any(|&i| i == l.lifetime.name))
413-
.map(|l| (*l).clone())
402+
.filter(|l| referenced_idents.iter().any(|&i| i == l.name))
403+
.map(|l| *l)
414404
.collect()
415405
}
416406

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'a> Drop for StatRecorder<'a> {
171171
}
172172

173173
// only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions
174-
pub fn decl_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv,
174+
fn decl_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv,
175175
ty: Type, output: ty::t) -> ValueRef {
176176

177177
let llfn: ValueRef = name.with_c_str(|buf| {
@@ -1922,27 +1922,20 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
19221922
let _icx = push_ctxt("trans_item");
19231923
match item.node {
19241924
ast::ItemFn(ref decl, _fn_style, abi, ref generics, ref body) => {
1925-
if !generics.is_type_parameterized() {
1925+
if abi != Rust {
1926+
let llfndecl = get_item_val(ccx, item.id);
1927+
foreign::trans_rust_fn_with_foreign_abi(
1928+
ccx, &**decl, &**body, item.attrs.as_slice(), llfndecl, item.id);
1929+
} else if !generics.is_type_parameterized() {
19261930
let llfn = get_item_val(ccx, item.id);
1927-
if abi != Rust {
1928-
foreign::trans_rust_fn_with_foreign_abi(ccx,
1929-
&**decl,
1930-
&**body,
1931-
item.attrs.as_slice(),
1932-
llfn,
1933-
&param_substs::empty(),
1934-
item.id,
1935-
None);
1936-
} else {
1937-
trans_fn(ccx,
1938-
&**decl,
1939-
&**body,
1940-
llfn,
1941-
&param_substs::empty(),
1942-
item.id,
1943-
item.attrs.as_slice(),
1944-
TranslateItems);
1945-
}
1931+
trans_fn(ccx,
1932+
&**decl,
1933+
&**body,
1934+
llfn,
1935+
&param_substs::empty(),
1936+
item.id,
1937+
item.attrs.as_slice(),
1938+
TranslateItems);
19461939
} else {
19471940
// Be sure to travel more than just one layer deep to catch nested
19481941
// items in blocks and such.

branches/try/src/librustc/middle/trans/foreign.rs

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -24,7 +24,6 @@ use middle::trans::type_of::*;
2424
use middle::trans::type_of;
2525
use middle::ty::FnSig;
2626
use middle::ty;
27-
use middle::subst::Subst;
2827
use std::cmp;
2928
use libc::c_uint;
3029
use syntax::abi::{Cdecl, Aapcs, C, Win64, Abi};
@@ -526,26 +525,6 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) {
526525
// inline the one into the other. Of course we could just generate the
527526
// correct code in the first place, but this is much simpler.
528527

529-
pub fn decl_rust_fn_with_foreign_abi(ccx: &CrateContext,
530-
t: ty::t,
531-
name: &str)
532-
-> ValueRef {
533-
let tys = foreign_types_for_fn_ty(ccx, t);
534-
let llfn_ty = lltype_for_fn_from_foreign_types(ccx, &tys);
535-
let cconv = match ty::get(t).sty {
536-
ty::ty_bare_fn(ref fn_ty) => {
537-
let c = llvm_calling_convention(ccx, fn_ty.abi);
538-
c.unwrap_or(llvm::CCallConv)
539-
}
540-
_ => fail!("expected bare fn in decl_rust_fn_with_foreign_abi")
541-
};
542-
let llfn = base::decl_fn(ccx, name, cconv, llfn_ty, ty::mk_nil());
543-
add_argument_attributes(&tys, llfn);
544-
debug!("decl_rust_fn_with_foreign_abi(llfn_ty={}, llfn={})",
545-
ccx.tn.type_to_string(llfn_ty), ccx.tn.val_to_string(llfn));
546-
llfn
547-
}
548-
549528
pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
550529
sp: Span,
551530
sym: String,
@@ -575,39 +554,31 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
575554
body: &ast::Block,
576555
attrs: &[ast::Attribute],
577556
llwrapfn: ValueRef,
578-
param_substs: &param_substs,
579-
id: ast::NodeId,
580-
hash: Option<&str>) {
557+
id: ast::NodeId) {
581558
let _icx = push_ctxt("foreign::build_foreign_fn");
582-
583-
let fnty = ty::node_id_to_type(ccx.tcx(), id);
584-
let mty = fnty.subst(ccx.tcx(), &param_substs.substs);
585-
let tys = foreign_types_for_fn_ty(ccx, mty);
559+
let tys = foreign_types_for_id(ccx, id);
586560

587561
unsafe { // unsafe because we call LLVM operations
588562
// Build up the Rust function (`foo0` above).
589-
let llrustfn = build_rust_fn(ccx, decl, body, param_substs, attrs, id, hash);
563+
let llrustfn = build_rust_fn(ccx, decl, body, attrs, id);
590564

591565
// Build up the foreign wrapper (`foo` above).
592-
return build_wrap_fn(ccx, llrustfn, llwrapfn, &tys, mty);
566+
return build_wrap_fn(ccx, llrustfn, llwrapfn, &tys, id);
593567
}
594568

595569
fn build_rust_fn(ccx: &CrateContext,
596570
decl: &ast::FnDecl,
597571
body: &ast::Block,
598-
param_substs: &param_substs,
599572
attrs: &[ast::Attribute],
600-
id: ast::NodeId,
601-
hash: Option<&str>)
573+
id: ast::NodeId)
602574
-> ValueRef {
603575
let _icx = push_ctxt("foreign::foreign::build_rust_fn");
604576
let tcx = ccx.tcx();
605-
let t = ty::node_id_to_type(tcx, id).subst(
606-
ccx.tcx(), &param_substs.substs);
577+
let t = ty::node_id_to_type(tcx, id);
607578

608579
let ps = ccx.tcx.map.with_path(id, |path| {
609580
let abi = Some(ast_map::PathName(special_idents::clownshoe_abi.name));
610-
link::mangle(path.chain(abi.move_iter()), hash)
581+
link::mangle(path.chain(abi.move_iter()), None)
611582
});
612583

613584
// Compute the type that the function would have if it were just a
@@ -630,19 +601,22 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
630601

631602
let llfn = base::decl_internal_rust_fn(ccx, t, ps.as_slice());
632603
base::set_llvm_fn_attrs(attrs, llfn);
633-
base::trans_fn(ccx, decl, body, llfn, param_substs, id, [], TranslateItems);
604+
base::trans_fn(ccx, decl, body, llfn, &param_substs::empty(), id, [],
605+
TranslateItems);
634606
llfn
635607
}
636608

637609
unsafe fn build_wrap_fn(ccx: &CrateContext,
638610
llrustfn: ValueRef,
639611
llwrapfn: ValueRef,
640612
tys: &ForeignTypes,
641-
t: ty::t) {
613+
id: ast::NodeId) {
642614
let _icx = push_ctxt(
643615
"foreign::trans_rust_fn_with_foreign_abi::build_wrap_fn");
644616
let tcx = ccx.tcx();
645617

618+
let t = ty::node_id_to_type(tcx, id);
619+
646620
debug!("build_wrap_fn(llrustfn={}, llwrapfn={}, t={})",
647621
ccx.tn.val_to_string(llrustfn),
648622
ccx.tn.val_to_string(llwrapfn),

0 commit comments

Comments
 (0)