Commit Graph

60156 Commits

Author SHA1 Message Date
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
Alex Crichton
35420b0ccb travis: Attempt to fix Android flakiness
There's been some flaky runs on Travis where the Android emulator is having
problems staying alive... presumably? For example:

* https://travis-ci.org/rust-lang/rust/jobs/186736745

This commit spawns the emulator in the same way as buildbot with `nohup` to hope
that it goes into the background successfully, followed by a `wait-for-device`
command. I'm not actually sure if this'll fix the problems we're seeing, but I
figure it can't hurt to test out.
2016-12-26 11:17:19 -08:00
bors
f536d90c78 Auto merge of #38542 - YaLTeR:fastcall-fix, r=pnkfelix
Fix fastcall not applying inreg attributes to arguments

Fixes https://github.com/rust-lang/rust/issues/18086
2016-12-26 17:23:42 +00:00
Felix S. Klock II
a6fe6c9be1 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-26 09:45:42 -05:00
bors
65c043fdd2 Auto merge of #38154 - petrochenkov:altname, r=jseyfried
More systematic error reporting in path resolution

Path resolution for types, expressions and patterns used various heuristics to give more helpful messages on unresolved or incorrectly resolved paths.
This PR combines these heuristics and applies them to all non-import paths.

First a path is resolved in all namespaces, starting from its primary namespace (to give messages like "expected function, found macro, you probably forgot `!`").
If this resolution doesn't give a desired result we create a base error - either "path is not resolved" or "path is resolved, but the resolution is not acceptable in this context".
Other helps and notes are applied to this base error using heuristics.

Here's the list of heuristics for a path with a last segment `name` in order.
First we issue special messages for unresolved `Self` and `self`.
Second we try to find free items named `name` in other modules and suggest to import them.
Then we try to find fields and associated items named `name` and suggest `self.name` or `Self::name`.
After that we try several deterministic context dependent heuristics like "expected value, found struct, you probably forgot `{}`".
If nothing of the above works we try to find candidates with other names using Levenshtein distance.

---

Some alternatives/notes/unresolved questions:
- ~~I had a strong desire to migrate all affected tests to `test/ui`, diagnostics comparison becomes much more meaningful, but I did this only for few tests so far.~~ (Done)
- ~~Labels for "unresolved path" errors are mostly useless now, it may make sense to move some help/notes to these labels, help becomes closer to the error this way.~~ (Done)
- ~~Currently only the first successful heuristic results in additional message shown to the user, it may make sense to print them all, they are rarely compatible, so the diagnostics bloat is unlikely.~~ (Done)
- Now when https://github.com/rust-lang/rust/pull/38014 landed `resolve_path` can potentially be replaced with `smart_resolve_path` in couple more places - e.g. ~~visibilities~~ (done), ~~import prefixes~~ (done), HIR paths.

---

Some additional fixes:
- Associated suggestions and typo suggestions are filtered with a context specific predicate to avoid inapplicable suggestions.
- `adjust_local_def` works properly in speculative resolution.
- I also fixed a recently introduced ICE in partially resolved UFCS paths (see test `ufcs-partially-resolved.rs`).     Minimal reproduction:
    ```
    enum E {}
    fn main() {
        <u8 as E>::A;
    }
    ```
    Fixes https://github.com/rust-lang/rust/issues/38409, fixes https://github.com/rust-lang/rust/issues/38504 (duplicates).
- Some bugs in resolution of visibilities are fixed - `pub(Enum)`, `pub(Trait)`, `pub(non::local::path)`.
- Fixes https://github.com/rust-lang/rust/issues/38012.
---

r? @jseyfried for technical details + @jonathandturner  for diagnostics changes
How to read the patch: `smart_resolve_path(_fragment)/resolve_qpath_anywhere` are written anew and replace `resolve_trait_reference`/`resolve_type`/`resolve_pattern_path`/`resolve_struct_path`/`resolve_expr` for `ExprKind::Path`, everything else can be read as a diff.
2016-12-26 13:32:13 +00:00
Vadim Petrochenkov
09aba18e10 More systematic error reporting in path resolution 2016-12-26 15:01:49 +03:00
Christoph Schulz
14994ac6b6 Use cfg!() to get type checking everywhere. 2016-12-26 11:57:01 +01:00
bors
8493dbed6c Auto merge of #38536 - retep998:flauschige-kaninchen, r=petrochenkov
Fix fs tests on Windows systems with non-english locales.

Fixes https://github.com/rust-lang/rust/issues/34628

r? @alexcrichton
2016-12-26 10:52:56 +00:00
Vadim Petrochenkov
3fb676afb0 Move some compile-fail tests into UI directory 2016-12-26 12:58:33 +03:00
Guillaume Gomez
3907b93c57 Add missing urls in AtomicBool docs 2016-12-26 10:51:25 +01:00
Alex Crichton
67cc77ccde travis: Don't use -9 on gzip
I timed this locally and plain old `gzip` took 2m06s while `gzip -9` took a
whopping 6m23s to save a mere 4MB out of 1.2GB. Let's shave a few minutes off
the Android builder by turning down the compression level.
2016-12-25 22:13:50 -08:00
bors
5752eae5f5 Auto merge of #38598 - brson:em, r=alexcrichton
Emscripten targets are Unix targets

I suspect this will fix the errors compiling libc https://buildbot.rust-lang.org/builders/auto-linux-rustbuild-cross-opt/builds/689/steps/compile/logs/stdio that are occurring on every PR.

Emscripten is basically a posix emulation layer for the web and I consider it a Unix.

cc @alexcrichton
2016-12-26 00:47:50 +00:00
Alex Crichton
f262eea2ee Move target_family to TargetOptions, not Target
Just fixing a compile error
2016-12-25 14:03:44 -08:00
bors
44ad63e487 Auto merge of #38490 - jseyfried:def_id_vis, r=nrc
Use `DefId`s instead of `NodeId`s for `pub(restricted)` visibilities

This is groundwork for hygiene 2.0, specifically privacy checking hygienic intercrate name resolutions.
r? @nrc
2016-12-25 21:32:37 +00:00
bors
20b6c160ca Auto merge of #38539 - jseyfried:fix_resolve_hang, r=eddyb
resolve: fix non-termination

Fixes #34324.
r? @eddyb
2016-12-25 18:13:54 +00:00
Ariel Ben-Yehuda
521b2eaf7b clear discriminant drop flag at the bottom of a ladder
Fixes #38437.
2016-12-25 18:44:19 +02:00
bors
c74ac6cb97 Auto merge of #38566 - jseyfried:fix_import_resolution_bug, r=eddyb
Fix bug in import resolution

Fixes #38535 and fixes #38556.
r? @nrc
2016-12-25 13:14:12 +00:00
Brian Anderson
31bda236bd Emscripten targets are Unix targets 2016-12-25 02:09:10 +00:00
bors
e60aa62ffe Auto merge of #38594 - steveklabnik:rollup, r=steveklabnik
Rollup of 14 pull requests

- Successful merges: #37956, #38013, #38297, #38480, #38497, #38502, #38505, #38513, #38521, #38549, #38554, #38557, #38568, #38572
- Failed merges:
2016-12-24 21:14:17 +00:00
Steve Klabnik
df63b0ce72 Rollup merge of #38572 - GuillaumeGomez:join_handle_docs, r=frewsxcv
Add JoinHandle missing examples

r? @frewsxcv
2016-12-24 14:29:34 -05:00
Steve Klabnik
637818fd85 Rollup merge of #38568 - chris-morgan:fix-markdown-lists, r=frewsxcv
Fix Markdown list formatting.

The Markdown engine used by the book can cope with a single leading space on the list marker:

    Like this:

     * List item

    Rather than like this:

    * List item

… but it’s not the typical convention employed in the book, and moreover the Markdown engine used for producing the error index *can’t* cope with it (its behaviour looks like a bug, as it appears to lose one of the two line breaks as well, but that’s immaterial here).

So, we shift to a single convention which doesn’t trigger bugs in the Markdown renderer.

----

See https://doc.rust-lang.org/error-index.html#E0458 and https://doc.rust-lang.org/error-index.html#E0101 for the bad current rendering in the error index.
2016-12-24 14:29:33 -05:00
Steve Klabnik
8836a9da72 Rollup merge of #38557 - michaelwoerister:inline-asm-ich, r=nikomatsakis
incr. comp.: Improve InlineAsm hashing and add test case

r? @nikomatsakis
2016-12-24 14:29:32 -05:00
Steve Klabnik
abf478455d Rollup merge of #38554 - DirkyJerky:master, r=frewsxcv
Create hyperlink to correct documentation

In librustc_trans's readme
2016-12-24 14:29:31 -05:00
Steve Klabnik
8669b5dce3 Rollup merge of #38549 - aidanhs:aphs-incremental-readme-note, r=nikomatsakis
Correct path of incremental artifacts

Per https://github.com/rust-lang/rust/pull/38072#issuecomment-263670621

r? @nikomatsakis
2016-12-24 14:29:30 -05:00
Steve Klabnik
e9a2a77746 Rollup merge of #38521 - jxson:remove-magenta-warnings, r=sfackler
Removes magenta build warning.

Small bug fix to remove an unused type in the magenta process code that causes build failures for magenta's rustc.

r? @alexcrichton

@tedsta @raphlinus
2016-12-24 14:29:29 -05:00
Steve Klabnik
67bef48739 Rollup merge of #38513 - GuillaumeGomez:thread_fn_docs, r=frewsxcv
Add missing examples in some thread functions

r? @frewsxcv
2016-12-24 14:29:28 -05:00