Skip to content

Commit 5633498

Browse files
committed
---
yaml --- r: 218159 b: refs/heads/tmp c: 29aabcc h: refs/heads/master i: 218157: 1c6719b 218155: a0876fe 218151: afe7018 218143: cfdf242 v: v3
1 parent a8884dd commit 5633498

File tree

31 files changed

+936
-429
lines changed

31 files changed

+936
-429
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: 18adf6230e2e229d4d73391cebff060afc5e5aaa
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 8cb1faaa907395d9bcf81919d7e94f3b7560dccf
28+
refs/heads/tmp: 29aabcc7c4f43ccd2b032d1764f3052666487504
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: e6596d0052e79e6393bbee3538bb122930d89887
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/mk/main.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
295295
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
296296
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
297297
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
298-
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
299298
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
300299
ifeq ($$(findstring freebsd,$(1)),freebsd)
301300
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),

branches/tmp/mk/target.mk

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,9 @@ endef
249249

250250
$(foreach host,$(CFG_HOST), \
251251
$(foreach target,$(CFG_TARGET), \
252-
$(foreach stage,$(STAGES), \
253-
$(foreach crate,$(CRATES), \
254-
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,$(stage),$(target),$(host),$(crate)))))))
252+
$(foreach crate,$(CRATES), \
253+
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
255254
$(foreach host,$(CFG_HOST), \
256255
$(foreach target,$(CFG_TARGET), \
257-
$(foreach stage,$(STAGES), \
258-
$(foreach tool,$(TOOLS), \
259-
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,$(stage),$(target),$(host),$(tool)))))))
256+
$(foreach tool,$(TOOLS), \
257+
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))

branches/tmp/src/doc/trpl/comments.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ fn add_one(x: i32) -> i32 {
3838
}
3939
```
4040

41+
There is another style of doc comment, `//!`, to comment containing items (e.g.
42+
crates, modules or functions), instead of the items following it. Commonly used
43+
inside crates root (lib.rs) or modules root (mod.rs):
44+
45+
```
46+
//! # The Rust Standard Library
47+
//!
48+
//! The Rust Standard Library provides the essential runtime
49+
//! functionality for building portable Rust software.
50+
```
51+
4152
When writing doc comments, providing some examples of usage is very, very
4253
helpful. You’ll notice we’ve used a new macro here: `assert_eq!`. This compares
4354
two values, and `panic!`s if they’re not equal to each other. It’s very helpful

branches/tmp/src/doc/trpl/ffi.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,10 @@ attribute turns off Rust's name mangling, so that it is easier to link to.
533533

534534
# FFI and panics
535535

536-
It’s important to be mindful of `panic!`s when working with FFI. This code,
537-
when called from C, will `abort`:
538-
539-
```rust
540-
#[no_mangle]
541-
pub extern fn oh_no() -> ! {
542-
panic!("Oops!");
543-
}
544-
# fn main() {}
545-
```
546-
547-
If you’re writing code that may panic, you should run it in another thread,
548-
so that the panic doesn’t bubble up to C:
536+
It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
537+
across an FFI boundary is undefined behavior. If you’re writing code that may
538+
panic, you should run it in another thread, so that the panic doesn’t bubble up
539+
to C:
549540

550541
```rust
551542
use std::thread;

branches/tmp/src/etc/mklldeps.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
f = open(sys.argv[1], 'wb')
1616

17-
components = sys.argv[2].split(' ')
18-
components = [i for i in components if i] # ignore extra whitespaces
17+
components = sys.argv[2].split() # splits on whitespace
1918
enable_static = sys.argv[3]
20-
llconfig = sys.argv[4]
19+
llvm_config = sys.argv[4]
2120

2221
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2322
// file at the top-level directory of this distribution and at
@@ -39,15 +38,15 @@ def run(args):
3938
out, err = proc.communicate()
4039

4140
if err:
42-
print("failed to run llconfig: args = `{}`".format(args))
41+
print("failed to run llvm_config: args = `{}`".format(args))
4342
print(err)
4443
sys.exit(1)
4544
return out
4645

4746
f.write("\n")
4847

4948
# LLVM libs
50-
args = [llconfig, '--libs', '--system-libs']
49+
args = [llvm_config, '--libs', '--system-libs']
5150

5251
args.extend(components)
5352
out = run(args)
@@ -69,13 +68,13 @@ def run(args):
6968
f.write(")]\n")
7069

7170
# LLVM ldflags
72-
out = run([llconfig, '--ldflags'])
71+
out = run([llvm_config, '--ldflags'])
7372
for lib in out.strip().split(' '):
7473
if lib[:2] == "-l":
7574
f.write("#[link(name = \"" + lib[2:] + "\")]\n")
7675

7776
# C++ runtime library
78-
out = run([llconfig, '--cxxflags'])
77+
out = run([llvm_config, '--cxxflags'])
7978
if enable_static == '1':
8079
assert('stdlib=libc++' not in out)
8180
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")

branches/tmp/src/liblibc/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6128,7 +6128,7 @@ pub mod funcs {
61286128
use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t};
61296129

61306130
extern {
6131-
pub fn ioctl(d: c_int, request: c_ulong, ...) -> c_int;
6131+
pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int;
61326132
pub fn sysctl(name: *mut c_int,
61336133
namelen: c_uint,
61346134
oldp: *mut c_void,
@@ -6160,12 +6160,12 @@ pub mod funcs {
61606160
#[cfg(any(target_os = "linux", target_os = "android"))]
61616161
pub mod bsd44 {
61626162
use types::common::c95::{c_void};
6163-
use types::os::arch::c95::{c_uchar, c_int, size_t};
6163+
use types::os::arch::c95::{c_uchar, c_int, c_ulong, size_t};
61646164

61656165
extern {
61666166
#[cfg(not(all(target_os = "android", target_arch = "aarch64")))]
61676167
pub fn getdtablesize() -> c_int;
6168-
pub fn ioctl(d: c_int, request: c_int, ...) -> c_int;
6168+
pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int;
61696169
pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
61706170
-> c_int;
61716171
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)

branches/tmp/src/librustc_driver/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,17 @@ pub fn commit_date_str() -> Option<&'static str> {
481481
option_env!("CFG_VER_DATE")
482482
}
483483

484+
/// Returns a stage string, such as "stage0".
485+
pub fn stage_str() -> Option<&'static str> {
486+
if cfg!(stage0) {
487+
Some("stage0")
488+
} else if cfg!(stage1) {
489+
Some("stage1")
490+
} else {
491+
None
492+
}
493+
}
494+
484495
/// Prints version information
485496
pub fn version(binary: &str, matches: &getopts::Matches) {
486497
let verbose = matches.opt_present("verbose");
@@ -493,6 +504,9 @@ pub fn version(binary: &str, matches: &getopts::Matches) {
493504
println!("commit-date: {}", unw(commit_date_str()));
494505
println!("host: {}", config::host_triple());
495506
println!("release: {}", unw(release_str()));
507+
if let Some(stage) = stage_str() {
508+
println!("stage: {}", stage);
509+
}
496510
}
497511
}
498512

branches/tmp/src/librustc_trans/back/link.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use super::archive::{Archive, ArchiveBuilder, ArchiveConfig, METADATA_FILENAME};
1212
use super::linker::{Linker, GnuLinker, MsvcLinker};
1313
use super::rpath::RPathConfig;
1414
use super::rpath;
15+
use super::msvc;
1516
use super::svh::Svh;
1617
use session::config;
1718
use session::config::NoDebugInfo;
@@ -358,10 +359,14 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
358359
mangle(path.chain(Some(gensym_name(flav))), None)
359360
}
360361

361-
pub fn get_cc_prog(sess: &Session) -> String {
362-
match sess.opts.cg.linker {
363-
Some(ref linker) => return linker.to_string(),
364-
None => sess.target.target.options.linker.clone(),
362+
pub fn get_linker(sess: &Session) -> (String, Command) {
363+
if let Some(ref linker) = sess.opts.cg.linker {
364+
(linker.clone(), Command::new(linker))
365+
} else if sess.target.target.options.is_like_msvc {
366+
("link.exe".to_string(), msvc::link_exe_cmd(sess))
367+
} else {
368+
(sess.target.target.options.linker.clone(),
369+
Command::new(&sess.target.target.options.linker))
365370
}
366371
}
367372

@@ -807,8 +812,7 @@ fn link_natively(sess: &Session, trans: &CrateTranslation, dylib: bool,
807812
let tmpdir = TempDir::new("rustc").ok().expect("needs a temp dir");
808813

809814
// The invocations of cc share some flags across platforms
810-
let pname = get_cc_prog(sess);
811-
let mut cmd = Command::new(&pname);
815+
let (pname, mut cmd) = get_linker(sess);
812816
cmd.env("PATH", command_path(sess));
813817

814818
let root = sess.target_filesearch(PathKind::Native).get_lib_path();

0 commit comments

Comments
 (0)