Commit graph

60123 commits

Author SHA1 Message Date
Nick Cameron 9c89166611 Restore --crate-type=metadata as an alias for --crate-type=rlib,--emit=metadata + a warning 2016-12-29 13:24:46 +13:00
Nick Cameron 71f161c887 Add a test for #38273
Closes 38273
2016-12-29 13:24:46 +13:00
Nick Cameron 7720cf02e3 Change --crate-type metadata to --emit=metadata 2016-12-29 13:24:45 +13:00
Alex Crichton fc3e49b1f1 rustbuild: Move pretty test suites to host-only
In an ongoing effort to optimize the runtime of the Android cross builder this
commit updates the pretty test suites to run only for host platforms, not for
target platforms as well. This means we'll still keep running all the suites but
we'll only run them for configured hosts, not for configured targets. This
notably means that we won't be running these suites on Android or musl targets,
for example.
2016-12-28 15:05:17 -08:00
Alex Crichton 7046fea5be rustbuild: Compile rustc twice, not thrice
This commit switches the rustbuild build system to compiling the
compiler twice for a normal bootstrap rather than the historical three
times.

Rust is a bootstrapped language which means that a previous version of
the compiler is used to build the next version of the compiler. Over
time, however, we change many parts of compiler artifacts such as the
metadata format, symbol names, etc. These changes make artifacts from
one compiler incompatible from another compiler. Consequently if a
compiler wants to be able to use some artifacts then it itself must have
compiled the artifacts.

Historically the rustc build system has achieved this by compiling the
compiler three times:

* An older compiler (stage0) is downloaded to kick off the chain.
* This compiler now compiles a new compiler (stage1)
* The stage1 compiler then compiles another compiler (stage2)
* Finally, the stage2 compiler needs libraries to link against, so it
  compiles all the libraries again.

This entire process amounts in compiling the compiler three times.
Additionally, this process always guarantees that the Rust source tree
can compile itself because the stage2 compiler (created by a freshly
created compiler) would successfully compile itself again. This
property, ensuring Rust can compile itself, is quite important!

In general, though, this third compilation is not required for general
purpose development on the compiler. The third compiler (stage2) can
reuse the libraries that were created during the second compile. In
other words, the second compilation can produce both a compiler and the
libraries that compiler will use. These artifacts *must* be compatible
due to the way plugins work today anyway, and they were created by the
same source code so they *should* be compatible as well.

So given all that, this commit switches the default build process to
only compile the compiler three times, avoiding this third compilation
by copying artifacts from the previous one. Along the way a new entry in
the Travis matrix was also added to ensure that our full bootstrap can
succeed. This entry does not run tests, though, as it should not be
necessary.

To restore the old behavior of a full bootstrap (three compiles) you can
either pass:

    ./configure --enable-full-bootstrap

or if you're using config.toml:

    [build]
    full-bootstrap = true

Overall this will hopefully be an easy 33% win in build times of the
compiler. If we do 33% less work we should be 33% faster! This in turn
should affect cycle times and such on Travis and AppVeyor positively as
well as making it easier to work on the compiler itself.
2016-12-28 14:49:00 -08:00
Adam Langley 57b53fdd9e Use "an" before "i32"
(Minor typo fix.)

Since the word `i32` starts with a vowel, the indefinite article should use "an", not "a" \[[1](http://www.dictionary.com/browse/an)\]. (Previously there was one instance of "an i32" and two instances of "a i32", so at least something is wrong!) Since I believe that "an" is the correct form, I aligned everything with that.
2016-12-28 12:57:50 -08:00
bors 4ecc85beb3 Auto merge of #38449 - eddyb:lazy-10, r=nikomatsakis
[10/n] Split constants and functions' arguments into disjoint bodies.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/38053) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

Finishes the signature-body split started in #37918, namely:
* `trait` items are separated just like `impl` items were, for uniformity, closing #37712
* `static`s, `const`s (including associated ones), `enum` discriminants and array lengths get bodies
  * even the count in "repeat expressions", i.e. `n` in `[x; n]`, which fixes #24414
* arguments' patterns are moved to the bodies, with the types staying in `FnDecl`
  * `&self` now desugars to `self: &Self` instead of `self: &_` (similarly for other `self` forms)
  * `astconv`'s and metadata's (for rustdoc) informative uses are explicitly ignored for the purposes of the dep graph. this could be fixed in the future by hashing the exact information being extracted about the arguments as opposed to generating a dependency on *the whole body*
2016-12-28 20:19:39 +00:00
Martijn Vermaat 1825f80fab Fix default terminfo code for reset (sg0 -> sgr0)
Resetting the terminal should first try `sgr0` (as per the comment), not
`sg0` which I believe to be a typo.

This will at least fix rustc output in Emacs terminals (e.g., ansi-term)
with `TERM=eterm-color` which does not provide the next fallback `sgr`. In
such a terminal, the final fallback `op` (`\e[39;49`) is used  which
resets only colors, not all attributes. This causes all text to be
printed in bold from the first string printed in bold by rustc onwards,
including the terminal prompt and the output from all following commands.

The typo seems to have been introduced by #29999
2016-12-28 14:40:00 -05:00
Adam Langley ee2abe85a6 Add missing apostrophe.
(Minor typo fix.)

The "support" in this case is possessed by the "programmer", and that ownership should be indicated by an apostrophe.
2016-12-28 11:11:17 -08:00
Wang Xuerui 0f8e931475
rustbuild: allow overriding list of LLVM targets to build
A new option is introduced under the `[llvm]` section of `config.toml`,
`targets`, for overriding the list of LLVM targets to build support for.
The option is passed through to LLVM configure script. Also notes are
added about the implications of (ab)using the option; since the default
is not changed, and users of the option are expected to know what
they're doing anyway (as every porter should), the impact should be
minimal.

Fixes #38200.
2016-12-29 02:31:26 +08:00
Alex Crichton 88429dc575 travis: Use && intead of ;
Show errors sooner and try not to hide them behind lots of other walls of text.
2016-12-28 09:29:14 -08:00
bors 02b22ec7bd Auto merge of #38639 - xen0n:nightly-dist-hotfix, r=brson
rustbuild: Hotfix to unbreak nightly

Fixes an oversight unnoticed in #38468 that eventually broke nightly packaging. I didn't realize this until some moments ago, when I finally found out the failure is actually deterministic. Many apologies for eating 3 nightlies during the holidays.

r? @alexcrichton
2016-12-28 17:27:13 +00:00
bors 371f4d6bf6 Auto merge of #38626 - redox-os:args_fix, r=alexcrichton
Fix argument handling on Redox

After switching the start code to be handled in libc, we are no longer passing in slices as arguments into the libstd main function. This means that handling had to be rewritten to match the unix way of doing things.

Additional commits on this branch are going to be merged in this PR: https://github.com/rust-lang/rust/pull/38577#issuecomment-269138394
2016-12-28 14:33:48 +00:00
Guillaume Gomez ef8d5e14b1 Add missing urls for AtomicPtr 2016-12-28 11:06:17 +01:00
Guillaume Gomez 94d58c203e Add missing urls for atomic_int macros types 2016-12-28 11:00:53 +01:00
bors 469fd779ee Auto merge of #38616 - pnkfelix:refactor-mir-dataflow-remove-ctxt, r=arielb1
Refactor mir::dataflow: remove Ctxt associated type from BitDenotation trait

Refactor mir::dataflow: remove Ctxt associated type from BitDenotation trait

I no longer remember why I needed this (or thought I did). The way
that the `BitDenotation` is passed around in all existing use cases
(and planned future ones), the thing that were in the `Ctxt` can just
be part of `Self` instead.

(I think ariel had been pushing me to do this back when I first put in
this infrastructure; it took me a while to see how much of pain the
`Ctxt` was causing.)
2016-12-28 09:42:46 +00:00
Eduard-Mihai Burtescu ee0ea95343 rustdoc: pretty-print nested bodies in inlined constants. 2016-12-28 11:29:21 +02:00
Eduard-Mihai Burtescu 4aae835803 rustc: always print nested nodes where a HIR map is available. 2016-12-28 11:29:20 +02:00
Eduard-Mihai Burtescu f64e73b6ec rustc: simplify constant cross-crate loading and rustc_passes::consts. 2016-12-28 11:29:19 +02:00
Eduard-Mihai Burtescu f89856be6c rustc: move function arguments into hir::Body. 2016-12-28 11:29:19 +02:00
Eduard-Mihai Burtescu e64f64a2fc rustc: separate bodies for static/(associated)const and embedded constants. 2016-12-28 11:27:57 +02:00
Eduard-Mihai Burtescu 864928297d rustc: separate TraitItem from their parent Item, just like ImplItem. 2016-12-28 11:21:45 +02:00
Eduard-Mihai Burtescu 6ebb6fdbee hir: lower ImplicitSelf to resolved Self TyQPath's. 2016-12-28 11:21:45 +02:00
Alex Crichton f26e52efa5 compiletest: Don't limit all suites on Android
On Android we only have one test thread for supposed problems with concurrency
and the remote debugger. Not all of our suites require one concurrency, however,
and suites like compile-fail or pretty can be much faster if they're
parallelized on Travis.

This commit only sets the test threads to one on Android for suites which
actually run code, and other suites aren't tampered with.
2016-12-27 23:29:33 -08:00
bors 17f1fba353 Auto merge of #38589 - aidanhs:aphs-stage0-rustdoc-test, r=alexcrichton
Teach `rustdoc --test` about `--sysroot`, pass it when testing rust

This permits rustdoc tests to work in stage0.

Logical continuation of #36586.

Snippet from https://github.com/rust-lang/rust/issues/38575#issuecomment-269090724:

> it should actually be possible to run all the libstd tests immediately after creating std of stage0-out - there's no reason to build librustc at all if you've just made a change to (for example) libcollections, `./x.py test src/libcollections --stage 0 -v --incremental` should just work

This PR makes it so (or appears to in my testing).

r? @alexcrichton
2016-12-28 07:05:07 +00:00
bors 0807104c8f Auto merge of #38579 - whitequark:min_atomic_width, r=alexcrichton
Add a min_atomic_width target option, like max_atomic_width

Rationale: some ISAs, e.g. OR1K, do not have atomic instructions
for byte and halfword access, and at the same time do not have
a fixed endianness, which makes it unreasonable to implement these
through word-sized atomic accesses.
2016-12-28 04:12:11 +00:00
Wang Xuerui cf89453506
rustbuild: fix host-only rules ignoring targets in dist steps
`arr` is the actual list of targets participating in steps construction,
but due to #38468 the hosts array now consists of only the build triple
for the `dist` steps, hence all non-build-triple targets are lost for
the host-only rules.

Fix this by using the original non-shadowed hosts array in `arr`
calculation. This should unbreak the nightly packaging process.

Fixes #38637.
2016-12-28 10:54:13 +08:00
Niko Matsakis ad747c5869 propagate TIME_DEPTH to the helper threads for -Z time-passes 2016-12-27 21:35:34 -05:00
bors a9ab778815 Auto merge of #38479 - michaelwoerister:extern_mod_ich, r=nikomatsakis
ICH: Fix and test foreign mod hashing.

r? @nikomatsakis
2016-12-28 01:30:31 +00:00
bors 314c28b729 Auto merge of #38329 - ollie27:rustdoc_stab_em_div, r=steveklabnik
rustdoc: Fix invalid HTML in stability notices

`em` tags cannot contain `p` tags so use `div`s instead of `em`s as the Markdown will create `p` tags.
2016-12-27 21:10:31 +00:00
Wang Xuerui 3991046d52
rustbuild: clarify comment on target array calculation
The comment touched, as originally written, only concerned itself with
the `test` steps. However, since #38468 the `arr` variable actually has
gained an indirect relationship with the `dist` steps too. The comment
failed to convey the extra meaning, contributing to the misunderstanding
which eventually lead to #38637. Fix that by moving the comment into the
right place near the relevant condition, and properly documenting
`arr`'s purpose.
2016-12-28 03:41:09 +08:00
Wang Xuerui 9d3616f78d
rustbuild: get an empty slice the straight-forward way 2016-12-28 03:41:05 +08:00
bors 82801b552e Auto merge of #38600 - arielb1:dead-drop, r=eddyb
clear discriminant drop flag at the bottom of a drop ladder

Fixes #38437.

Beta-nominating because serious I-wrong.

r? @eddyb
2016-12-27 18:25:22 +00:00
Jeremy Soller 88df0e3918 Fix arguments on Redox 2016-12-27 10:55:41 -07:00
Robin Kruppe d44bcbf9ee Accept ninja-build binary in place of ninja 2016-12-27 16:36:53 +01:00
bors 86896ba0be Auto merge of #38577 - redox-os:master, r=alexcrichton
Add Debug to OpenOptions and DirBuilder

This fixes the build on Redox as the platform independent structs now implement Debug.
2016-12-27 14:15:29 +00:00
bors d849b13267 Auto merge of #38574 - Mark-Simulacrum:box-free-unspecialize, r=eddyb
Remove special case for Box<ZST> in trans

Remove extra lang item, `exchange_free`; use `box_free` instead.

Trans used to insert code equivalent to `box_free` in a wrapper around
`exchange_free`, and that code is now removed from trans.

Fixes #37710.
2016-12-27 11:32:39 +00:00
Corey Farwell 5cdf128410 Document foreign variadic functions in TRPL and the reference.
Fixes https://github.com/rust-lang/rust/issues/38485.
2016-12-27 00:05:53 -08:00
Alex Crichton 03d4fc564e travis: Remove extraneous /tmp/obj dirs
These are no longer used when running containers and tests.
2016-12-26 23:04:39 -08:00
Alex Crichton fd97f5df15 travis: Don't install ccache in containers
We no longer use it, we use sccache
2016-12-26 23:03:20 -08:00
bors 9351c2c8e7 Auto merge of #38537 - jseyfried:fix_rustdoc_ice, r=nrc
Fix ICE in rustdoc

Fixes #38237.
r? @nrc
2016-12-27 05:07:34 +00:00
bors c2ee32ab45 Auto merge of #38507 - alexcrichton:travis-lldb, r=brson
travis: Update the OSX image we run tests in

The current image is `xcode7.3`, Travis's current default. Unfortunately this
has a version of LLDB which doesn't support debuginfo-lldb tests (see #32520),
so we're not running LLDB tests on Travis yet.

This switches us to the newest image from Travis, `xcode8.2`, which should have
a newer version of LLDB we can run tests against.
2016-12-27 02:18:20 +00:00
Jorge Aparicio aac5ff7664 fix ui test 2016-12-26 21:06:23 -05:00
Jorge Aparicio 18d49288d5 PTX support
- `--emit=asm --target=nvptx64-nvidia-cuda` can be used to turn a crate
  into a PTX module (a `.s` file).

- intrinsics like `__syncthreads` and `blockIdx.x` are exposed as
  `"platform-intrinsics"`.

- "cabi" has been implemented for the nvptx and nvptx64 architectures.
  i.e. `extern "C"` works.

- a new ABI, `"ptx-kernel"`. That can be used to generate "global"
  functions. Example: `extern "ptx-kernel" fn kernel() { .. }`. All
  other functions are "device" functions.
2016-12-26 21:06:23 -05:00
kellerkindt 20abf050e7 And suddenly a german word :O
"verboten" is german for "forbidden"
2016-12-27 02:26:30 +01:00
Mark Simulacrum ca115dd083 Remove extra lang item, exchange_free; use box_free instead.
Trans used to insert code equivalent to box_free in a wrapper around
exchange_free, and that code is now removed from trans.
2016-12-26 17:13:51 -07:00
Alex Crichton dad0076569 travis: Update the OSX image we run tests in
The current image is `xcode7.3`, Travis's current default. Unfortunately this
has a version of LLDB which doesn't support debuginfo-lldb tests (see #32520),
so we're not running LLDB tests on Travis yet.

This switches us to the newest image from Travis, `xcode8.2`, which should have
a newer version of LLDB we can run tests against.
2016-12-26 15:40:22 -08:00
bors 77f7c7aaf5 Auto merge of #38274 - elahn:windows-readconsole-ctrl-z, r=alexcrichton
Ctrl-Z returns from Stdin.read() when reading from the console on Windows

Fixes #19914.
Fixes read(), read_to_string(), read_to_end(), etc.

r? @alexcrichton
2016-12-26 23:33:21 +00:00
Alex Crichton 917a9affc1 std: Clamp max read/write sizes on Unix
Turns out that even though all these functions take a `size_t` they don't
actually work that well with anything larger than the maximum value of
`ssize_t`, the return value. Furthermore it looks like OSX rejects any
read/write requests larger than `INT_MAX - 1`. Handle all these cases by just
clamping the maximum size of a read/write on Unix to a platform-specific value.

Closes #38590
2016-12-26 15:08:53 -08:00
bors b7e5148bbd Auto merge of #38314 - japaric:do-not-delete-enable-llvm-backend, r=alexcrichton
initial SPARC support

### UPDATE

Can now compile `no_std` executables with:

```
$ cargo new --bin app && cd $_

$ edit Cargo.toml && tail -n2 $_
[dependencies]
core = { path = "/path/to/rust/src/libcore" }

$ edit src/main.rs && cat $_
#![feature(lang_items)]
#![no_std]
#![no_main]

#[no_mangle]
pub fn _start() -> ! {
    loop {}
}

#[lang = "panic_fmt"]
fn panic_fmt() -> ! {
    loop {}
}

$ edit sparc-none-elf.json && cat $_
{
  "arch": "sparc",
  "data-layout": "E-m:e-p:32:32-i64:64-f128:64-n32-S64",
  "executables": true,
  "llvm-target": "sparc",
  "os": "none",
  "panic-strategy": "abort",
  "target-endian": "big",
  "target-pointer-width": "32"
}

$ cargo rustc --target sparc-none-elf -- -C linker=sparc-unknown-elf-gcc -C link-args=-nostartfiles

$ file target/sparc-none-elf/debug/app
app: ELF 32-bit MSB executable, SPARC, version 1 (SYSV), statically linked, not stripped

$ sparc-unknown-elf-readelf -h target/sparc-none-elf/debug/app
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Sparc
  Version:                           0x1
  Entry point address:               0x10074
  Start of program headers:          52 (bytes into file)
  Start of section headers:          1188 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         2
  Size of section headers:           40 (bytes)
  Number of section headers:         14
  Section header string table index: 11

$ sparc-unknown-elf-objdump -Cd target/sparc-none-elf/debug/app

target/sparc-none-elf/debug/app:     file format elf32-sparc

Disassembly of section .text:

00010074 <_start>:
   10074:       9d e3 bf 98     save  %sp, -104, %sp
   10078:       10 80 00 02     b  10080 <_start+0xc>
   1007c:       01 00 00 00     nop
   10080:       10 80 00 02     b  10088 <_start+0x14>
   10084:       01 00 00 00     nop
   10088:       10 80 00 00     b  10088 <_start+0x14>
   1008c:       01 00 00 00     nop
```

---

Someone wants to attempt launching some Rust [into space](https://www.reddit.com/r/rust/comments/5h76oa/c_interop/) but their platform is based on the SPARCv8 architecture. Let's not block them by enabling LLVM's SPARC backend.

Something very important that they'll also need is the "cabi" stuff as they'll be embedding some Rust code into a bigger C application (i.e. heavy use of `extern "C"`). The question there is what name(s) should we use for "target_arch" as the "cabi" implementation [varies according to that parameter](https://github.com/rust-lang/rust/blob/1.13.0/src/librustc_trans/abi.rs#L498-L523).

AFAICT, SPARCv8 is a 32-bit architecture and SPARCv9 is a 64-bit architecture. And, LLVM uses `sparc`, `sparcv9` and `sparcel` for [the architecture triple](ac1c94226e/include/llvm/ADT/Triple.h (L67-L69)) so perhaps we should use `target_arch = "sparc"` (32-bit) and `target_arch = "sparcv9"` (64-bit) as well.

r? @alexcrichton This PR only enables this LLVM backend when rustbuild is used. Do I also need to implement this for the old Makefile-based build system? Or are all our nightlies now being generated using rustbuild?

cc @brson
2016-12-26 20:48:43 +00:00