Skip to content

Commit f8915fa

Browse files
committed
---
yaml --- r: 91589 b: refs/heads/auto c: 2fcc70e h: refs/heads/master i: 91587: e4ca266 v: v3
1 parent b210501 commit f8915fa

File tree

156 files changed

+4085
-5771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+4085
-5771
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 8379890c05b20e97fcc73c1865b8b3787caecc9f
16+
refs/heads/auto: 2fcc70ec9d2f73b61285283aeb4abce4a4e84901
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/Makefile.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ ifdef TRACE
125125
CFG_RUSTC_FLAGS += -Z trace
126126
endif
127127
ifndef DEBUG_BORROWS
128-
RUSTFLAGS_STAGE0 += -Z no-debug-borrows
129128
RUSTFLAGS_STAGE1 += -Z no-debug-borrows
130129
RUSTFLAGS_STAGE2 += -Z no-debug-borrows
131130
endif

branches/auto/doc/tutorial-ffi.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,32 @@ calling foreign functions. Some foreign functions, most notably the Windows API,
418418
conventions. Rust provides a way to tell the compiler which convention to use:
419419

420420
~~~~
421-
#[cfg(target_os = "win32")]
421+
#[cfg(target_os = "win32", target_arch = "x86")]
422422
#[link_name = "kernel32"]
423423
extern "stdcall" {
424424
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> int;
425425
}
426426
~~~~
427427

428-
This applies to the entire `extern` block, and must be either `"cdecl"` or
429-
`"stdcall"`. The compiler may eventually support other calling conventions.
428+
This applies to the entire `extern` block. The list of supported ABI constraints
429+
are:
430+
431+
* `stdcall`
432+
* `aapcs`
433+
* `cdecl`
434+
* `fastcall`
435+
* `Rust`
436+
* `rust-intrinsic`
437+
* `system`
438+
* `C`
439+
440+
Most of the abis in this list are self-explanatory, but the `system` abi may
441+
seem a little odd. This constraint selects whatever the appropriate ABI is for
442+
interoperating with the target's libraries. For example, on win32 with a x86
443+
architecture, this means that the abi used would be `stdcall`. On x86_64,
444+
however, windows uses the `C` calling convention, so `C` would be used. This
445+
means that in our previous example, we could have used `extern "system" { ... }`
446+
to define a block for all windows systems, not just x86 ones.
430447

431448
# Interoperability with foreign code
432449

branches/auto/src/libextra/arc.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ impl<T:Send> MutexArc<T> {
233233

234234
/// As unsafe_access(), but with a condvar, as sync::mutex.lock_cond().
235235
#[inline]
236-
pub unsafe fn unsafe_access_cond<U>(&self,
237-
blk: &fn(x: &mut T,
238-
c: &Condvar) -> U)
239-
-> U {
236+
pub unsafe fn unsafe_access_cond<'x, 'c, U>(&self,
237+
blk: &fn(x: &'x mut T,
238+
c: &'c Condvar) -> U)
239+
-> U {
240240
let state = self.x.get();
241241
do (&(*state).lock).lock_cond |cond| {
242242
check_poison(true, (*state).failed);
@@ -290,10 +290,10 @@ impl<T:Freeze + Send> MutexArc<T> {
290290

291291
/// As unsafe_access_cond but safe and Freeze.
292292
#[inline]
293-
pub fn access_cond<U>(&self,
294-
blk: &fn(x: &mut T,
295-
c: &Condvar) -> U)
296-
-> U {
293+
pub fn access_cond<'x, 'c, U>(&self,
294+
blk: &fn(x: &'x mut T,
295+
c: &'c Condvar) -> U)
296+
-> U {
297297
unsafe { self.unsafe_access_cond(blk) }
298298
}
299299
}
@@ -402,9 +402,9 @@ impl<T:Freeze + Send> RWArc<T> {
402402

403403
/// As write(), but with a condvar, as sync::rwlock.write_cond().
404404
#[inline]
405-
pub fn write_cond<U>(&self,
406-
blk: &fn(x: &mut T, c: &Condvar) -> U)
407-
-> U {
405+
pub fn write_cond<'x, 'c, U>(&self,
406+
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
407+
-> U {
408408
unsafe {
409409
let state = self.x.get();
410410
do (*borrow_rwlock(state)).write_cond |cond| {
@@ -554,9 +554,9 @@ impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {
554554
}
555555

556556
/// Access the pre-downgrade RWArc in write mode with a condvar.
557-
pub fn write_cond<U>(&mut self,
558-
blk: &fn(x: &mut T, c: &Condvar) -> U)
559-
-> U {
557+
pub fn write_cond<'x, 'c, U>(&mut self,
558+
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
559+
-> U {
560560
match *self {
561561
RWWriteMode {
562562
data: &ref mut data,

branches/auto/src/libextra/getopts.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,18 @@ impl Name {
185185
}
186186

187187
impl Matches {
188-
fn opt_vals(&self, nm: &str) -> ~[Optval] {
188+
/// FIXME: #9311 This used to be private, but rustpkg somehow managed to depend on it.
189+
/// No idea what this does.
190+
pub fn opt_vals(&self, nm: &str) -> ~[Optval] {
189191
match find_opt(self.opts, Name::from_str(nm)) {
190192
Some(id) => self.vals[id].clone(),
191193
None => fail!("No option '{}' defined", nm)
192194
}
193195
}
194196

195-
fn opt_val(&self, nm: &str) -> Option<Optval> {
197+
/// FIXME: #9311 This used to be private, but rustpkg somehow managed to depend on it.
198+
/// No idea what this does.
199+
pub fn opt_val(&self, nm: &str) -> Option<Optval> {
196200
let vals = self.opt_vals(nm);
197201
if (vals.is_empty()) {
198202
None

branches/auto/src/libextra/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Rust extras are part of the standard Rust distribution.
2121
*/
2222

2323
#[link(name = "extra",
24-
package_id = "extra",
2524
vers = "0.9-pre",
2625
uuid = "122bed0b-c19b-4b82-b0b7-7ae8aead7297",
2726
url = "https://github.com/mozilla/rust/tree/master/src/libextra")];

branches/auto/src/librustc/back/arm.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,49 @@
1010

1111
use back::target_strs;
1212
use driver::session::sess_os_to_meta_os;
13-
use driver::session;
1413
use metadata::loader::meta_section_name;
14+
use syntax::abi;
1515

16-
pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t {
16+
pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::t {
1717
return target_strs::t {
1818
module_asm: ~"",
1919

2020
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(),
2121

2222
data_layout: match target_os {
23-
session::OsMacos => {
23+
abi::OsMacos => {
2424
~"e-p:32:32:32" +
2525
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
2626
"-f32:32:32-f64:64:64" +
2727
"-v64:64:64-v128:64:128" +
2828
"-a0:0:64-n32"
2929
}
3030

31-
session::OsWin32 => {
31+
abi::OsWin32 => {
3232
~"e-p:32:32:32" +
3333
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
3434
"-f32:32:32-f64:64:64" +
3535
"-v64:64:64-v128:64:128" +
3636
"-a0:0:64-n32"
3737
}
3838

39-
session::OsLinux => {
39+
abi::OsLinux => {
4040
~"e-p:32:32:32" +
4141
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
4242
"-f32:32:32-f64:64:64" +
4343
"-v64:64:64-v128:64:128" +
4444
"-a0:0:64-n32"
4545
}
4646

47-
session::OsAndroid => {
47+
abi::OsAndroid => {
4848
~"e-p:32:32:32" +
4949
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
5050
"-f32:32:32-f64:64:64" +
5151
"-v64:64:64-v128:64:128" +
5252
"-a0:0:64-n32"
5353
}
5454

55-
session::OsFreebsd => {
55+
abi::OsFreebsd => {
5656
~"e-p:32:32:32" +
5757
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
5858
"-f32:32:32-f64:64:64" +

branches/auto/src/librustc/back/link.rs

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use std::run;
3232
use std::str;
3333
use std::vec;
3434
use std::rt::io::fs;
35+
use syntax::abi;
3536
use syntax::ast;
3637
use syntax::ast_map::{path, path_mod, path_name, path_pretty_name};
3738
use syntax::attr;
@@ -634,18 +635,6 @@ pub fn build_link_meta(sess: Session,
634635
}
635636
}
636637

637-
fn crate_meta_pkgid(sess: Session, name: @str, opt_pkg_id: Option<@str>)
638-
-> @str {
639-
match opt_pkg_id {
640-
Some(v) if !v.is_empty() => v,
641-
_ => {
642-
let pkg_id = name.clone();
643-
warn_missing(sess, "package_id", pkg_id);
644-
pkg_id
645-
}
646-
}
647-
}
648-
649638
let ProvidedMetas {
650639
name: opt_name,
651640
vers: opt_vers,
@@ -654,16 +643,15 @@ pub fn build_link_meta(sess: Session,
654643
} = provided_link_metas(sess, c);
655644
let name = crate_meta_name(sess, output, opt_name);
656645
let vers = crate_meta_vers(sess, opt_vers);
657-
let pkg_id = crate_meta_pkgid(sess, name, opt_pkg_id);
658646
let dep_hashes = cstore::get_dep_hashes(sess.cstore);
659647
let extras_hash =
660648
crate_meta_extras_hash(symbol_hasher, cmh_items,
661-
dep_hashes, Some(pkg_id));
649+
dep_hashes, opt_pkg_id);
662650

663651
LinkMeta {
664652
name: name,
665653
vers: vers,
666-
package_id: Some(pkg_id),
654+
package_id: opt_pkg_id,
667655
extras_hash: extras_hash
668656
}
669657
}
@@ -877,13 +865,13 @@ pub fn mangle_internal_name_by_path(ccx: &mut CrateContext, path: path) -> ~str
877865
}
878866

879867

880-
pub fn output_dll_filename(os: session::Os, lm: LinkMeta) -> ~str {
868+
pub fn output_dll_filename(os: abi::Os, lm: LinkMeta) -> ~str {
881869
let (dll_prefix, dll_suffix) = match os {
882-
session::OsWin32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
883-
session::OsMacos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
884-
session::OsLinux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
885-
session::OsAndroid => (android::DLL_PREFIX, android::DLL_SUFFIX),
886-
session::OsFreebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
870+
abi::OsWin32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
871+
abi::OsMacos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
872+
abi::OsLinux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
873+
abi::OsAndroid => (android::DLL_PREFIX, android::DLL_SUFFIX),
874+
abi::OsFreebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
887875
};
888876
format!("{}{}-{}-{}{}", dll_prefix, lm.name, lm.extras_hash, lm.vers, dll_suffix)
889877
}
@@ -898,7 +886,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
898886
match sess.opts.linker {
899887
Some(ref linker) => linker.to_str(),
900888
None => match sess.targ_cfg.os {
901-
session::OsAndroid =>
889+
abi::OsAndroid =>
902890
match &sess.opts.android_cross_path {
903891
&Some(ref path) => {
904892
format!("{}/bin/arm-linux-androideabi-gcc", *path)
@@ -908,7 +896,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
908896
(--android-cross-path)")
909897
}
910898
},
911-
session::OsWin32 => ~"g++",
899+
abi::OsWin32 => ~"g++",
912900
_ => ~"cc"
913901
}
914902
}
@@ -956,7 +944,7 @@ pub fn link_binary(sess: Session,
956944
}
957945

958946
// Clean up on Darwin
959-
if sess.targ_cfg.os == session::OsMacos {
947+
if sess.targ_cfg.os == abi::OsMacos {
960948
// FIXME (#9639): This needs to handle non-utf8 paths
961949
run::process_status("dsymutil", [output.as_str().unwrap().to_owned()]);
962950
}
@@ -985,7 +973,7 @@ pub fn link_args(sess: Session,
985973
// Converts a library file-stem into a cc -l argument
986974
fn unlib(config: @session::config, stem: ~str) -> ~str {
987975
if stem.starts_with("lib") &&
988-
config.os != session::OsWin32 {
976+
config.os != abi::OsWin32 {
989977
stem.slice(3, stem.len()).to_owned()
990978
} else {
991979
stem
@@ -1029,7 +1017,7 @@ pub fn link_args(sess: Session,
10291017
obj_filename.as_str().unwrap().to_owned()]);
10301018

10311019
let lib_cmd = match sess.targ_cfg.os {
1032-
session::OsMacos => ~"-dynamiclib",
1020+
abi::OsMacos => ~"-dynamiclib",
10331021
_ => ~"-shared"
10341022
};
10351023

@@ -1080,7 +1068,7 @@ pub fn link_args(sess: Session,
10801068

10811069
// On mac we need to tell the linker to let this library
10821070
// be rpathed
1083-
if sess.targ_cfg.os == session::OsMacos {
1071+
if sess.targ_cfg.os == abi::OsMacos {
10841072
// FIXME (#9639): This needs to handle non-utf8 paths
10851073
args.push("-Wl,-install_name,@rpath/"
10861074
+ output.filename_str().unwrap());
@@ -1089,20 +1077,20 @@ pub fn link_args(sess: Session,
10891077

10901078
// On linux librt and libdl are an indirect dependencies via rustrt,
10911079
// and binutils 2.22+ won't add them automatically
1092-
if sess.targ_cfg.os == session::OsLinux {
1080+
if sess.targ_cfg.os == abi::OsLinux {
10931081
args.push_all([~"-lrt", ~"-ldl"]);
10941082

10951083
// LLVM implements the `frem` instruction as a call to `fmod`,
10961084
// which lives in libm. Similar to above, on some linuxes we
10971085
// have to be explicit about linking to it. See #2510
10981086
args.push(~"-lm");
10991087
}
1100-
else if sess.targ_cfg.os == session::OsAndroid {
1088+
else if sess.targ_cfg.os == abi::OsAndroid {
11011089
args.push_all([~"-ldl", ~"-llog", ~"-lsupc++", ~"-lgnustl_shared"]);
11021090
args.push(~"-lm");
11031091
}
11041092

1105-
if sess.targ_cfg.os == session::OsFreebsd {
1093+
if sess.targ_cfg.os == abi::OsFreebsd {
11061094
args.push_all([~"-pthread", ~"-lrt",
11071095
~"-L/usr/local/lib", ~"-lexecinfo",
11081096
~"-L/usr/local/lib/gcc46",

branches/auto/src/librustc/back/mips.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,50 @@
99
// except according to those terms.
1010

1111
use back::target_strs;
12-
use driver::session;
1312
use driver::session::sess_os_to_meta_os;
1413
use metadata::loader::meta_section_name;
14+
use syntax::abi;
1515

16-
pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t {
16+
pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::t {
1717
return target_strs::t {
1818
module_asm: ~"",
1919

2020
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(),
2121

2222
data_layout: match target_os {
23-
session::OsMacos => {
23+
abi::OsMacos => {
2424
~"e-p:32:32:32" +
2525
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
2626
"-f32:32:32-f64:64:64" +
2727
"-v64:64:64-v128:64:128" +
2828
"-a0:0:64-n32"
2929
}
3030

31-
session::OsWin32 => {
31+
abi::OsWin32 => {
3232
~"e-p:32:32:32" +
3333
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
3434
"-f32:32:32-f64:64:64" +
3535
"-v64:64:64-v128:64:128" +
3636
"-a0:0:64-n32"
3737
}
3838

39-
session::OsLinux => {
39+
abi::OsLinux => {
4040
~"e-p:32:32:32" +
4141
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
4242
"-f32:32:32-f64:64:64" +
4343
"-v64:64:64-v128:64:128" +
4444
"-a0:0:64-n32"
4545
}
4646

47-
session::OsAndroid => {
47+
abi::OsAndroid => {
4848
~"e-p:32:32:32" +
4949
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
5050
"-f32:32:32-f64:64:64" +
5151
"-v64:64:64-v128:64:128" +
5252
"-a0:0:64-n32"
5353
}
5454

55-
session::OsFreebsd => {
55+
abi::OsFreebsd => {
5656
~"e-p:32:32:32" +
5757
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
5858
"-f32:32:32-f64:64:64" +

0 commit comments

Comments
 (0)