Skip to content

Commit 7e280b8

Browse files
committed
---
yaml --- r: 110433 b: refs/heads/try c: 57e0908 h: refs/heads/master i: 110431: 2c2799d v: v3
1 parent 36c27cd commit 7e280b8

34 files changed

+206
-461
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: e415c25bcd81dc1f9a5a3d25d9b48ed2d545336b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c7fac4471201977fdb1c0c0a26c87287e12dc644
5-
refs/heads/try: 1a1c47b91824bae040ddc2d799e14365b5415762
5+
refs/heads/try: 57e0908af395af1c10e28600b785b5366a43660c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/front/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn fold_foreign_mod(cx: &mut Context, nm: &ast::ForeignMod) -> ast::ForeignMod {
9090
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
9191
}).collect();
9292
ast::ForeignMod {
93-
abis: nm.abis,
93+
abi: nm.abi,
9494
view_items: filtered_view_items,
9595
items: filtered_items
9696
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
187187
fn visit_item(e: &Env, i: &ast::Item) {
188188
match i.node {
189189
ast::ItemForeignMod(ref fm) => {
190-
if fm.abis.is_rust() || fm.abis.is_intrinsic() {
190+
if fm.abi == abi::Rust || fm.abi == abi::RustIntrinsic {
191191
return;
192192
}
193193

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use std::hash::Hash;
3333
use std::io::MemWriter;
3434
use std::str;
3535
use collections::HashMap;
36-
use syntax::abi::AbiSet;
36+
use syntax::abi;
3737
use syntax::ast::*;
3838
use syntax::ast;
3939
use syntax::ast_map::{PathElem, PathElems};
@@ -1217,7 +1217,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
12171217
nitem: &ForeignItem,
12181218
index: @RefCell<Vec<entry<i64>> >,
12191219
path: PathElems,
1220-
abi: AbiSet) {
1220+
abi: abi::Abi) {
12211221
index.borrow_mut().push(entry {
12221222
val: nitem.id as i64,
12231223
pos: ebml_w.writer.tell().unwrap(),
@@ -1231,7 +1231,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
12311231
encode_bounds_and_type(ebml_w, ecx,
12321232
&lookup_item_type(ecx.tcx,local_def(nitem.id)));
12331233
encode_name(ebml_w, nitem.ident.name);
1234-
if abi.is_intrinsic() {
1234+
if abi == abi::RustIntrinsic {
12351235
(ecx.encode_inlined_item)(ecx, ebml_w, IIForeignRef(nitem));
12361236
} else {
12371237
encode_symbol(ecx, ebml_w, nitem.id);
@@ -1279,11 +1279,11 @@ fn my_visit_foreign_item(ni: &ForeignItem,
12791279
let mut ebml_w = unsafe {
12801280
ebml_w.unsafe_clone()
12811281
};
1282-
let abis = ecx.tcx.map.get_foreign_abis(ni.id);
1282+
let abi = ecx.tcx.map.get_foreign_abi(ni.id);
12831283
ecx.tcx.map.with_path(ni.id, |path| {
12841284
encode_info_for_foreign_item(ecx, &mut ebml_w,
12851285
ni, index,
1286-
path, abis);
1286+
path, abi);
12871287
});
12881288
}
12891289

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use middle::ty;
2020

2121
use std::str;
2222
use std::uint;
23-
use syntax::abi::AbiSet;
2423
use syntax::abi;
2524
use syntax::ast;
2625
use syntax::ast::*;
@@ -460,18 +459,12 @@ fn parse_purity(c: char) -> Purity {
460459
}
461460
}
462461

463-
fn parse_abi_set(st: &mut PState) -> AbiSet {
462+
fn parse_abi_set(st: &mut PState) -> abi::Abi {
464463
assert_eq!(next(st), '[');
465-
let mut abis = AbiSet::empty();
466-
while peek(st) != ']' {
467-
scan(st, |c| c == ',', |bytes| {
468-
let abi_str = str::from_utf8(bytes).unwrap().to_owned();
469-
let abi = abi::lookup(abi_str).expect(abi_str);
470-
abis.add(abi);
471-
});
472-
}
473-
assert_eq!(next(st), ']');
474-
return abis;
464+
scan(st, |c| c == ']', |bytes| {
465+
let abi_str = str::from_utf8(bytes).unwrap().to_owned();
466+
abi::lookup(abi_str).expect(abi_str)
467+
})
475468
}
476469

477470
fn parse_onceness(c: char) -> ast::Onceness {
@@ -505,7 +498,7 @@ fn parse_bare_fn_ty(st: &mut PState, conv: conv_did) -> ty::BareFnTy {
505498
let sig = parse_sig(st, |x,y| conv(x,y));
506499
ty::BareFnTy {
507500
purity: purity,
508-
abis: abi,
501+
abi: abi,
509502
sig: sig
510503
}
511504
}

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::fmt;
2323
use middle::ty::param_ty;
2424
use middle::ty;
2525

26-
use syntax::abi::AbiSet;
26+
use syntax::abi::Abi;
2727
use syntax::ast;
2828
use syntax::ast::*;
2929
use syntax::diagnostic::SpanHandler;
@@ -341,12 +341,9 @@ fn enc_purity(w: &mut MemWriter, p: Purity) {
341341
}
342342
}
343343

344-
fn enc_abi_set(w: &mut MemWriter, abis: AbiSet) {
344+
fn enc_abi(w: &mut MemWriter, abi: Abi) {
345345
mywrite!(w, "[");
346-
abis.each(|abi| {
347-
mywrite!(w, "{},", abi.name());
348-
true
349-
});
346+
mywrite!(w, "{}", abi.name());
350347
mywrite!(w, "]")
351348
}
352349

@@ -359,7 +356,7 @@ fn enc_onceness(w: &mut MemWriter, o: Onceness) {
359356

360357
pub fn enc_bare_fn_ty(w: &mut MemWriter, cx: &ctxt, ft: &ty::BareFnTy) {
361358
enc_purity(w, ft.purity);
362-
enc_abi_set(w, ft.abis);
359+
enc_abi(w, ft.abi);
363360
enc_fn_sig(w, cx, &ft.sig);
364361
}
365362

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ use std::u32;
5959
use std::u64;
6060
use std::u8;
6161
use collections::SmallIntMap;
62+
use syntax::abi;
6263
use syntax::ast_map;
6364
use syntax::ast_util::IdVisitingOperation;
6465
use syntax::attr::{AttrMetaMethods, AttributeMethods};
@@ -892,7 +893,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::Item) {
892893
}
893894

894895
match it.node {
895-
ast::ItemForeignMod(ref nmod) if !nmod.abis.is_intrinsic() => {
896+
ast::ItemForeignMod(ref nmod) if nmod.abi != abi::RustIntrinsic => {
896897
for ni in nmod.items.iter() {
897898
match ni.node {
898899
ast::ForeignItemFn(decl, _) => check_foreign_fn(cx, decl),

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,8 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val
855855
let name = csearch::get_symbol(&ccx.sess().cstore, did);
856856
match ty::get(t).sty {
857857
ty::ty_bare_fn(ref fn_ty) => {
858-
match fn_ty.abis.for_target(ccx.sess().targ_cfg.os,
859-
ccx.sess().targ_cfg.arch) {
858+
match fn_ty.abi.for_target(ccx.sess().targ_cfg.os,
859+
ccx.sess().targ_cfg.arch) {
860860
Some(Rust) | Some(RustIntrinsic) => {
861861
get_extern_rust_fn(ccx,
862862
fn_ty.sig.inputs.as_slice(),
@@ -865,7 +865,7 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val
865865
did)
866866
}
867867
Some(..) | None => {
868-
let c = foreign::llvm_calling_convention(ccx, fn_ty.abis);
868+
let c = foreign::llvm_calling_convention(ccx, fn_ty.abi);
869869
let cconv = c.unwrap_or(lib::llvm::CCallConv);
870870
let llty = type_of_fn_from_ty(ccx, t);
871871
get_extern_fn(&mut *ccx.externs.borrow_mut(), ccx.llmod,
@@ -1601,7 +1601,7 @@ impl<'a> Visitor<()> for TransItemVisitor<'a> {
16011601
pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
16021602
let _icx = push_ctxt("trans_item");
16031603
match item.node {
1604-
ast::ItemFn(decl, purity, _abis, ref generics, body) => {
1604+
ast::ItemFn(decl, purity, _abi, ref generics, body) => {
16051605
if purity == ast::ExternFn {
16061606
let llfndecl = get_item_val(ccx, item.id);
16071607
foreign::trans_rust_fn_with_foreign_abi(
@@ -1721,7 +1721,7 @@ fn register_fn(ccx: &CrateContext,
17211721
-> ValueRef {
17221722
let f = match ty::get(node_type).sty {
17231723
ty::ty_bare_fn(ref f) => {
1724-
assert!(f.abis.is_rust() || f.abis.is_intrinsic());
1724+
assert!(f.abi == Rust || f.abi == RustIntrinsic);
17251725
f
17261726
}
17271727
_ => fail!("expected bare rust fn or an intrinsic")
@@ -1997,8 +1997,8 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
19971997

19981998
match ni.node {
19991999
ast::ForeignItemFn(..) => {
2000-
let abis = ccx.tcx.map.get_foreign_abis(id);
2001-
foreign::register_foreign_item_fn(ccx, abis, ni)
2000+
let abi = ccx.tcx.map.get_foreign_abi(id);
2001+
foreign::register_foreign_item_fn(ccx, abi, ni)
20022002
}
20032003
ast::ForeignItemStatic(..) => {
20042004
foreign::register_static(ccx, ni)

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use util::ppaux::Repr;
5050
use middle::trans::type_::Type;
5151

5252
use syntax::ast;
53-
use syntax::abi::AbiSet;
53+
use synabi = syntax::abi;
5454
use syntax::ast_map;
5555

5656
pub struct MethodData {
@@ -363,7 +363,7 @@ pub fn trans_fn_ref_with_vtables(
363363

364364
match map_node {
365365
ast_map::NodeForeignItem(_) => {
366-
tcx.map.get_foreign_abis(def_id.node).is_intrinsic()
366+
tcx.map.get_foreign_abi(def_id.node) == synabi::RustIntrinsic
367367
}
368368
_ => false
369369
}
@@ -572,13 +572,11 @@ pub fn trans_call_inner<'a>(
572572
};
573573

574574
let (abi, ret_ty) = match ty::get(callee_ty).sty {
575-
ty::ty_bare_fn(ref f) => (f.abis, f.sig.output),
576-
ty::ty_closure(ref f) => (AbiSet::Rust(), f.sig.output),
575+
ty::ty_bare_fn(ref f) => (f.abi, f.sig.output),
576+
ty::ty_closure(ref f) => (synabi::Rust, f.sig.output),
577577
_ => fail!("expected bare rust fn or closure in trans_call_inner")
578578
};
579-
let is_rust_fn =
580-
abi.is_rust() ||
581-
abi.is_intrinsic();
579+
let is_rust_fn = abi == synabi::Rust || abi == synabi::RustIntrinsic;
582580

583581
// Generate a location to store the result. If the user does
584582
// not care about the result, just make a stack slot.

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use middle::ty::FnSig;
2727
use middle::ty;
2828
use std::cmp;
2929
use std::libc::c_uint;
30-
use syntax::abi::{Cdecl, Aapcs, C, AbiSet, Win64};
30+
use syntax::abi::{Cdecl, Aapcs, C, Win64, Abi};
3131
use syntax::abi::{RustIntrinsic, Rust, Stdcall, Fastcall, System};
3232
use syntax::codemap::Span;
3333
use syntax::parse::token::{InternedString, special_idents};
@@ -73,10 +73,10 @@ struct LlvmSignature {
7373
// Calls to external functions
7474

7575
pub fn llvm_calling_convention(ccx: &CrateContext,
76-
abis: AbiSet) -> Option<CallConv> {
76+
abi: Abi) -> Option<CallConv> {
7777
let os = ccx.sess().targ_cfg.os;
7878
let arch = ccx.sess().targ_cfg.arch;
79-
abis.for_target(os, arch).map(|abi| {
79+
abi.for_target(os, arch).map(|abi| {
8080
match abi {
8181
RustIntrinsic => {
8282
// Intrinsics are emitted by monomorphic fn
@@ -180,27 +180,27 @@ pub fn register_static(ccx: &CrateContext,
180180
}
181181
}
182182

183-
pub fn register_foreign_item_fn(ccx: &CrateContext, abis: AbiSet,
183+
pub fn register_foreign_item_fn(ccx: &CrateContext, abi: Abi,
184184
foreign_item: &ast::ForeignItem) -> ValueRef {
185185
/*!
186186
* Registers a foreign function found in a library.
187187
* Just adds a LLVM global.
188188
*/
189189

190-
debug!("register_foreign_item_fn(abis={}, \
190+
debug!("register_foreign_item_fn(abi={}, \
191191
path={}, \
192192
foreign_item.id={})",
193-
abis.repr(ccx.tcx()),
193+
abi.repr(ccx.tcx()),
194194
ccx.tcx.map.path_to_str(foreign_item.id),
195195
foreign_item.id);
196196

197-
let cc = match llvm_calling_convention(ccx, abis) {
197+
let cc = match llvm_calling_convention(ccx, abi) {
198198
Some(cc) => cc,
199199
None => {
200200
ccx.sess().span_fatal(foreign_item.span,
201201
format!("ABI `{}` has no suitable calling convention \
202202
for target architecture",
203-
abis.user_string(ccx.tcx())));
203+
abi.user_string(ccx.tcx())));
204204
}
205205
};
206206

@@ -263,8 +263,8 @@ pub fn trans_native_call<'a>(
263263
ccx.tn.val_to_str(llfn),
264264
ccx.tn.val_to_str(llretptr));
265265

266-
let (fn_abis, fn_sig) = match ty::get(callee_ty).sty {
267-
ty::ty_bare_fn(ref fn_ty) => (fn_ty.abis, fn_ty.sig.clone()),
266+
let (fn_abi, fn_sig) = match ty::get(callee_ty).sty {
267+
ty::ty_bare_fn(ref fn_ty) => (fn_ty.abi, fn_ty.sig.clone()),
268268
_ => ccx.sess().bug("trans_native_call called on non-function type")
269269
};
270270
let llsig = foreign_signature(ccx, &fn_sig, passed_arg_tys.as_slice());
@@ -354,14 +354,14 @@ pub fn trans_native_call<'a>(
354354
llargs_foreign.push(llarg_foreign);
355355
}
356356

357-
let cc = match llvm_calling_convention(ccx, fn_abis) {
357+
let cc = match llvm_calling_convention(ccx, fn_abi) {
358358
Some(cc) => cc,
359359
None => {
360360
// FIXME(#8357) We really ought to report a span here
361361
ccx.sess().fatal(
362362
format!("ABI string `{}` has no suitable ABI \
363363
for target architecture",
364-
fn_abis.user_string(ccx.tcx())));
364+
fn_abi.user_string(ccx.tcx())));
365365
}
366366
};
367367

@@ -435,9 +435,9 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) {
435435
for &foreign_item in foreign_mod.items.iter() {
436436
match foreign_item.node {
437437
ast::ForeignItemFn(..) => {
438-
let abis = foreign_mod.abis;
439-
if !(abis.is_rust() || abis.is_intrinsic()) {
440-
register_foreign_item_fn(ccx, abis, foreign_item);
438+
match foreign_mod.abi {
439+
Rust | RustIntrinsic => {}
440+
abi => { register_foreign_item_fn(ccx, abi, foreign_item); }
441441
}
442442
}
443443
_ => {}
@@ -486,7 +486,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
486486
let t = ty::node_id_to_type(ccx.tcx(), node_id);
487487
let (cconv, output) = match ty::get(t).sty {
488488
ty::ty_bare_fn(ref fn_ty) => {
489-
let c = llvm_calling_convention(ccx, fn_ty.abis);
489+
let c = llvm_calling_convention(ccx, fn_ty.abi);
490490
(c.unwrap_or(lib::llvm::CCallConv), fn_ty.sig.output)
491491
}
492492
_ => fail!("expected bare fn in register_rust_fn_with_foreign_abi")
@@ -534,7 +534,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
534534
// normal Rust function. This will be the type of the wrappee fn.
535535
let f = match ty::get(t).sty {
536536
ty::ty_bare_fn(ref f) => {
537-
assert!(!f.abis.is_rust() && !f.abis.is_intrinsic());
537+
assert!(f.abi != Rust && f.abi != RustIntrinsic);
538538
f
539539
}
540540
_ => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use util::common::indenter;
3434
use util::ppaux::Repr;
3535

3636
use std::c_str::ToCStr;
37+
use syntax::abi::Rust;
3738
use syntax::parse::token;
3839
use syntax::{ast, ast_map, visit};
3940

@@ -393,7 +394,7 @@ pub fn trans_trait_callee_from_llval<'a>(bcx: &'a Block<'a>,
393394
debug!("(translating trait callee) loading method");
394395
// Replace the self type (&Self or ~Self) with an opaque pointer.
395396
let llcallee_ty = match ty::get(callee_ty).sty {
396-
ty::ty_bare_fn(ref f) if f.abis.is_rust() => {
397+
ty::ty_bare_fn(ref f) if f.abi == Rust => {
397398
type_of_rust_fn(ccx, true, f.sig.inputs.slice_from(1), f.sig.output)
398399
}
399400
_ => {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use middle::ty;
2323
use middle::typeck;
2424
use util::ppaux::Repr;
2525

26+
use syntax::abi;
2627
use syntax::ast;
2728
use syntax::ast_map;
2829
use syntax::ast_util::local_def;
@@ -99,7 +100,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
99100

100101
match map_node {
101102
ast_map::NodeForeignItem(_) => {
102-
if !ccx.tcx.map.get_foreign_abis(fn_id.node).is_intrinsic() {
103+
if ccx.tcx.map.get_foreign_abi(fn_id.node) != abi::RustIntrinsic {
103104
// Foreign externs don't have to be monomorphized.
104105
return (get_item_val(ccx, fn_id.node), true);
105106
}
@@ -150,7 +151,7 @@ pub fn monomorphic_fn(ccx: &CrateContext,
150151

151152
let f = match ty::get(mono_ty).sty {
152153
ty::ty_bare_fn(ref f) => {
153-
assert!(f.abis.is_rust() || f.abis.is_intrinsic());
154+
assert!(f.abi == abi::Rust || f.abi == abi::RustIntrinsic);
154155
f
155156
}
156157
_ => fail!("expected bare rust fn or an intrinsic")

0 commit comments

Comments
 (0)