Skip to content

Rollup of 10 pull requests #26844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Jul 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f9de964
msvc: Enable landing pads by default
alexcrichton Jun 29, 2015
91c22b6
msvc: Lookup linker in windows registry
alexcrichton Jun 30, 2015
ae0eb67
msvc: Fix TLS destructors
alexcrichton Jun 30, 2015
407fb29
msvc: Ignore extern-pass-empty on MSVC
alexcrichton Jun 30, 2015
18c39e1
msvc: Fix the link name for the lgamma
alexcrichton Jun 30, 2015
83ee47b
windows: Don't link rust_builtin
alexcrichton Jul 1, 2015
3e26e56
rustc_trans: Disable landing pads on 32-bit MSVC
alexcrichton Jun 30, 2015
f2fc920
liblibc: correct Linux ioctl request type
emberian Jul 5, 2015
0e714c1
rustc_trans: always use normalizing_infer_ctxt.
eddyb Jul 5, 2015
03afbf9
book: introduce `//!` doc comment in comments section
liigo Jul 6, 2015
106f382
lower blanket unsafe block to actual cases of unsafe and adjust indents
Jul 3, 2015
155c8f9
Simplify
tamird May 29, 2015
158fcbb
`llconfig` is `llvm-config`
tamird May 29, 2015
1491a8f
Remove unused variable
tamird May 30, 2015
7b78538
Auto merge of #26820 - liigo:patch-2, r=steveklabnik
bors Jul 6, 2015
78761d6
don't use type_parameter_def during astconv
Jul 6, 2015
8cb1faa
Link to test suite information from CONTRIBUTING.md
steveklabnik Jul 6, 2015
20f421c
Auto merge of #26822 - tamird:llvm-config, r=alexcrichton
bors Jul 6, 2015
fb6eeb6
Document _ in bindings
steveklabnik Jul 6, 2015
943b014
Auto merge of #26824 - arielb1:fix-26812, r=eddyb
bors Jul 6, 2015
555b021
rustc_driver: Print stage info in --version --verbose
richo Jun 26, 2015
2ceaa77
Auto merge of #26741 - alexcrichton:noinline-destructors, r=brson
bors Jul 6, 2015
ee43c5e
FFI panic is UB
steveklabnik Jul 3, 2015
c2f4f11
reference: do not display the extra space
tshepang Jul 6, 2015
dd78ffe
reference: make 'Move and copied types' section more simple
tshepang Jul 6, 2015
e66ac43
rustc_driver: Omit stage info for stage2+
richo Jul 6, 2015
720da31
Add note about special make targets
steveklabnik Jul 6, 2015
9d9e267
Auto merge of #26757 - oli-obk:style_fixes, r=brson
bors Jul 6, 2015
b959f25
Rollup merge of #26599 - richo:richo-stage-info, r=brson
steveklabnik Jul 6, 2015
aef38ef
Rollup merge of #26761 - steveklabnik:actually_ub, r=alexcrichton
steveklabnik Jul 6, 2015
539cc55
Rollup merge of #26807 - eddyb:trans-normalize, r=cmr
steveklabnik Jul 6, 2015
58d0f28
Rollup merge of #26809 - cmr:libc-ioctl, r=alexcrichton
steveklabnik Jul 6, 2015
29aabcc
Rollup merge of #26825 - steveklabnik:gh24802, r=alexcrichton
steveklabnik Jul 6, 2015
015441b
Rollup merge of #26827 - steveklabnik:gh25786, r=alexcrichton
steveklabnik Jul 6, 2015
3e62e20
Rollup merge of #26828 - steveklabnik:gh25765, r=bluss
steveklabnik Jul 6, 2015
8d94bbf
Rollup merge of #26832 - steveklabnik:doc_rustc_cycle_time, r=huonw
steveklabnik Jul 6, 2015
c4ee2e5
Rollup merge of #26834 - tshepang:space, r=brson
steveklabnik Jul 6, 2015
04a85c5
Rollup merge of #26835 - tshepang:copy-or-not, r=steveklabnik
steveklabnik Jul 6, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ feature. We use the 'fork and pull' model described there.

Please make pull requests against the `master` branch.

Compiling all of `make check` can take a while. When testing your pull request,
consider using one of the more specialized `make` targets to cut down on the
amount of time you have to wait. You need to have built the compiler at least
once before running these will work, but that’s only one full build rather than
one each time.

$ make -j8 rustc-stage1 && make check-stage1

is one such example, which builds just `rustc`, and then runs the tests. If
you’re adding something to the standard library, try

$ make -j8 check-stage1-std NO_REBUILD=1

This will not rebuild the compiler, but will run the tests.

All pull requests are reviewed by another person. We have a bot,
@rust-highfive, that will automatically assign a random person to review your
request.
Expand All @@ -108,6 +123,10 @@ will run all the tests on every platform we support. If it all works out,

[merge-queue]: http://buildbot.rust-lang.org/homu/queue/rust

Speaking of tests, Rust has a comprehensive test suite. More information about
it can be found
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).

## Writing Documentation

Documentation improvements are very welcome. The source of `doc.rust-lang.org`
Expand Down
1 change: 0 additions & 1 deletion mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
ifeq ($$(findstring freebsd,$(1)),freebsd)
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
Expand Down
10 changes: 4 additions & 6 deletions mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,9 @@ endef

$(foreach host,$(CFG_HOST), \
$(foreach target,$(CFG_TARGET), \
$(foreach stage,$(STAGES), \
$(foreach crate,$(CRATES), \
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,$(stage),$(target),$(host),$(crate)))))))
$(foreach crate,$(CRATES), \
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
$(foreach host,$(CFG_HOST), \
$(foreach target,$(CFG_TARGET), \
$(foreach stage,$(STAGES), \
$(foreach tool,$(TOOLS), \
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,$(stage),$(target),$(host),$(tool)))))))
$(foreach tool,$(TOOLS), \
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))
6 changes: 2 additions & 4 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2515,9 +2515,8 @@ Here are some examples:
#### Moved and copied types

When a [local variable](#variables) is used as an
[rvalue](#lvalues,-rvalues-and-temporaries) the variable will either be moved
or copied, depending on its type. All values whose type implements `Copy` are
copied, all others are moved.
[rvalue](#lvalues,-rvalues-and-temporaries), the variable will be copied
if its type implements `Copy`. All others are moved.

### Literal expressions

Expand Down Expand Up @@ -2882,7 +2881,6 @@ operand.
```
# let mut x = 0;
# let y = 0;

x = y;
```

Expand Down
11 changes: 11 additions & 0 deletions src/doc/trpl/comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ fn add_one(x: i32) -> i32 {
}
```

There is another style of doc comment, `//!`, to comment containing items (e.g.
crates, modules or functions), instead of the items following it. Commonly used
inside crates root (lib.rs) or modules root (mod.rs):

```
//! # The Rust Standard Library
//!
//! The Rust Standard Library provides the essential runtime
//! functionality for building portable Rust software.
```

When writing doc comments, providing some examples of usage is very, very
helpful. You’ll notice we’ve used a new macro here: `assert_eq!`. This compares
two values, and `panic!`s if they’re not equal to each other. It’s very helpful
Expand Down
17 changes: 4 additions & 13 deletions src/doc/trpl/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,10 @@ attribute turns off Rust's name mangling, so that it is easier to link to.

# FFI and panics

It’s important to be mindful of `panic!`s when working with FFI. This code,
when called from C, will `abort`:

```rust
#[no_mangle]
pub extern fn oh_no() -> ! {
panic!("Oops!");
}
# fn main() {}
```

If you’re writing code that may panic, you should run it in another thread,
so that the panic doesn’t bubble up to C:
It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
across an FFI boundary is undefined behavior. If you’re writing code that may
panic, you should run it in another thread, so that the panic doesn’t bubble up
to C:

```rust
use std::thread;
Expand Down
32 changes: 32 additions & 0 deletions src/doc/trpl/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,38 @@ This ‘destructuring’ behavior works on any compound data type, like
[tuples]: primitive-types.html#tuples
[enums]: enums.html

# Ignoring bindings

You can use `_` in a pattern to disregard the value. For example, here’s a
`match` against a `Result<T, E>`:

```rust
# let some_value: Result<i32, &'static str> = Err("There was an error");
match some_value {
Ok(value) => println!("got a value: {}", value),
Err(_) => println!("an error occurred"),
}
```

In the first arm, we bind the value inside the `Ok` variant to `value`. But
in the `Err` arm, we use `_` to disregard the specific error, and just print
a general error message.

`_` is valid in any pattern that creates a binding. This can be useful to
ignore parts of a larger structure:

```rust
fn coordinate() -> (i32, i32, i32) {
// generate and return some sort of triple tuple
# (1, 2, 3)
}

let (x, _, z) = coordinate();
```

Here, we bind the first and last element of the tuple to `x` and `z`, but
ignore the middle element.

# Mix and Match

Whew! That’s a lot of different ways to match things, and they can all be
Expand Down
13 changes: 6 additions & 7 deletions src/etc/mklldeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

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

components = sys.argv[2].split(' ')
components = [i for i in components if i] # ignore extra whitespaces
components = sys.argv[2].split() # splits on whitespace
enable_static = sys.argv[3]
llconfig = sys.argv[4]
llvm_config = sys.argv[4]

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

if err:
print("failed to run llconfig: args = `{}`".format(args))
print("failed to run llvm_config: args = `{}`".format(args))
print(err)
sys.exit(1)
return out

f.write("\n")

# LLVM libs
args = [llconfig, '--libs', '--system-libs']
args = [llvm_config, '--libs', '--system-libs']

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

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

# C++ runtime library
out = run([llconfig, '--cxxflags'])
out = run([llvm_config, '--cxxflags'])
if enable_static == '1':
assert('stdlib=libc++' not in out)
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")
Expand Down
6 changes: 3 additions & 3 deletions src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6128,7 +6128,7 @@ pub mod funcs {
use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t};

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

extern {
#[cfg(not(all(target_os = "android", target_arch = "aarch64")))]
pub fn getdtablesize() -> c_int;
pub fn ioctl(d: c_int, request: c_int, ...) -> c_int;
pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int;
pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
-> c_int;
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
Expand Down
14 changes: 14 additions & 0 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,17 @@ pub fn commit_date_str() -> Option<&'static str> {
option_env!("CFG_VER_DATE")
}

/// Returns a stage string, such as "stage0".
pub fn stage_str() -> Option<&'static str> {
if cfg!(stage0) {
Some("stage0")
} else if cfg!(stage1) {
Some("stage1")
} else {
None
}
}

/// Prints version information
pub fn version(binary: &str, matches: &getopts::Matches) {
let verbose = matches.opt_present("verbose");
Expand All @@ -493,6 +504,9 @@ pub fn version(binary: &str, matches: &getopts::Matches) {
println!("commit-date: {}", unw(commit_date_str()));
println!("host: {}", config::host_triple());
println!("release: {}", unw(release_str()));
if let Some(stage) = stage_str() {
println!("stage: {}", stage);
}
}
}

Expand Down
16 changes: 10 additions & 6 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::archive::{Archive, ArchiveBuilder, ArchiveConfig, METADATA_FILENAME};
use super::linker::{Linker, GnuLinker, MsvcLinker};
use super::rpath::RPathConfig;
use super::rpath;
use super::msvc;
use super::svh::Svh;
use session::config;
use session::config::NoDebugInfo;
Expand Down Expand Up @@ -358,10 +359,14 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
mangle(path.chain(Some(gensym_name(flav))), None)
}

pub fn get_cc_prog(sess: &Session) -> String {
match sess.opts.cg.linker {
Some(ref linker) => return linker.to_string(),
None => sess.target.target.options.linker.clone(),
pub fn get_linker(sess: &Session) -> (String, Command) {
if let Some(ref linker) = sess.opts.cg.linker {
(linker.clone(), Command::new(linker))
} else if sess.target.target.options.is_like_msvc {
("link.exe".to_string(), msvc::link_exe_cmd(sess))
} else {
(sess.target.target.options.linker.clone(),
Command::new(&sess.target.target.options.linker))
}
}

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

// The invocations of cc share some flags across platforms
let pname = get_cc_prog(sess);
let mut cmd = Command::new(&pname);
let (pname, mut cmd) = get_linker(sess);
cmd.env("PATH", command_path(sess));

let root = sess.target_filesearch(PathKind::Native).get_lib_path();
Expand Down
Loading