]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAuto merge of #31331 - petevine:master, r=alexcrichton
bors [Sun, 31 Jan 2016 23:06:01 +0000 (23:06 +0000)]
Auto merge of #31331 - petevine:master, r=alexcrichton

The target was meant as a modern generic `armv7` option, therefore a few changes were necessary:

- gcc's `-march=armv7` was causing compilation failures on modern linux systems
- rust codegen defaulted to `cortex-a7` causing illegal instruction crashes on previous `armv7-a` processors (e.g, cortex-a5, cortex-a8)

8 years agoFix the armv7 linux target
petevine [Sun, 31 Jan 2016 21:26:34 +0000 (22:26 +0100)]
Fix the armv7 linux target

8 years agoAuto merge of #31298 - japaric:mips-musl, r=alexcrichton
bors [Sun, 31 Jan 2016 12:27:06 +0000 (12:27 +0000)]
Auto merge of #31298 - japaric:mips-musl, r=alexcrichton

This target covers MIPS devices that run the trunk version of OpenWRT.

The x86_64-unknown-linux-musl target always links statically to C libraries. For
the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of
other targets do) to keep binary size down.

As for the C compiler flags used in the build system, we use the same flags used
for the mips(el)-unknown-linux-gnu target.

r? @alexcrichton

8 years agoupdate libc submodule
Jorge Aparicio [Sun, 31 Jan 2016 12:18:30 +0000 (07:18 -0500)]
update libc submodule

fixes failed test (std::os::raw::tests::unix) in x86_64-musl target

8 years agoAuto merge of #31288 - GuillaumeGomez:error_code_tidy, r=brson
bors [Sat, 30 Jan 2016 20:48:18 +0000 (20:48 +0000)]
Auto merge of #31288 - GuillaumeGomez:error_code_tidy, r=brson

r? @steveklabnik

8 years agorustc: set MIPS cpu/features in the compiler
Jorge Aparicio [Sat, 30 Jan 2016 08:28:37 +0000 (03:28 -0500)]
rustc: set MIPS cpu/features in the compiler

cf #31303

8 years agorevert changes used for local testing
Jorge Aparicio [Sat, 30 Jan 2016 08:24:24 +0000 (03:24 -0500)]
revert changes used for local testing

8 years agoAuto merge of #30778 - fhahn:issue-21195-expect-help, r=nikomatsakis
bors [Sat, 30 Jan 2016 18:51:13 +0000 (18:51 +0000)]
Auto merge of #30778 - fhahn:issue-21195-expect-help, r=nikomatsakis

This is a PR for #21195. It changes the way unspecified `help` and `ǹote` messages are handled in compile-fail tests as suggested by @oli-obk in the issue: if there are some `note` or `help` annotations, there must be annotations for all `help` or `note` messages of this test. Maybe it makes also sense to add an option to specify that the this test should fail if there are unspecified `help` or `note` messages.

With this change, the following tests fail:

    [compile-fail] compile-fail/changing-crates.rs
    [compile-fail] compile-fail/default_ty_param_conflict_cross_crate.rs
    [compile-fail] compile-fail/lifetime-inference-give-expl-lifetime-param.rs
    [compile-fail] compile-fail/privacy1.rs
    [compile-fail] compile-fail/svh-change-lit.rs
    [compile-fail] compile-fail/svh-change-significant-cfg.rs
    [compile-fail] compile-fail/svh-change-trait-bound.rs
    [compile-fail] compile-fail/svh-change-type-arg.rs
    [compile-fail] compile-fail/svh-change-type-ret.rs
    [compile-fail] compile-fail/svh-change-type-static.rs
    [compile-fail] compile-fail/svh-use-trait.rs

I'll add the missing annotations if we decide to accept this change.

8 years agoAuto merge of #31286 - oli-obk:fix/mir_box, r=nagisa
bors [Sat, 30 Jan 2016 16:47:08 +0000 (16:47 +0000)]
Auto merge of #31286 - oli-obk:fix/mir_box, r=nagisa

the previous code generated a temporary of the inner type and assigned the box-memory to it. So if you did `let x: Box<usize> = box 5;` you got a

```rust
let var0: Box<usize>; // x
let mut tmp0: Box<usize>;
let mut tmp1: usize;
...
tmp1 = Box(usize);
(*tmp1) = const 5;
tmp0 = tmp1;
var0 = tmp0;
```

r? @nagisa

8 years agoAuto merge of #31274 - brson:nobench, r=nikomatsakis
bors [Sat, 30 Jan 2016 14:50:44 +0000 (14:50 +0000)]
Auto merge of #31274 - brson:nobench, r=nikomatsakis

I don't believe these test cases have served any purpose in years.

The shootout benchmarks are now upstreamed. A new benchmark suite
should rather be maintained out of tree.

r? @nikomatsakis

8 years agoMark test failing with msvc due to #31306 as ignore-msvc
Florian Hahn [Sat, 30 Jan 2016 13:27:12 +0000 (14:27 +0100)]
Mark test failing with msvc due to #31306 as ignore-msvc

8 years agoAuto merge of #31305 - Manishearth:rollup, r=Manishearth
bors [Sat, 30 Jan 2016 12:32:47 +0000 (12:32 +0000)]
Auto merge of #31305 - Manishearth:rollup, r=Manishearth

- Successful merges: #31099, #31244, #31280, #31290, #31292, #31294, #31295, #31296
- Failed merges:

8 years agoRollup merge of #31296 - steveklabnik:gh31249, r=alexcrichton
Manish Goregaokar [Sat, 30 Jan 2016 12:27:17 +0000 (17:57 +0530)]
Rollup merge of #31296 - steveklabnik:gh31249, r=alexcrichton

Rustdoc will automatically wrap things in main, but this doesn't work
here.

Fixes #31249

8 years agoRollup merge of #31295 - steveklabnik:gh31266, r=alexcrichton
Manish Goregaokar [Sat, 30 Jan 2016 12:27:17 +0000 (17:57 +0530)]
Rollup merge of #31295 - steveklabnik:gh31266, r=alexcrichton

These are free functions in the text, but methods in the standard
library.

Fixes #31266

8 years agoRollup merge of #31294 - steveklabnik:gh31284, r=alexcrichton
Manish Goregaokar [Sat, 30 Jan 2016 12:27:17 +0000 (17:57 +0530)]
Rollup merge of #31294 - steveklabnik:gh31284, r=alexcrichton

This code was refactored, but the words were not

Fixes #31284

8 years agoRollup merge of #31292 - alexcrichton:osx-dtors-in-dtors-in-dtors, r=aturon
Manish Goregaokar [Sat, 30 Jan 2016 12:27:17 +0000 (17:57 +0530)]
Rollup merge of #31292 - alexcrichton:osx-dtors-in-dtors-in-dtors, r=aturon

This test has been deadlocking and causing problems on the bots basically since
its inception. Some memory safety issues were fixed in 987dc84b, but the
deadlocks remained afterwards unfortunately.

After some investigation, I've concluded that this is just a situation where OSX
is not guaranteed to run destructors. The fix in 987dc84b observed that OSX was
rewriting the backing TLS memory to its initial state during destruction while
we weren't looking, and this would have the effect of canceling the destructors
of any other initialized TLS slots.

While very difficult to pin down, this is basically what I assume is happening
here, so there doesn't seem to really be anythig we can do to ensure the test
robustly passes on OSX, so just ignore it for now.

8 years agoRollup merge of #31290 - alexcrichton:fix-powerpc64, r=brson
Manish Goregaokar [Sat, 30 Jan 2016 12:27:16 +0000 (17:57 +0530)]
Rollup merge of #31290 - alexcrichton:fix-powerpc64, r=brson

We forgot to pass down the `-m64` flag to gcc, so we were actually compiling
powerpc code which would then later fail to link!

8 years agoRollup merge of #31280 - raindev:patch-1, r=steveklabnik
Manish Goregaokar [Sat, 30 Jan 2016 12:27:16 +0000 (17:57 +0530)]
Rollup merge of #31280 - raindev:patch-1, r=steveklabnik

Perhaps, it makes more sense to link straight to [Installing on Linux or Mac](https://doc.rust-lang.org/book/getting-started.html#installing-on-linux-or-mac) and [Installing on Windows](https://doc.rust-lang.org/book/getting-started.html#installing-on-windows) sections. Platform Support section could be skipped in case of *quick* start.

8 years agoRollup merge of #31244 - tshepang:rustfmt-parse, r=nikomatsakis
Manish Goregaokar [Sat, 30 Jan 2016 12:27:16 +0000 (17:57 +0530)]
Rollup merge of #31244 - tshepang:rustfmt-parse, r=nikomatsakis

8 years agoRollup merge of #31099 - brson:relnotes, r=alexcrichton
Manish Goregaokar [Sat, 30 Jan 2016 12:27:16 +0000 (17:57 +0530)]
Rollup merge of #31099 - brson:relnotes, r=alexcrichton

8 years agoAuto merge of #30843 - jseyfried:no_per_ns, r=nikomatsakis
bors [Sat, 30 Jan 2016 10:16:55 +0000 (10:16 +0000)]
Auto merge of #30843 - jseyfried:no_per_ns, r=nikomatsakis

This commit refactors the field `Module::children` from mapping `Name` -> `NameBindings` to mapping `(Name, Namespace)` -> `NameBinding` and refactors the field `Module::import_resolutions` from mapping `Name` -> `ImportResolutionPerNamespace` to mapping `(Name, Namespace)` -> `ImportResolution`.

This allows the duplicate checking code to be refactored so that `NameBinding` no longer needs ref-counting or a RefCell (removing the need for `NsDef`).

r? @nikomatsakis

8 years agoAuto merge of #31297 - brson:wintrip, r=alexcrichton
bors [Sat, 30 Jan 2016 07:08:38 +0000 (07:08 +0000)]
Auto merge of #31297 - brson:wintrip, r=alexcrichton

Buildbot was updated long ago to use the correct triples.

The putvar here is emitting garbage into `configure --help` so
I want it gone.

8 years agoAuto merge of #30448 - alexcrichton:llvmup, r=nikomatsakis
bors [Sat, 30 Jan 2016 00:25:44 +0000 (00:25 +0000)]
Auto merge of #30448 - alexcrichton:llvmup, r=nikomatsakis

These commits perform a few high-level changes with the goal of enabling i686 MSVC unwinding:

* LLVM is upgraded to pick up the new exception handling instructions and intrinsics for MSVC. This puts us somewhere along the 3.8 branch, but we should still be compatible with LLVM 3.7 for non-MSVC targets.
* All unwinding for MSVC targets (both 32 and 64-bit) are implemented in terms of this new LLVM support. I would like to also extend this to Windows GNU targets to drop the runtime dependencies we have on MinGW, but I'd like to land this first.
* Some tests were fixed up for i686 MSVC here and there where necessary. The full test suite should be passing now for that target.

In terms of landing this I plan to have this go through first, then verify that i686 MSVC works, then I'll enable `make check` on the bots for that target instead of just `make` as-is today.

Closes #25869

8 years agoGet tests working on MSVC 32-bit
Alex Crichton [Mon, 14 Dec 2015 23:40:43 +0000 (15:40 -0800)]
Get tests working on MSVC 32-bit

8 years agotrans: Reimplement unwinding on MSVC
Alex Crichton [Sat, 24 Oct 2015 01:18:44 +0000 (18:18 -0700)]
trans: Reimplement unwinding on MSVC

This commit transitions the compiler to using the new exception handling
instructions in LLVM for implementing unwinding for MSVC. This affects both 32
and 64-bit MSVC as they're both now using SEH-based strategies. In terms of
standard library support, lots more details about how SEH unwinding is
implemented can be found in the commits.

In terms of trans, this change necessitated a few modifications:

* Branches were added to detect when the old landingpad instruction is used or
  the new cleanuppad instruction is used to `trans::cleanup`.
* The return value from `cleanuppad` is not stored in an `alloca` (because it
  cannot be).
* Each block in trans now has an `Option<LandingPad>` instead of `is_lpad: bool`
  for indicating whether it's in a landing pad or not. The new exception
  handling intrinsics require that on MSVC each `call` inside of a landing pad
  is annotated with which landing pad that it's in. This change to the basic
  block means that whenever a `call` or `invoke` instruction is generated we
  know whether to annotate it as part of a cleanuppad or not.
* Lots of modifications were made to the instruction builders to construct the
  new instructions as well as pass the tagging information for the call/invoke
  instructions.
* The translation of the `try` intrinsics for MSVC has been overhauled to use
  the new `catchpad` instruction. The filter function is now also a
  rustc-generated function instead of a purely libstd-defined function. The
  libstd definition still exists, it just has a stable ABI across architectures
  and leaves some of the really weird implementation details to the compiler
  (e.g. the `localescape` and `localrecover` intrinsics).

8 years agotrans: Upgrade LLVM
Alex Crichton [Fri, 23 Oct 2015 05:07:19 +0000 (22:07 -0700)]
trans: Upgrade LLVM

This brings some routine upgrades to the bundled LLVM that we're using, the most
notable of which is a bug fix to the way we handle range asserts when loading
the discriminant of an enum. This fix ended up being very similar to f9d4149c
where we basically can't have a range assert when loading a discriminant due to
filling drop, and appropriate flags were added to communicate this to
`trans::adt`.

8 years agoconfigure: Remove compatibility hacks for windows triples
Brian Anderson [Fri, 29 Jan 2016 23:55:11 +0000 (15:55 -0800)]
configure: Remove compatibility hacks for windows triples

Buildbot was updated long ago to use the correct triples.

The putvar here is emitting garbage into `configure --help` so
I want it gone.

8 years agoadd support for mips(el)-unknown-linux-musl
Jorge Aparicio [Mon, 25 Jan 2016 21:23:31 +0000 (16:23 -0500)]
add support for mips(el)-unknown-linux-musl

This target covers MIPS devices that run the trunk version of OpenWRT.

The x86_64-unknown-linux-musl target always links statically to C libraries. For
the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of
other targets do) to keep binary size down.

As for the C compiler flags used in the build system, we use the same flags used
for the mips(el)-unknown-linux-gnu target.

8 years agoAdd missings NOTE and HELP annotations to tests
Florian Hahn [Fri, 15 Jan 2016 10:57:57 +0000 (11:57 +0100)]
Add missings NOTE and HELP annotations to tests

8 years agoExpect all help/note messages are specified in a cfail test if it contains help/note...
Florian Hahn [Fri, 8 Jan 2016 11:26:09 +0000 (12:26 +0100)]
Expect all help/note messages are specified in a cfail test if it contains help/note annotations,

closes #21195

8 years agoAdd main() so that examples work
Steve Klabnik [Fri, 29 Jan 2016 22:53:35 +0000 (17:53 -0500)]
Add main() so that examples work

Rustdoc will automatically wrap things in main, but this doesn't work
here.

Fixes #31249

8 years agoMake note that this is different in std
Steve Klabnik [Fri, 29 Jan 2016 22:48:22 +0000 (17:48 -0500)]
Make note that this is different in std

These are free functions in the text, but methods in the standard
library.

Fixes #31266

8 years agoFix number of methods in guessing game
Steve Klabnik [Fri, 29 Jan 2016 22:45:03 +0000 (17:45 -0500)]
Fix number of methods in guessing game

This code was refactored, but the words were not

Fixes #31284

8 years agoUpdate release notes for 1.7
Brian Anderson [Fri, 22 Jan 2016 00:02:28 +0000 (00:02 +0000)]
Update release notes for 1.7

8 years agoRelease notes for 1.6
Brian Anderson [Tue, 19 Jan 2016 00:18:11 +0000 (00:18 +0000)]
Release notes for 1.6

8 years agoRemove src/test/bench
Brian Anderson [Fri, 29 Jan 2016 02:44:45 +0000 (18:44 -0800)]
Remove src/test/bench

I don't believe these test cases have served any purpose in years.

The shootout benchmarks are now upstreamed. A new benchmark suite
should rather be maintained out of tree.

8 years agostd: Ignore dtors_in_dtors_in_dtors on OSX
Alex Crichton [Fri, 29 Jan 2016 21:46:47 +0000 (13:46 -0800)]
std: Ignore dtors_in_dtors_in_dtors on OSX

This test has been deadlocking and causing problems on the bots basically since
its inception. Some memory safety issues were fixed in 987dc84b, but the
deadlocks remained afterwards unfortunately.

After some investigation, I've concluded that this is just a situation where OSX
is not guaranteed to run destructors. The fix in 987dc84b observed that OSX was
rewriting the backing TLS memory to its initial state during destruction while
we weren't looking, and this would have the effect of canceling the destructors
of any other initialized TLS slots.

While very difficult to pin down, this is basically what I assume is happening
here, so there doesn't seem to really be anythig we can do to ensure the test
robustly passes on OSX, so just ignore it for now.

8 years agoRemove resolve::dump_module
Jeffrey Seyfried [Thu, 28 Jan 2016 03:04:01 +0000 (03:04 +0000)]
Remove resolve::dump_module

8 years agoNits and other local improvements in resolve
Jeffrey Seyfried [Thu, 28 Jan 2016 03:03:40 +0000 (03:03 +0000)]
Nits and other local improvements in resolve

8 years agoClean up resolve_single_import
Jeffrey Seyfried [Fri, 22 Jan 2016 03:00:29 +0000 (03:00 +0000)]
Clean up resolve_single_import

8 years agoRefactor away NameBindings, NsDef, ImportResolutionPerNamespace, DuplicateCheckingMod...
Jeffrey Seyfried [Thu, 14 Jan 2016 01:42:45 +0000 (01:42 +0000)]
Refactor away NameBindings, NsDef, ImportResolutionPerNamespace, DuplicateCheckingMode, and NamespaceDefinition.

8 years agoAuto merge of #31283 - dotdash:32_64_cc, r=alexcrichton
bors [Fri, 29 Jan 2016 20:58:09 +0000 (20:58 +0000)]
Auto merge of #31283 - dotdash:32_64_cc, r=alexcrichton

When cross compiling for a target that has a larger usize type than the
host system, we use a truncated value to mark data as dropped,
eventually leading to drop calls on already dropped data. To properly
handle this, the drop pattern needs to be of type u64.

Since C_integral truncates its given value to the requested size anyway,
we can also drop the function that chose between the u32 and u64 values,
and always use the u64 constant.

Fixes #31139

r? @pnkfelix

8 years agomk: Fix cross-compiling to armv7-unknown-linux-gnu
Alex Crichton [Fri, 29 Jan 2016 20:36:45 +0000 (12:36 -0800)]
mk: Fix cross-compiling to armv7-unknown-linux-gnu

The cross prefix was not likely the actual compiler that needed to be used, but
rather the standard `arm-linux-gnueabihf-gcc` compiler can just be used with
`-march=armv7`.

8 years agomk: Fix compiling jemalloc for powerpc64
Alex Crichton [Fri, 29 Jan 2016 20:22:29 +0000 (12:22 -0800)]
mk: Fix compiling jemalloc for powerpc64

We forgot to pass down the `-m64` flag to gcc, so we were actually compiling
powerpc code which would then later fail to link!

8 years agoAuto merge of #31248 - ruud-v-a:fix-triple-ice, r=nrc
bors [Fri, 29 Jan 2016 17:52:26 +0000 (17:52 +0000)]
Auto merge of #31248 - ruud-v-a:fix-triple-ice, r=nrc

This fixes #31238.

r? @michaelsproul

8 years agoAuto merge of #31285 - Manishearth:rollup, r=Manishearth
bors [Fri, 29 Jan 2016 15:38:40 +0000 (15:38 +0000)]
Auto merge of #31285 - Manishearth:rollup, r=Manishearth

- Successful merges: #31252, #31256, #31264, #31269, #31272, #31275, #31276
- Failed merges:

8 years agoAdd check for unused error codes
ggomez [Fri, 29 Jan 2016 15:25:56 +0000 (16:25 +0100)]
Add check for unused error codes

8 years ago[MIR] Add test for `box EXPR` dereferencing
Simonas Kazlauskas [Thu, 28 Jan 2016 18:27:19 +0000 (20:27 +0200)]
[MIR] Add test for `box EXPR` dereferencing

8 years ago[MIR] Fix type of temporary for `box EXPR`
Oliver Schneider [Fri, 29 Jan 2016 14:44:16 +0000 (15:44 +0100)]
[MIR] Fix type of temporary for `box EXPR`

Previously the code would fail to dereference the temporary.

8 years agoRollup merge of #31276 - alexcrichton:fix-powerpc64-cross-prefix, r=brson
Manish Goregaokar [Fri, 29 Jan 2016 14:49:39 +0000 (20:19 +0530)]
Rollup merge of #31276 - alexcrichton:fix-powerpc64-cross-prefix, r=brson

Looks like the way to create these executables is to use the standard
`powerpc-linux-gnu-gcc` compiler but with the `-m64` option.

8 years agoRollup merge of #31275 - alexcrichton:fix-rumprun, r=brson
Manish Goregaokar [Fri, 29 Jan 2016 14:49:39 +0000 (20:19 +0530)]
Rollup merge of #31275 - alexcrichton:fix-rumprun, r=brson

Looks like the rumprun build has bitrotted over time, so this includes some libc
fixes and some various libstd fixes which gets it back to bootstrapping.

8 years agoRollup merge of #31272 - errandir:master, r=steveklabnik
Manish Goregaokar [Fri, 29 Jan 2016 14:49:39 +0000 (20:19 +0530)]
Rollup merge of #31272 - errandir:master, r=steveklabnik

8 years agoRollup merge of #31269 - ollie27:patch-3, r=alexcrichton
Manish Goregaokar [Fri, 29 Jan 2016 14:49:39 +0000 (20:19 +0530)]
Rollup merge of #31269 - ollie27:patch-3, r=alexcrichton

It got lost in #31121.

8 years agoRollup merge of #31264 - est31:block_coment_parent, r=alexcrichton
Manish Goregaokar [Fri, 29 Jan 2016 14:49:39 +0000 (20:19 +0530)]
Rollup merge of #31264 - est31:block_coment_parent, r=alexcrichton

Block comments don't have to be in the format `/*! ... !*/`
in order to be read as doc comments about the parent block.
The format `/*! ... */` is enough.

8 years agoRollup merge of #31256 - oli-obk:patch-1, r=nagisa
Manish Goregaokar [Fri, 29 Jan 2016 14:49:38 +0000 (20:19 +0530)]
Rollup merge of #31256 - oli-obk:patch-1, r=nagisa

if the tests were run with `RUST_BACKTRACE=1 make check` this test failed. If they were run without `RUST_BACKTRACE=1` it succeeded.

8 years agoRollup merge of #31252 - alexcrichton:ios-old-mac, r=brson
Manish Goregaokar [Fri, 29 Jan 2016 14:49:38 +0000 (20:19 +0530)]
Rollup merge of #31252 - alexcrichton:ios-old-mac, r=brson

Unfortunately older clang compilers don't support this argument, so the
bootstrap will fail. We don't actually really need to optimized the C code we
compile, however, as currently we're just compiling jemalloc and not much else.

8 years agoAuto merge of #31212 - jseyfried:fix_ICE_in_resolve, r=nrc
bors [Fri, 29 Jan 2016 13:45:03 +0000 (13:45 +0000)]
Auto merge of #31212 - jseyfried:fix_ICE_in_resolve, r=nrc

This fixes an ICE introduced by #31065 that occurs when a path cannot be resolved because of a certain class of unresolved import (`Indeterminate` imports).
For example, this currently causes an ICE:
```rust
mod foo { pub use self::*; }
fn main() { foo::f() }
```

r? @nrc

8 years agoFix truncated drop pattern on 32bit -> 64bit cross compilation
Björn Steinbrink [Thu, 28 Jan 2016 20:54:09 +0000 (21:54 +0100)]
Fix truncated drop pattern on 32bit -> 64bit cross compilation

When cross compiling for a target that has a larger usize type than the
host system, we use a truncated value to mark data as dropped,
eventually leading to drop calls on already dropped data. To properly
handle this, the drop pattern needs to be of type u64.

Since C_integral truncates its given value to the requested size anyway,
we can also drop the function that chose between the u32 and u64 values,
and always use the u64 constant.

Fixes #31139

8 years agoAuto merge of #31144 - jseyfried:remove_import_ordering_restriction, r=nrc
bors [Fri, 29 Jan 2016 11:21:58 +0000 (11:21 +0000)]
Auto merge of #31144 - jseyfried:remove_import_ordering_restriction, r=nrc

We no longer require `use` and `extern crate` items to precede other items in modules thanks to [RFC #385](https://github.com/rust-lang/rfcs/pull/385), but we still require `use` and `extern crate` items to precede statements in blocks (other items can appear anywhere in a block).

I think that this is a needless distinction between imports and other items that contradicts the intent of the RFC.

8 years agoFix link to Installing Rust section of the book
Andrew Barchuk [Fri, 29 Jan 2016 09:45:37 +0000 (10:45 +0100)]
Fix link to Installing Rust section of the book

8 years agodon't leak RUST_BACKTRACE into test process
Oliver Schneider [Thu, 28 Jan 2016 11:56:06 +0000 (12:56 +0100)]
don't leak RUST_BACKTRACE into test process

If the tests were run with `RUST_BACKTRACE=1 make check` this test failed. If they were run without it it succeeded.
We need to use `env_remove` instead of `env_clear` because the latter will never work on windows

8 years agoAuto merge of #31132 - gchp:internals, r=brson
bors [Fri, 29 Jan 2016 08:37:20 +0000 (08:37 +0000)]
Auto merge of #31132 - gchp:internals, r=brson

This adds the basic structure for the internals documentation, and also the initial version of the "Overview".

This first section gives and overview of the compilation process. It mentions the individual phases, and gives mention to their function & links to the relevant crates in the source tree.

This is a very general overview which is meant to lead in to the next section which will cover the `driver`. That section will give more in-depth information on each of the phases & cover things like sessions and the driver API. I wanted to give a more general introduction before getting into that detail.

8 years agoAuto merge of #30948 - fabricedesre:rpi2, r=alexcrichton
bors [Fri, 29 Jan 2016 06:41:22 +0000 (06:41 +0000)]
Auto merge of #30948 - fabricedesre:rpi2, r=alexcrichton

This adds support for the armv7 crosstool-ng toolchain for the Raspberry Pi 2.

Getting the toolchain ready:
Checkout crosstool-ng from https://github.com/crosstool-ng/crosstool-ng
Build crosstool-ng
Configure the rpi2 target with |ct-ng armv7-rpi2-linux-gnueabihf|
Build the toolchain with |ct-build| and add the path to $toolchain_install_dir/bin to your $PATH

Then, on the rust side:
configure --target=armv7-rpi2-linux-gnueabihf && make && make install

To cross compile for the rpi2,
add $rust_install_path/lib to your $LD_LIBRARY_PATH, then use
rustc --target=armv7-rpi2-linux-gnueabihf -C linker=armv7-rpi2-linux-gnueabihf-g++ hello.rs

8 years agomk: Fix cross prefix for powerpc64
Alex Crichton [Fri, 29 Jan 2016 05:50:29 +0000 (21:50 -0800)]
mk: Fix cross prefix for powerpc64

Looks like the way to create these executables is to use the standard
`powerpc-linux-gnu-gcc` compiler but with the `-m64` option.

8 years agoAuto merge of #30900 - michaelwoerister:trans_item_collect, r=nikomatsakis
bors [Fri, 29 Jan 2016 03:41:44 +0000 (03:41 +0000)]
Auto merge of #30900 - michaelwoerister:trans_item_collect, r=nikomatsakis

The purpose of the translation item collector is to find all monomorphic instances of functions, methods and statics that need to be translated into LLVM IR in order to compile the current crate.

So far these instances have been discovered lazily during the trans path. For incremental compilation we want to know the set of these instances in advance, and that is what the trans::collect module provides.
In the future, incremental and regular translation will be driven by the collector implemented here.

r? @nikomatsakis
cc @rust-lang/compiler

Translation Item Collection
===========================

This module is responsible for discovering all items that will contribute to
to code generation of the crate. The important part here is that it not only
needs to find syntax-level items (functions, structs, etc) but also all
their monomorphized instantiations. Every non-generic, non-const function
maps to one LLVM artifact. Every generic function can produce
from zero to N artifacts, depending on the sets of type arguments it
is instantiated with.
This also applies to generic items from other crates: A generic definition
in crate X might produce monomorphizations that are compiled into crate Y.
We also have to collect these here.

The following kinds of "translation items" are handled here:

 - Functions
 - Methods
 - Closures
 - Statics
 - Drop glue

The following things also result in LLVM artifacts, but are not collected
here, since we instantiate them locally on demand when needed in a given
codegen unit:

 - Constants
 - Vtables
 - Object Shims

General Algorithm
-----------------
Let's define some terms first:

 - A "translation item" is something that results in a function or global in
   the LLVM IR of a codegen unit. Translation items do not stand on their
   own, they can reference other translation items. For example, if function
   `foo()` calls function `bar()` then the translation item for `foo()`
   references the translation item for function `bar()`. In general, the
   definition for translation item A referencing a translation item B is that
   the LLVM artifact produced for A references the LLVM artifact produced
   for B.

 - Translation items and the references between them for a directed graph,
   where the translation items are the nodes and references form the edges.
   Let's call this graph the "translation item graph".

 - The translation item graph for a program contains all translation items
   that are needed in order to produce the complete LLVM IR of the program.

The purpose of the algorithm implemented in this module is to build the
translation item graph for the current crate. It runs in two phases:

 1. Discover the roots of the graph by traversing the HIR of the crate.
 2. Starting from the roots, find neighboring nodes by inspecting the MIR
    representation of the item corresponding to a given node, until no more
    new nodes are found.

The roots of the translation item graph correspond to the non-generic
syntactic items in the source code. We find them by walking the HIR of the
crate, and whenever we hit upon a function, method, or static item, we
create a translation item consisting of the items DefId and, since we only
consider non-generic items, an empty type-substitution set.

Given a translation item node, we can discover neighbors by inspecting its
MIR. We walk the MIR and any time we hit upon something that signifies a
reference to another translation item, we have found a neighbor. Since the
translation item we are currently at is always monomorphic, we also know the
concrete type arguments of its neighbors, and so all neighbors again will be
monomorphic. The specific forms a reference to a neighboring node can take
in MIR are quite diverse. Here is an overview:

The most obvious form of one translation item referencing another is a
function or method call (represented by a CALL terminator in MIR). But
calls are not the only thing that might introduce a reference between two
function translation items, and as we will see below, they are just a
specialized of the form described next, and consequently will don't get any
special treatment in the algorithm.

A function does not need to actually be called in order to be a neighbor of
another function. It suffices to just take a reference in order to introduce
an edge. Consider the following example:

```rust
fn print_val<T: Display>(x: T) {
    println!("{}", x);
}

fn call_fn(f: &Fn(i32), x: i32) {
    f(x);
}

fn main() {
    let print_i32 = print_val::<i32>;
    call_fn(&print_i32, 0);
}
```
The MIR of none of these functions will contain an explicit call to
`print_val::<i32>`. Nonetheless, in order to translate this program, we need
an instance of this function. Thus, whenever we encounter a function or
method in operand position, we treat it as a neighbor of the current
translation item. Calls are just a special case of that.

In a way, closures are a simple case. Since every closure object needs to be
constructed somewhere, we can reliably discover them by observing
`RValue::Aggregate` expressions with `AggregateKind::Closure`. This is also
true for closures inlined from other crates.

Drop glue translation items are introduced by MIR drop-statements. The
generated translation item will again have drop-glue item neighbors if the
type to be dropped contains nested values that also need to be dropped. It
might also have a function item neighbor for the explicit `Drop::drop`
implementation of its type.

A subtle way of introducing neighbor edges is by casting to a trait object.
Since the resulting fat-pointer contains a reference to a vtable, we need to
instantiate all object-save methods of the trait, as we need to store
pointers to these functions even if they never get called anywhere. This can
be seen as a special case of taking a function reference.

Since `Box` expression have special compiler support, no explicit calls to
`exchange_malloc()` and `exchange_free()` may show up in MIR, even if the
compiler will generate them. We have to observe `Rvalue::Box` expressions
and Box-typed drop-statements for that purpose.

Interaction with Cross-Crate Inlining
-------------------------------------
The binary of a crate will not only contain machine code for the items
defined in the source code of that crate. It will also contain monomorphic
instantiations of any extern generic functions and of functions marked with
The collection algorithm handles this more or less transparently. When
constructing a neighbor node for an item, the algorithm will always call
`inline::get_local_instance()` before proceeding. If no local instance can
be acquired (e.g. for a function that is just linked to) no node is created;
which is exactly what we want, since no machine code should be generated in
the current crate for such an item. On the other hand, if we can
successfully inline the function, we subsequently can just treat it like a
local item, walking it's MIR et cetera.

Eager and Lazy Collection Mode
------------------------------
Translation item collection can be performed in one of two modes:

 - Lazy mode means that items will only be instantiated when actually
   referenced. The goal is to produce the least amount of machine code
   possible.

 - Eager mode is meant to be used in conjunction with incremental compilation
   where a stable set of translation items is more important than a minimal
   one. Thus, eager mode will instantiate drop-glue for every drop-able type
   in the crate, even of no drop call for that type exists (yet). It will
   also instantiate default implementations of trait methods, something that
   otherwise is only done on demand.

Open Issues
-----------
Some things are not yet fully implemented in the current version of this
module.

Since no MIR is constructed yet for initializer expressions of constants and
statics we cannot inspect these properly.

Ideally, no translation item should be generated for const fns unless there
is a call to them that cannot be evaluated at compile time. At the moment
this is not implemented however: a translation item will be produced
regardless of whether it is actually needed or not.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/rust-lang/rust/30900)
<!-- Reviewable:end -->

8 years agostd: Fix rumprun build
Alex Crichton [Fri, 29 Jan 2016 03:33:29 +0000 (19:33 -0800)]
std: Fix rumprun build

Looks like the rumprun build has bitrotted over time, so this includes some libc
fixes and some various libstd fixes which gets it back to bootstrapping.

8 years agorustdoc: Add test for tuple rendering
Oliver Middleton [Thu, 28 Jan 2016 23:40:35 +0000 (23:40 +0000)]
rustdoc: Add test for tuple rendering

8 years agostd::string::String.from_utf16 doc fix
tgor [Thu, 28 Jan 2016 23:13:34 +0000 (02:13 +0300)]
std::string::String.from_utf16 doc fix

8 years agoAuto merge of #30411 - mitaa:multispan, r=nrc
bors [Thu, 28 Jan 2016 22:13:25 +0000 (22:13 +0000)]
Auto merge of #30411 - mitaa:multispan, r=nrc

This allows to render multiple spans on one line, or to splice multiple replacements into a code suggestion.

fixes #28124

8 years agoAvoid ICE if environment variable is not set
Ruud van Asseldonk [Wed, 27 Jan 2016 21:38:01 +0000 (22:38 +0100)]
Avoid ICE if environment variable is not set

Rustdoc could trigger a code path that relied on the
$CFG_COMPILER_HOST_TRIPLE environment variable being
set, causing an ICE if it was not. This fixes that,
emitting an error instead of crashing.

8 years agorustdoc: Add missing trailing comma for single element tuples
Oliver Middleton [Thu, 28 Jan 2016 21:02:22 +0000 (21:02 +0000)]
rustdoc: Add missing trailing comma for single element tuples

8 years agoImplement MultiSpan error reporting
mitaa [Sun, 13 Dec 2015 12:12:47 +0000 (13:12 +0100)]
Implement MultiSpan error reporting

This allows to render multiple spans on one line,
or to splice multiple replacements into a code suggestion.

8 years agoAdd support for armv7 toolchains
Fabrice Desré [Thu, 28 Jan 2016 17:45:56 +0000 (09:45 -0800)]
Add support for armv7 toolchains

8 years agoFix reference info about parent doc block comments
est31 [Thu, 28 Jan 2016 17:39:39 +0000 (18:39 +0100)]
Fix reference info about parent doc block comments

Block comments don't have to be in the format `/*! ... !*/`
in order to be read as doc comments about the parent block.
The format `/*! ... */` is enough.

8 years agoAuto merge of #31257 - tmiasko:track-errors-fix, r=nikomatsakis
bors [Thu, 28 Jan 2016 17:20:04 +0000 (17:20 +0000)]
Auto merge of #31257 - tmiasko:track-errors-fix, r=nikomatsakis

r? @nrc

8 years agoFix checking if there have been new errors.
Tomasz Miąsko [Thu, 28 Jan 2016 13:29:57 +0000 (14:29 +0100)]
Fix checking if there have been new errors.

8 years agoAuto merge of #31241 - tshepang:fix, r=steveklabnik
bors [Thu, 28 Jan 2016 11:00:55 +0000 (11:00 +0000)]
Auto merge of #31241 - tshepang:fix, r=steveklabnik

8 years agoAuto merge of #31171 - dirk:dirk/safety-section-in-cstring-docs, r=steveklabnik
bors [Thu, 28 Jan 2016 09:03:00 +0000 (09:03 +0000)]
Auto merge of #31171 - dirk:dirk/safety-section-in-cstring-docs, r=steveklabnik

Also a minor language tweak to the documentation of the `ffi::CString::from_raw` function.

8 years agoAuto merge of #31240 - durka:follow-set-docs, r=pnkfelix
bors [Thu, 28 Jan 2016 07:06:29 +0000 (07:06 +0000)]
Auto merge of #31240 - durka:follow-set-docs, r=pnkfelix

Missed as part of #31152, but the list had other mistakes as well.

r? @pnkfelix

8 years agomk: Remove the -mfpu=vfp4 argument from arm iOS
Alex Crichton [Thu, 28 Jan 2016 06:34:26 +0000 (22:34 -0800)]
mk: Remove the -mfpu=vfp4 argument from arm iOS

Unfortunately older clang compilers don't support this argument, so the
bootstrap will fail. We don't actually really need to optimized the C code we
compile, however, as currently we're just compiling jemalloc and not much else.

8 years agoRefactor away NameSearchType
Jeffrey Seyfried [Tue, 26 Jan 2016 09:52:33 +0000 (09:52 +0000)]
Refactor away NameSearchType

8 years agoAdd test for #31212
Jeffrey Seyfried [Tue, 26 Jan 2016 09:12:23 +0000 (09:12 +0000)]
Add test for #31212

8 years agoResolve: Fix an ICE that occurs when an identifier refers to an indeterminate import...
Jeffrey Seyfried [Tue, 26 Jan 2016 08:40:42 +0000 (08:40 +0000)]
Resolve: Fix an ICE that occurs when an identifier refers to an indeterminate import (i.e. one that is not resolved and not known to have failed)

8 years agoAuto merge of #31225 - mbrubeck:btreeset-size-hint, r=Gankro
bors [Thu, 28 Jan 2016 02:21:58 +0000 (02:21 +0000)]
Auto merge of #31225 - mbrubeck:btreeset-size-hint, r=Gankro

None

8 years agoFix formatting in documentation of `ffi::CString`
Dirk Gadsden [Wed, 27 Jan 2016 23:07:10 +0000 (15:07 -0800)]
Fix formatting in documentation of `ffi::CString`

8 years agoAuto merge of #31243 - Manishearth:rollup, r=Manishearth
bors [Wed, 27 Jan 2016 21:32:58 +0000 (21:32 +0000)]
Auto merge of #31243 - Manishearth:rollup, r=Manishearth

- Successful merges: #30689, #31186, #31219, #31222, #31226
- Failed merges:

8 years agorustfmt syntax::parse
Tshepang Lekhonkhobe [Wed, 27 Jan 2016 19:42:26 +0000 (21:42 +0200)]
rustfmt syntax::parse

8 years agoRollup merge of #31226 - steveklabnik:gh30954, r=Manishearth
Manish Goregaokar [Wed, 27 Jan 2016 19:18:32 +0000 (00:48 +0530)]
Rollup merge of #31226 - steveklabnik:gh30954, r=Manishearth

Fixes #30954

8 years agoRollup merge of #31222 - durka:patch-15, r=steveklabnik
Manish Goregaokar [Wed, 27 Jan 2016 19:18:32 +0000 (00:48 +0530)]
Rollup merge of #31222 - durka:patch-15, r=steveklabnik

r? @steveklabnik

8 years agoRollup merge of #31219 - mbrubeck:missing-docs, r=steveklabnik
Manish Goregaokar [Wed, 27 Jan 2016 19:18:32 +0000 (00:48 +0530)]
Rollup merge of #31219 - mbrubeck:missing-docs, r=steveklabnik

The missing_docs lint only applies to public items in public modules, so this
example code did not actually generate any warnings or errors.

8 years agoRollup merge of #31186 - gchp:contributing, r=alexcrichton
Manish Goregaokar [Wed, 27 Jan 2016 19:18:31 +0000 (00:48 +0530)]
Rollup merge of #31186 - gchp:contributing, r=alexcrichton

I recently wrote a blog post on contributing to the Rust compiler which
gained some interest. It was mentioned in a comment on Reddit that it
would be useful to integrate some of the information from that post to
the official contributing guide.

This is the start of my efforts to integrate what I wrote with the
official guide.

This commit adds information on the build system. It is not a complete
guide on the build system, but it should be enough to provide a good
starting place for those wishing to contribute.

8 years agoRollup merge of #30689 - Manishearth:lifetime-bound, r=steveklabnik
Manish Goregaokar [Wed, 27 Jan 2016 19:18:31 +0000 (00:48 +0530)]
Rollup merge of #30689 - Manishearth:lifetime-bound, r=steveklabnik

We should have stuff on this in the book somewhere too

r? @steveklabnik

8 years agodoc: insert missing chars
Tshepang Lekhonkhobe [Wed, 27 Jan 2016 18:41:06 +0000 (20:41 +0200)]
doc: insert missing chars

8 years agotrpl: fix macro follow sets
Alex Burka [Wed, 27 Jan 2016 18:26:47 +0000 (13:26 -0500)]
trpl: fix macro follow sets

8 years agoAuto merge of #31224 - bluss:deque-hashing, r=Gankro
bors [Wed, 27 Jan 2016 16:25:36 +0000 (16:25 +0000)]
Auto merge of #31224 - bluss:deque-hashing, r=Gankro

Hash VecDeque in its slice parts

Use .as_slices() for a more efficient code path in VecDeque's Hash impl.

This still hashes the elements in the same order.

Before/after timing of VecDeque hashing 1024 elements of u8 and
u64 shows that the vecdeque now can match the Vec
(test_hashing_vec_of_u64 is the Vec run).

```
before

test test_hashing_u64        ... bench:  14,031 ns/iter (+/- 236) = 583 MB/s
test test_hashing_u8         ... bench:   7,887 ns/iter (+/- 65) = 129 MB/s
test test_hashing_vec_of_u64 ... bench:   6,578 ns/iter (+/- 76) = 1245 MB/s

after

running 5 tests
test test_hashing_u64        ... bench:   6,495 ns/iter (+/- 52) = 1261 MB/s
test test_hashing_u8         ... bench:     851 ns/iter (+/- 16) = 1203 MB/s
test test_hashing_vec_of_u64 ... bench:   6,499 ns/iter (+/- 59) = 1260 MB/s
```

8 years agoAuto merge of #31089 - fhahn:macro-ice, r=pnkfelix
bors [Wed, 27 Jan 2016 12:12:52 +0000 (12:12 +0000)]
Auto merge of #31089 - fhahn:macro-ice, r=pnkfelix

This is a  work in progress PR that potentially should fix #29084, #28308, #25385, #28288, #31011. I think this may also adresse parts of  #2887.

The problem in this issues seems to be that when transcribing macro arguments, we just clone the argument Nonterminal, which still has to original spans. This leads to the unprintable spans. One solution would be to update the spans of the inserted argument to match the argument in the macro definition. So for [this testcase](https://github.com/rust-lang/rust/compare/master...fhahn:macro-ice?expand=1#diff-f7def7420c51621640707b6337726876R2) the error message would be displayed in the macro definition:

    src/test/compile-fail/issue-31011.rs:4:12: 4:22 error: attempted access of field `trace` on type `&T`, but no field with that name was found
    src/test/compile-fail/issue-31011.rs:4         if $ctx.trace {

Currently I've added a very simple `update_span` function, which updates the span of the outer-most expression of a `NtExpr`, but this `update_span` function should be updated to handle all Nonterminals. But I'm pretty new to the macro system and would like to check if this approach makes sense, before doing that.

8 years agoAdd NOTE test annotations
Florian Hahn [Wed, 27 Jan 2016 10:48:46 +0000 (11:48 +0100)]
Add NOTE test annotations

8 years agoAvoid storing interolated token in Parser.last_token
Florian Hahn [Wed, 27 Jan 2016 10:26:38 +0000 (11:26 +0100)]
Avoid storing interolated token in Parser.last_token

8 years agoAuto merge of #31206 - nrc:early-save, r=nikomatsakis
bors [Wed, 27 Jan 2016 10:17:55 +0000 (10:17 +0000)]
Auto merge of #31206 - nrc:early-save, r=nikomatsakis

r? @nikomatsakis

8 years agoTurn interpolated_or_expr_span into a function
Florian Hahn [Wed, 27 Jan 2016 09:47:33 +0000 (10:47 +0100)]
Turn interpolated_or_expr_span into a function