Commit Graph

61731 Commits

Author SHA1 Message Date
Austin Bonander
2fcbb48c72 Implement function-like procedural macros ( #[proc_macro]) 2017-02-28 18:34:22 -08:00
bors
4be034e622 Auto merge of #38165 - Yamakaky:better-backtrace, r=petrochenkov
Improve backtrace formating while panicking.

Fixes #37783.

Done:

- Fix alignment of file paths for better readability
- `RUST_BACKTRACE=full` prints all the informations (current behaviour)
- `RUST_BACKTRACE=(short|yes)` is the default and does:
  - Skip irrelevant frames at the beginning and the end
  - Remove function address
  - Remove the current directory from the absolute paths
  - Remove `::hfabe6541873` at the end of the symbols
- `RUST_BACKTRACE=(0|no)` disables the backtrace.
- `RUST_BACKTRACE=<everything else>` is equivalent to `short` for
  backward compatibility.
- doc
- More uniform printing across platforms.

Removed, TODO in a new PR:

- Remove path prefix for libraries and libstd

Example of short backtrace:
```rust
fn fail() {
    panic!();
}

fn main() {
    let closure = || fail();
    closure();
}
```
Short:
```
thread 'main' panicked at 'explicit panic', t.rs:2
Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: t::fail
            at ./t.rs:2
   1: t::main::{{closure}}
            at ./t.rs:6
   2: t::main
            at ./t.rs:7
```
Full:
```
thread 'main' panicked at 'This function never returns!', t.rs:2
stack backtrace:
   0:     0x558ddf666478 - std::sys:👿:backtrace::tracing:👿:unwind_backtrace::hec84c9dd8389cc5d
                               at /home/yamakaky/dev/rust/rust/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x558ddf65d90e - std::sys_common::backtrace::_print::hfa25f8b31f4b4353
                               at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:71
   2:     0x558ddf65cb5e - std::sys_common::backtrace::print::h9b711e11ac3ba805
                               at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:60
   3:     0x558ddf66796e - std::panicking::default_hook::{{closure}}::h736d216e74748044
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:355
   4:     0x558ddf66743c - std::panicking::default_hook::h16baff397e46ea10
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:371
   5:     0x558ddf6682bc - std::panicking::rust_panic_with_hook::h6d5a9bb4eca42c80
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:559
   6:     0x558ddf64ea93 - std::panicking::begin_panic::h17dc549df2f10b99
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:521
   7:     0x558ddf64ec42 - t::diverges::he6bc43fc925905f5
                               at /tmp/p/t.rs:2
   8:     0x558ddf64ec5a - t::main::h0ffc20356b8a69c0
                               at /tmp/p/t.rs:6
   9:     0x558ddf6687f5 - core::ops::FnOnce::call_once::hce41f19c0db56f93
  10:     0x558ddf667cde - std::panicking::try::do_call::hd4c8c97efb4291df
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:464
  11:     0x558ddf698d77 - __rust_try
  12:     0x558ddf698c57 - __rust_maybe_catch_panic
                               at /home/yamakaky/dev/rust/rust/src/libpanic_unwind/lib.rs:98
  13:     0x558ddf667adb - std::panicking::try::h2c56ed2a59ec1d12
                               at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:440
  14:     0x558ddf66cc9a - std::panic::catch_unwind::h390834e0251cc9af
                               at /home/yamakaky/dev/rust/rust/src/libstd/panic.rs:361
  15:     0x558ddf6809ee - std::rt::lang_start::hb73087428e233982
                               at /home/yamakaky/dev/rust/rust/src/libstd/rt.rs:57
  16:     0x558ddf64ec92 - main
  17:     0x7fecb869e290 - __libc_start_main
  18:     0x558ddf64e8b9 - _start
  19:                0x0 - <unknown>
```
2017-02-27 17:21:37 +00:00
Yamakaky
6398b2078d
This test is too hard to maintain cross-platform 2017-02-27 10:31:36 -05:00
bors
0ed75e1f47 Auto merge of #40121 - king6cong:fix-typo, r=apasel422
fix typo
2017-02-27 14:58:13 +00:00
king6cong
c01a6fec8c fix typo 2017-02-27 11:18:11 +08:00
bors
cb1f6492dd Auto merge of #40115 - MajorBreakfast:patch-2, r=steveklabnik
Loop docs: Present perfect instead of simple past

Sounds better with present perfect because there's a link to the present.

I'm not a native speaker, though. So, plz check whether it really is better ;)

r? @steveklabnik
2017-02-27 02:20:29 +00:00
Yamakaky
52bed53e99
Also ignore std::panic 2017-02-26 20:39:08 -05:00
bors
8e08bd61a1 Auto merge of #40102 - pmer:pmer/use-macos-term-in-docs, r=steveklabnik
doc: Use "macOS" terminology consistently

One line in the documentation used the term macOS while the other six used OSX. Be consistent and use the current product brand of macOS.
2017-02-27 00:06:11 +00:00
Yamakaky
d0fe018cd4
Remove unused 2017-02-26 15:53:55 -05:00
bors
60a0edc6c2 Auto merge of #39738 - keeperofdakeys:vec-docs, r=GuillaumeGomez
Add notes about capacity effects to Vec::truncate()

Add notes about the effects of Vec::truncate() and Vec::clear() on the capacity of a vector.
2017-02-26 20:36:10 +00:00
bors
44e9e0a6cf Auto merge of #40112 - alexcrichton:fetch-all, r=brson
travis: Make more network requests retryable

This commit attempts to move more network operations to being retryable through
various operations. For example git submodule updates, downloading snapshots,
etc, are now all in retryable steps.

Hopefully this commit can cut down on the number of network failures we've been
seeing!
2017-02-26 15:15:23 +00:00
Vadim Petrochenkov
9e054cf59d Fix tests on Windows in Debug configuration (#4) 2017-02-26 09:39:25 -05:00
Josef Brandl
912ce53604 Loop docs: Present perfect instead of simple past 2017-02-26 15:33:45 +01:00
bors
72e6d40f81 Auto merge of #40111 - alexcrichton:fix-manifests, r=brson
Attempt to fix nightly manifests

Found a few bugs and mistakes with the manifests.

Closes #40106
2017-02-26 12:58:08 +00:00
Alex Crichton
c08f3824cd travis: Make more network requests retryable
This commit attempts to move more network operations to being retryable through
various operations. For example git submodule updates, downloading snapshots,
etc, are now all in retryable steps.

Hopefully this commit can cut down on the number of network failures we've been
seeing!
2017-02-25 21:28:54 -08:00
bors
808dbcc9eb Auto merge of #40078 - tclfs:patch-3, r=GuillaumeGomez
Fix a typo
2017-02-26 05:22:08 +00:00
Alex Crichton
5ed6765fd4 build-manifest: Remove old to_hex function
This was actually just generating invalid hashes for the `rust`
component.
2017-02-25 20:20:09 -08:00
Alex Crichton
476a1cc244 build-manifest: Fix typos with rust-analysis
The name of the package is 'rust-analysis', not 'analysis', and then
name of the channel is 'nightly', not 'rust-nightly'
2017-02-25 20:20:04 -08:00
Paul Merrill
1eb3432673 doc: Use "macOS" terminology consistently
One line in the documentation used the term macOS while the other six
used OSX. Be consistent and use the name current product brand of macOS.
2017-02-25 15:47:41 -08:00
Yamakaky
c8b17427c2
typo 2017-02-25 16:12:51 -05:00
Vadim Petrochenkov
53a5d56435 Fix tests on ARM Linux (#3) 2017-02-25 09:18:17 -05:00
bors
1572bf104d Auto merge of #40091 - eddyb:rollup, r=eddyb
Rollup of 28 pull requests

- Successful merges: #39859, #39864, #39888, #39903, #39905, #39914, #39945, #39950, #39953, #39961, #39980, #39988, #39993, #39995, #40019, #40020, #40022, #40024, #40025, #40026, #40027, #40031, #40035, #40037, #40038, #40064, #40069, #40086
- Failed merges: #39927, #40008, #40047
2017-02-25 12:29:32 +00:00
Eduard-Mihai Burtescu
207c763060 Rollup merge of #40086 - danobi:move-compiler_tests, r=brson
Move COMPILER_TESTS.md out of the root directory

See #39896.

r? @brson
2017-02-25 14:13:43 +02:00
Eduard-Mihai Burtescu
49c8d58662 Rollup merge of #40069 - Rufflewind:master, r=steveklabnik
Add Gankro's table to nomicon/src/phantom-data.md

Original: https://github.com/rust-lang/rust/issues/30069#issuecomment-159928136

Testing confirms that:

  - `PhantomData<fn() -> T>` does not actually enable drop checking.
  - `PhantomData<fn(T) -> T>` is neither variant nor contravariant.
2017-02-25 14:13:42 +02:00
Eduard-Mihai Burtescu
ecae5bf785 Rollup merge of #40064 - arielb1:virtual-enum, r=nikomatsakis
trans: don't ICE when trying to create ADT trans-items

ADTs are translated in-place from rustc_trans::callee, so no trans-items
are needed.

This fix will be superseded by the shimmir branch, but I prefer not to
backport that to beta.

Fixes #39823.

Beta-nominating because regression.

r? @michaelwoerister
2017-02-25 14:13:41 +02:00
Eduard-Mihai Burtescu
393d80dfdd Rollup merge of #40038 - nikomatsakis:issue-39828, r=michaelwoerister
detect "bootstrap outputs" when serializing the dep-graph

Fixes #39828.

r? @michaelwoerister
2017-02-25 14:13:39 +02:00
Eduard-Mihai Burtescu
582d5d9793 Rollup merge of #40037 - froydnj:overflow-checks, r=alexcrichton
add `-C overflow-checks` option

In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks.  This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks.

I was seeing a [run-pass/issue-28950.rs](b1363a73ed/src/test/run-pass/issue-28950.rs) failure on my machine with these patches, but I was also seeing the failure without the changes to the core compiler.  We'll see what travis says.

Fixes #33134.  r? @alexcrichton
2017-02-25 14:13:38 +02:00
Eduard-Mihai Burtescu
4f9d6d6c9f Rollup merge of #40035 - er-1:master, r=alexcrichton
Ignore ASM tests on powerpc

Part of #39015
2017-02-25 14:13:37 +02:00
Eduard-Mihai Burtescu
6ffc9e4a33 Rollup merge of #40031 - cynicaldevil:master, r=est31
Added test for inclusive_range_syntax in compile-fail test suite

Fixes #39059
r? @est31

Forgot to leave a comment on the issue, hopefully nobody else is working on this one!
2017-02-25 14:13:36 +02:00
Eduard-Mihai Burtescu
69e596744f Rollup merge of #40027 - cramertj:stabilize_static_recursion, r=nrc
Stabilize static_recursion

Fix #29719.
2017-02-25 14:13:35 +02:00
Eduard-Mihai Burtescu
f1350408c9 Rollup merge of #40026 - nrc:analysis-manifest, r=alexcrichton
Add save-analysis data to nightly manifests.

For use by RLS.

r? @alexcrichton
2017-02-25 14:13:34 +02:00
Eduard-Mihai Burtescu
c3075f3d96 Rollup merge of #40025 - est31:master, r=eddyb
Implement non-capturing closure to fn coercion

Implements non capturing closure coercion ([RFC 1558](https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md)).

cc tracking issue #39817
2017-02-25 14:13:33 +02:00
Eduard-Mihai Burtescu
32af4ceb04 Rollup merge of #40024 - raphlinus:readdir, r=alexcrichton
Switch Fuchsia to readdir (instead of readdir_r)

The readdir_r function is deprecated on newer Posix systems because of
various problems, and not implemented at all for Fuchsia. There are
already implementations using both, and this patch switches Fuchsia
over to the readdir-based one.

Fixes #40021 for Fuchsia, but that issue also contains discussion of
what should happen for other Posix systems.
2017-02-25 14:13:32 +02:00
Eduard-Mihai Burtescu
ebde617c7d Rollup merge of #40022 - wagenet:lib-defaults, r=alexcrichton
Better handling of lib defaults

r? @alexcrichton
2017-02-25 14:13:31 +02:00
Eduard-Mihai Burtescu
3ece892490 Rollup merge of #40020 - alexcrichton:fix-unwind-safe, r=sfackler
std: Relax UnwindSafe impl for Unique

Add the `?Sized` bound as we don't require the type to be sized.

Closes #40011
2017-02-25 14:13:31 +02:00
Eduard-Mihai Burtescu
411d8e95db Rollup merge of #40019 - alexcrichton:fix-musl, r=brson
travis: Compile a more compatible libc.a for musl

The mitigations for #34978 involve passing `-Wa,-mrelax-relocations=no` to all C
code we compile, and we just forgot to pass it when compiling musl itself.

Closes #39979
2017-02-25 14:13:30 +02:00
Eduard-Mihai Burtescu
5c0b4b3691 Rollup merge of #39995 - Aatch:vtable-ptr-metadata, r=arielb1
Set metadata for vtable-related loads

Give LLVM much more information about vtable pointers. Without the extra
information, LLVM has to be rather pessimistic about vtables, preventing
a number of obvious optimisations.

* Makes the vtable pointer argument noalias and readonly.
* Marks loads of the vtable pointer as nonnull.
* Marks load from the vtable with `!invariant.load` metadata.

Fixes #39992
2017-02-25 14:13:28 +02:00
Eduard-Mihai Burtescu
0a950bdb3d Rollup merge of #39993 - japaric:incr-san, r=alexcrichton
incr-comp: track the -Z sanitizer flag

closes #39611

r? @michaelwoerister
2017-02-25 14:13:27 +02:00
Eduard-Mihai Burtescu
d78a7fcea4 Rollup merge of #39988 - arthurprs:hm-adapt2, r=alexcrichton
Simplify/fix adaptive hashmap

Please see https://github.com/rust-lang/rust/pull/38368#issuecomment-280957863 for context.

The shift length math is broken. It turns out that checking for the shift length is complicated. Using simulations it's possible to see that a value of 2000 will only get probabilities down to ~1e-7 when the hashmap load factor is 90% (rust goes up to 90.9% as of today). That's probably not good enough to go into the stdlib with pluggable hashers.

So this PR simplify the adaptive behavior to only consider displacement, which is much safer and very useful by itself.

There's two comments because one of them is already being tested to be merged by bors.
2017-02-25 14:13:26 +02:00
Eduard-Mihai Burtescu
33c19129c3 Rollup merge of #39980 - arielb1:privately-uninhabited, r=nikomatsakis
check_match: don't treat privately uninhabited types as uninhabited

Fixes #38972, which is a regression in 1.16 from @canndrew's patchset.

r? @nikomatsakis

beta-nominating because regression.
2017-02-25 14:13:25 +02:00
Eduard-Mihai Burtescu
ef043a7c43 Rollup merge of #39961 - redox-os:redox, r=alexcrichton
Fix compilation on Redox

This updates the Redox sys module to fix compilation.

The functions peek and peek_from are added to TcpStream and UdpSocket as stubs. The sys::backtrace module is now included correctly
2017-02-25 14:13:24 +02:00
Eduard-Mihai Burtescu
a6a5c32e0e Rollup merge of #39953 - keeperofdakeys:macro-error, r=jseyfried
Provide suggestions for unknown macros imported with `use`

cc https://github.com/rust-lang/rust/issues/30197

r? @jseyfried
2017-02-25 14:13:23 +02:00
Eduard-Mihai Burtescu
be66a607da Rollup merge of #39950 - ishitatsuyuki:stop-trashing-ldpath, r=alexcrichton
bootstrap: stop trashing (DY)LD_LIBRARY_PATH

This generated an ugly error with fakeroot before.
2017-02-25 14:13:22 +02:00
Eduard-Mihai Burtescu
16202862b2 Rollup merge of #39945 - petrochenkov:llvmtarg, r=alexcrichton
Use ARM instead of SystemZ for testing uninstalled targets

This needs some explanation.
`config.toml` has section `targets` listing backends that are built during LLVM build:
```
targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX"
```
It would be reasonable to expect that `targets = "X86"` would be enough for doing a local build in typical case (building on x86 and not working on some non-x86 platform-specific functionality).
However, for `x.py test` to pass successfully you have to add ARM and SystemZ to the target list as well (`targets = "X86;ARM;SystemZ"`), because two tests (`compile-fail/issue-37131.rs` and `run-make\target-without-atomics`) require these architectures to be enabled in LLVM.
This patch moves `compile-fail/issue-37131.rs` from SystemZ to ARM, so `targets = "X86;ARM"` becomes sufficient for running the full test suite without errors.
2017-02-25 14:13:21 +02:00
Eduard-Mihai Burtescu
a8ab222fd5 Rollup merge of #39914 - raphlinus:mx_handle_wait, r=alexcrichton
Follow rename of mx_handle_wait Magenta syscalls

The mx_handle_wait_* syscalls in Magenta were renamed to
mx_object_wait. The syscall is used in the Magenta/Fuchsia
implementation of std::process, to wait on child processes.

In addition, this patch enables the use of the system provided
libbacktrace library on Fuchsia targets. Symbolization is not yet
working, but at least it allows printing hex addresses in a backtrace
and makes building succeed when the backtrace feature is not disabled.
2017-02-25 14:13:20 +02:00
Eduard-Mihai Burtescu
aa7eb65123 Rollup merge of #39905 - estebank:useless-error, r=arielb1
Properly display note/expected details

Given a file

```rust
fn takes_cb(f: fn(i8)) {}

fn main() {
    fn callback(x: i32) {}
    takes_cb(callback)
}
```

output

```rust
error[E0308]: mismatched types
 --> file2.rs:5:22
  |
5 |             takes_cb(callback)
  |                      ^^^^^^^^ expected i8, found i32
  |
  = note: expected type `fn(i8)`
             found type `fn(i32) {main::callback}`
```

Fix #39343.
2017-02-25 14:13:19 +02:00
Eduard-Mihai Burtescu
a6924177e4 Rollup merge of #39903 - binarycrusader:issue-39901, r=alexcrichton
add solaris sparcv9 support

Fixes #39901
2017-02-25 14:13:18 +02:00
Eduard-Mihai Burtescu
e31d46402d Rollup merge of #39888 - nagisa:on-fail-bootstrap, r=alexcrichton
[rustbuild] add a way to run command after failure

This is a simple way to workaround the debugging issues caused by the rustc
wrapper used in the bootstrap process. Namely, it uses some obscure environment
variables and you can't just copy the failed command and run it in the shell or
debugger to examine the failure more closely.

With `--on-fail` its possible to run an arbitrary command within exactly the
same environment under which rustc failed. Theres's multiple ways to use this
new flag:

$ python x.py build --stage=1 --on-fail=env

    would print a list of environment variables and the failed command, so a
    few copy-pastes and you now can run the same rust in your shell outside the
    bootstrap system.

$ python x.py build --stage=1 --on-fail=bash

    Is a more useful variation of the command above in that it launches a whole
    shell with environment already in place! All that's left to do is copy-paste
    the command just above the shell prompt!

Fixes #38686
Fixes #38221
2017-02-25 14:13:17 +02:00
Eduard-Mihai Burtescu
ad9079bae4 Rollup merge of #39864 - cramertj:normalize-breaks, r=nikomatsakis
Normalize labeled and unlabeled breaks

Part of #39849.
2017-02-25 14:13:16 +02:00
Eduard-Mihai Burtescu
46fed6e6fa Rollup merge of #39859 - GuillaumeGomez:rustdoc-test-relative-path, r=alexcrichton
Set rustdoc --test files' path relative to the current directory

r? @alexcrichton
2017-02-25 14:13:15 +02:00