Commit Graph

61708 Commits

Author SHA1 Message Date
Corey Farwell
3eaca413fe Rollup merge of #39619 - michaelwoerister:rename-crate-metadata, r=alexcrichton
Choose different name for metadata obj-file to avoid clashes with user-chosen names.

Fixes #39585 and probably https://github.com/rust-lang/rust/issues/39508.
Incremental compilation assigns different names to obj-files than regular compilation. If a crate is called "metadata" this can lead to a clash between the root module's obj-file and the obj-file containing crate-metadata. This PR assigns a name to the metadata obj-file that cannot clash with other obj-file because it contains a `.` which is not allowed in a Rust module identifier.

r? @alexcrichton

cc @nikomatsakis
2017-02-09 12:14:19 -05:00
Corey Farwell
a05cc5ca9d Rollup merge of #39604 - est31:i128_tests, r=alexcrichton
Unignore u128 test for stage 0,1

Even more SNAP cleanup.

Follow-up of #39519.

Sorry, I didn't check twice.
2017-02-09 12:14:18 -05:00
bors
4053276354 Auto merge of #38109 - tromey:main-subprogram, r=michaelwoerister
Emit DW_AT_main_subprogram

This changes rustc to emit DW_AT_main_subprogram on the "main" program.
This lets gdb suitably stop at the user's main in response to
"start" (rather than the library's main, which is what happens
currently).

Fixes #32620
r? michaelwoerister
2017-02-09 17:09:50 +00:00
Alex Burka
ca9c7ae61b driver: restore partially deleted comment 2017-02-09 12:07:58 -05:00
Oliver Schneider
c7f9811aba removed unused struct 2017-02-09 17:58:26 +01:00
Oliver Schneider
1095082eea remove wrong packed struct test 2017-02-09 17:55:39 +01:00
Andrew Cann
347bc77c2c Use global recursion limit when evaluating inhabitedness 2017-02-10 00:52:51 +08:00
bors
e7fc53b8f0 Auto merge of #39686 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #39595, #39601, #39602, #39615, #39647
- Failed merges:
2017-02-09 14:25:04 +00:00
Corey Farwell
116bdacf6b Rollup merge of #39647 - japaric:sparc, r=alexcrichton
build std for sparc64-unknown-linux-gnu

r? @alexcrichton

panicking / unwinding is broken (#39646) but with std available at least people
will be able to debug that issue on real hardware
2017-02-09 08:47:36 -05:00
Corey Farwell
8f65d7543b Rollup merge of #39615 - phungleson:corefloat, r=alexcrichton
Improve format float

* Move float into mod float like in test
* Add more tests for f64 f32, lower exp, upper exp, which can come if handy in the future if we want refactor further
* Use `assert_eq` for clearer error messages
2017-02-09 08:47:35 -05:00
Corey Farwell
e32e2d47d0 Rollup merge of #39602 - estebank:fix-39544, r=eddyb
Fix ICE when accessing mutably an immutable enum

Fix #39544.
2017-02-09 08:47:34 -05:00
Corey Farwell
f447c2b443 Rollup merge of #39601 - dumbbell:update-liblibc-to-include-aarch64-unknown-freebsd, r=alexcrichton
liblibc: Update to include `aarch64-unknown-freebsd` support
2017-02-09 08:47:33 -05:00
Corey Farwell
15decb86b2 Rollup merge of #39595 - camlorn:structured_repr, r=eddyb
Make reprs use a structured representation instead of a slice

This is needed for `-z reorder-fields`.  The old design uses a slice taken from HIR, plus a cache that lazily parses.  The new design stores it directly in the `AdtDef` as a `ReprOptions`.  We're doing this now because we need to be able to add reprs that don't necessarily exist in HIR for `-z reorder-fields`, but it needs to happen anyway.

`lookup_repr_hints` should be mostly deprecated.  I want to remove it from `layout` before closing this, unless people think that should be a separate PR.  The `[WIP]` is because of this.  The problem with closing this as-is is that the code here isn't actually testable until some parts of the compiler start using it.

r? @eddyb
2017-02-09 08:47:32 -05:00
bors
1129ce51a6 Auto merge of #39265 - est31:master, r=petrochenkov
Stabilize static lifetime in statics

Stabilize the "static_in_const" feature. Blockers before this PR can be merged:

* [x] The [FCP with inclination to stabilize](https://github.com/rust-lang/rust/issues/35897#issuecomment-270441437) needs to be over. FCP lasts roughly three weeks, so will be over at Jan 25, aka this thursday.
* [x] Documentation needs to be added (#37928)

Closes #35897.
2017-02-09 11:42:49 +00:00
Scott Olson
5eaa7c2d7d Fix unaligned load in librustc_metadata::index. 2017-02-09 03:38:52 -08:00
Scott Olson
2589f4a751 Fix indentation in test. 2017-02-09 03:10:33 -08:00
Scott Olson
b8b898093c Avoid unsafe unaligned loads in test. 2017-02-09 03:09:36 -08:00
Andrew Cann
2bb9c5875d Add recursion limit to inhabitedness check
Fixes #39489.
Add test aswell.
2017-02-09 17:34:45 +08:00
Marc-Antoine Perennou
ec73ef9dc8 Merge branch 'master' of git://github.com/rust-lang/rust
* 'master' of git://github.com/rust-lang/rust: (70 commits)
  sanitizer-dylib: only run where std for x86_64-linux is available
  travis: Fix build order of dist-x86-linux
  fix the sanitizer-dylib test on non x86_64 linux hosts
  dist-x86-linux: install newer kernel headers
  enable sanitizers on build job that tests x86_64 linux
  enable sanitizers on x86_64-linux releases
  use helper function in the rebuild logic of the rustc_*san crates
  build/test the sanitizers only when --enable-sanitizers is used
  sanitizer support
  Add missing urls on join_paths
  Add test for #27433
  Add more examples, get everything passing at last.
  Remove some leftover makefiles.
  Add more test for rustdoc --test
  Rename manifest_version to manifest-version
  reference: clarify #[cfg] section
  Bump stable release date
  rustbuild: Clean build/dist on `make clean`
  Add missing urls for current_dir
  review nits
  ...
2017-02-09 10:11:36 +01:00
bors
b0e46f03d8 Auto merge of #39586 - arielb1:packed-values, r=eddyb
emit "align 1" metadata on loads/stores of packed structs

According to the LLVM reference:
> A value of 0 or an omitted align argument means that the operation has
the ABI alignment for the target.

So loads/stores of fields of packed structs need to have their align set
to 1. Implement that by tracking the alignment of `LvalueRef`s.

Fixes #39376.

r? @eddyb
2017-02-09 09:02:43 +00:00
Andrew Cann
18be42c5d7 Fix tests 2017-02-09 16:36:20 +08:00
Andrew Cann
5429305e5d Add test for #39485 2017-02-09 15:43:25 +08:00
Andrew Cann
d87644cc0f Small inference fix
As per comment: https://github.com/rust-lang/rust/issues/39297#issuecomment-276810343
2017-02-09 15:43:25 +08:00
Vadim Chugunov
d113b39fbf Exclude top-level macro expansions from source location override. 2017-02-08 22:10:33 -08:00
bors
fd2f8a4536 Auto merge of #39677 - frewsxcv:rollup, r=frewsxcv
Rollup of 9 pull requests

- Successful merges: #37928, #38699, #39589, #39598, #39599, #39641, #39649, #39653, #39671
- Failed merges:
2017-02-09 05:58:29 +00:00
Corey Farwell
1e3e904101 Rollup merge of #39671 - alexcrichton:change-order, r=brson
travis: Fix build order of dist-x86-linux

I just tried to build this container locally but it looks like connecting to
ftp.gnu.org requires SNI, so let's build curl/OpenSSL first to ensure that we've
got an SNI-capable client to download gcc/binutils with.
2017-02-08 23:55:51 -05:00
Corey Farwell
44fdf5bcd7 Rollup merge of #39653 - JanZerebecki:test-issue-27433, r=alexcrichton
Add test for #27433
2017-02-08 23:55:50 -05:00
Corey Farwell
4f8adb6831 Rollup merge of #39649 - GuillaumeGomez:join_paths-url, r=frewsxcv
Add missing urls on join_paths

r? @frewsxcv
2017-02-08 23:55:49 -05:00
Corey Farwell
ab7e51b2f7 Rollup merge of #39641 - Ms2ger:purge-mk, r=alexcrichton
Remove some leftover makefiles.
2017-02-08 23:55:48 -05:00
Corey Farwell
9f2795f7bd Rollup merge of #39599 - alexcrichton:cargo-tarball-name, r=brson
Fix a manifest-generation bug on beta

Right now all Cargo release tarballs are 'nightly', they're not on the standard
channels yet.
2017-02-08 23:55:47 -05:00
Corey Farwell
a7017b582c Rollup merge of #39598 - alexcrichton:cargo-branch, r=brson
Fix branch name Cargo's downloaded from

This landed on beta in #39546 and this is bringing the patch back to master.
2017-02-08 23:55:45 -05:00
Corey Farwell
4f6868aa01 Rollup merge of #39589 - ollie27:rustdoc_impl_disambiguation, r=alexcrichton
rustdoc: Improve impl disambiguation

* Don't disambiguate if there are multiple impls for the same type.
* Disambiguate for impls of &Foo and &mut Foo.
* Don't try to disambiguate generic types.

[before](https://doc.rust-lang.org/nightly/std/ops/trait.Rem.html#implementors) [after](https://ollie27.github.io/rust_doc_test/std/ops/trait.Rem.html#implementors)
2017-02-08 23:55:44 -05:00
Corey Farwell
3053494a9a Rollup merge of #38699 - japaric:lsan, r=alexcrichton
LeakSanitizer, ThreadSanitizer, AddressSanitizer and MemorySanitizer support

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

$ edit Cargo.toml && tail -n3 $_
```

``` toml
[profile.dev]
opt-level = 1
```

```
$ edit src/main.rs && cat $_
```

``` rust
use std::mem;

fn main() {
    let xs = vec![0, 1, 2, 3];
    mem::forget(xs);
}
```

```
$ RUSTFLAGS="-Z sanitizer=leak" cargo run --target x86_64-unknown-linux-gnu; echo $?
    Finished dev [optimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/leak`

=================================================================
==10848==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x557c3488db1f in __interceptor_malloc /shared/rust/checkouts/lsan/src/compiler-rt/lib/lsan/lsan_interceptors.cc:55
    #1 0x557c34888aaa in alloc::heap::exchange_malloc::h68f3f8b376a0da42 /shared/rust/checkouts/lsan/src/liballoc/heap.rs:138
    #2 0x557c34888afc in leak::main::hc56ab767de6d653a $PWD/src/main.rs:4
    #3 0x557c348c0806 in __rust_maybe_catch_panic ($PWD/target/debug/leak+0x3d806)

SUMMARY: LeakSanitizer: 16 byte(s) leaked in 1 allocation(s).
23
```

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

$ edit src/main.rs && cat $_
```

``` rust
use std::thread;

static mut ANSWER: i32 = 0;

fn main() {
    let t1 = thread::spawn(|| unsafe { ANSWER = 42 });
    unsafe {
        ANSWER = 24;
    }
    t1.join().ok();
}
```

```
$ RUSTFLAGS="-Z sanitizer=thread" cargo run --target x86_64-unknown-linux-gnu; echo $?
==================
WARNING: ThreadSanitizer: data race (pid=12019)
  Write of size 4 at 0x562105989bb4 by thread T1:
    #0 racy::main::_$u7b$$u7b$closure$u7d$$u7d$::hbe13ea9e8ac73f7e $PWD/src/main.rs:6 (racy+0x000000010e3f)
    #1 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::h2e466a92accacc78 /shared/rust/checkouts/lsan/src/libstd/panic.rs:296 (racy+0x000000010cc5)
    #2 std::panicking::try::do_call::h7f4d2b38069e4042 /shared/rust/checkouts/lsan/src/libstd/panicking.rs:460 (racy+0x00000000c8f2)
    #3 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56)
    #4 std::panic::catch_unwind::h31ca45621ad66d5a /shared/rust/checkouts/lsan/src/libstd/panic.rs:361 (racy+0x00000000b517)
    #5 std:🧵:Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::hccfc37175dea0b01 /shared/rust/checkouts/lsan/src/libstd/thread/mod.rs:357 (racy+0x00000000c226)
    #6 _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hd880bbf91561e033 /shared/rust/checkouts/lsan/src/liballoc/boxed.rs:605 (racy+0x00000000f27e)
    #7 std::sys:👿🧵:Thread:🆕:thread_start::hebdfc4b3d17afc85 <null> (racy+0x0000000abd40)

  Previous write of size 4 at 0x562105989bb4 by main thread:
    #0 racy::main::h23e6e5ca46d085c3 $PWD/src/main.rs:8 (racy+0x000000010d7c)
    #1 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56)
    #2 __libc_start_main <null> (libc.so.6+0x000000020290)

  Location is global 'racy::ANSWER::h543d2b139f819b19' of size 4 at 0x562105989bb4 (racy+0x0000002f8bb4)

  Thread T1 (tid=12028, running) created by main thread at:
    #0 pthread_create /shared/rust/checkouts/lsan/src/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:902 (racy+0x00000001aedb)
    #1 std::sys:👿🧵:Thread:🆕:hce44187bf4a36222 <null> (racy+0x0000000ab9ae)
    #2 std:🧵:spawn::he382608373eb667e /shared/rust/checkouts/lsan/src/libstd/thread/mod.rs:412 (racy+0x00000000b5aa)
    #3 racy::main::h23e6e5ca46d085c3 $PWD/src/main.rs:6 (racy+0x000000010d5c)
    #4 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56)
    #5 __libc_start_main <null> (libc.so.6+0x000000020290)

SUMMARY: ThreadSanitizer: data race $PWD/src/main.rs:6 in racy::main::_$u7b$$u7b$closure$u7d$$u7d$::hbe13ea9e8ac73f7e
==================
ThreadSanitizer: reported 1 warnings
66
```

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

$ edit src/main.rs && cat $_
```

``` rust
fn main() {
    let xs = [0, 1, 2, 3];
    let y = unsafe { *xs.as_ptr().offset(4) };
}
```

```
$ RUSTFLAGS="-Z sanitizer=address" cargo run --target x86_64-unknown-linux-gnu; echo $?
=================================================================
==13328==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff29f3ecd0 at pc 0x55802dc6bf7e bp 0x7fff29f3ec90 sp 0x7fff29f3ec88
READ of size 4 at 0x7fff29f3ecd0 thread T0
    #0 0x55802dc6bf7d in oob::main::h0adc7b67e5feb2e7 $PWD/src/main.rs:3
    #1 0x55802dd60426 in __rust_maybe_catch_panic ($PWD/target/debug/oob+0xfe426)
    #2 0x55802dd58dd9 in std::rt::lang_start::hb2951fc8a59d62a7 ($PWD/target/debug/oob+0xf6dd9)
    #3 0x55802dc6c002 in main ($PWD/target/debug/oob+0xa002)
    #4 0x7fad8c3b3290 in __libc_start_main (/usr/lib/libc.so.6+0x20290)
    #5 0x55802dc6b719 in _start ($PWD/target/debug/oob+0x9719)

Address 0x7fff29f3ecd0 is located in stack of thread T0 at offset 48 in frame
    #0 0x55802dc6bd5f in oob::main::h0adc7b67e5feb2e7 $PWD/src/main.rs:1

  This frame has 1 object(s):
    [32, 48) 'xs' <== Memory access at offset 48 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow $PWD/src/main.rs:3 in oob::main::h0adc7b67e5feb2e7
Shadow bytes around the buggy address:
  0x1000653dfd40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfd50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfd60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfd70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x1000653dfd90: 00 00 00 00 f1 f1 f1 f1 00 00[f3]f3 00 00 00 00
  0x1000653dfda0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfdb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfdc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfdd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000653dfde0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==13328==ABORTING
1
```

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

$ edit src/main.rs && cat $_
```

``` rust
use std::mem;

fn main() {
    let xs: [u8; 4] = unsafe { mem::uninitialized() };
    let y = xs[0] + xs[1];
}
```

```
$ RUSTFLAGS="-Z sanitizer=memory" cargo run; echo $?
==30198==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x563f4b6867da in uninit::main::hc2731cd4f2ed48f8 $PWD/src/main.rs:5
    #1 0x563f4b7033b6 in __rust_maybe_catch_panic ($PWD/target/debug/uninit+0x873b6)
    #2 0x563f4b6fbd69 in std::rt::lang_start::hb2951fc8a59d62a7 ($PWD/target/debug/uninit+0x7fd69)
    #3 0x563f4b6868a9 in main ($PWD/target/debug/uninit+0xa8a9)
    #4 0x7fe844354290 in __libc_start_main (/usr/lib/libc.so.6+0x20290)
    #5 0x563f4b6864f9 in _start ($PWD/target/debug/uninit+0xa4f9)

SUMMARY: MemorySanitizer: use-of-uninitialized-value $PWD/src/main.rs:5 in uninit::main::hc2731cd4f2ed48f8
Exiting
77
```
2017-02-08 23:55:43 -05:00
Corey Farwell
7f7dc764f5 Rollup merge of #37928 - chriskrycho:document-rfc-1623, r=steveklabnik
Document RFC 1623: static lifetime elision.

This should be the last item required for stabilizing RFC 1623 (#35897).
2017-02-08 23:55:42 -05:00
Alex Crichton
de59d5d737 Actually fix manifest generation
The previous fix contained an error where `toml::encode` returned a runtime
error, so this version just constructs a literal `toml::Value`.
2017-02-08 20:49:58 -08:00
Jorge Aparicio
e180dd541a sanitizer-dylib: only run where std for x86_64-linux is available 2017-02-08 22:58:53 -05:00
Jeremy Soller
cbafac5ba1 Fix compilation on Redox 2017-02-08 20:01:57 -07:00
Jeffrey Seyfried
66bd8eede5 Fix ICE when parsing token trees after an error. 2017-02-09 03:01:54 +00:00
Alex Crichton
8fc0b37428 travis: Fix build order of dist-x86-linux
I just tried to build this container locally but it looks like connecting to
ftp.gnu.org requires SNI, so let's build curl/OpenSSL first to ensure that we've
got an SNI-capable client to download gcc/binutils with.
2017-02-08 17:13:46 -08:00
Jan Zerebecki
0dbdb2d0d0 Fix mailmap for @gifnksm
cc rust-lang-nursery/thanks#71
2017-02-09 02:10:14 +01:00
Henning Kowalk
8251a2d73f Fix missing article. 2017-02-09 01:18:50 +01:00
Jorge Aparicio
78a11f1b97 fix the sanitizer-dylib test on non x86_64 linux hosts 2017-02-08 18:51:43 -05:00
Jorge Aparicio
1914c8e0ac dist-x86-linux: install newer kernel headers 2017-02-08 18:51:43 -05:00
Jorge Aparicio
47ae2393e6 enable sanitizers on build job that tests x86_64 linux 2017-02-08 18:51:43 -05:00
Jorge Aparicio
72058e4f4c enable sanitizers on x86_64-linux releases 2017-02-08 18:51:43 -05:00
Jorge Aparicio
22097e6827 use helper function in the rebuild logic of the rustc_*san crates 2017-02-08 18:51:43 -05:00
Jorge Aparicio
775a93646c build/test the sanitizers only when --enable-sanitizers is used 2017-02-08 18:51:43 -05:00
Jorge Aparicio
9af6aa3889 sanitizer support 2017-02-08 18:51:43 -05:00
Henning Kowalk
51ef003dea Fixed #39661
Clarified potential ambiguity.
2017-02-09 00:44:36 +01:00
Alex Crichton
67574ccd53 Don't include directory names in shasums
Right now we just run `shasum` on an absolute path but right now the shasum
files only include filenames, so let's use `current_dir` and just the file name
to only have the file name emitted.
2017-02-08 15:08:30 -08:00