Corey Farwell [Thu, 9 Feb 2017 13:47:35 +0000 (08:47 -0500)]
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
Corey Farwell [Thu, 9 Feb 2017 13:47:32 +0000 (08:47 -0500)]
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.
bors [Thu, 9 Feb 2017 11:42:49 +0000 (11:42 +0000)]
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)
Corey Farwell [Thu, 9 Feb 2017 04:55:51 +0000 (23:55 -0500)]
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.
Corey Farwell [Thu, 9 Feb 2017 04:55:44 +0000 (23:55 -0500)]
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.
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
```
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
```
Alex Crichton [Thu, 9 Feb 2017 01:13:46 +0000 (17:13 -0800)]
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.
bors [Wed, 8 Feb 2017 20:49:24 +0000 (20:49 +0000)]
Auto merge of #39523 - alexcrichton:fpic, r=aturon
Pass -fPIC to native compiles on 32-bit
This is apparently a regression from 1.14.0 to 1.15.0. Previously we
passed `-fPIC` to C compilers on i686 targets, but the `gcc` crate
apparently [explicitly] didn't do this. I don't recall why that was
avoided but it was [previously passed by the makefiles][mk] and this
seems to have [caused a regression][regression] in Firefox, so this
commit reverts back to passing `-fPIC`.
Corey Farwell [Wed, 8 Feb 2017 15:19:50 +0000 (10:19 -0500)]
Rollup merge of #39557 - bjorn3:pp-docs, r=jseyfried
A few documentation improvements for `syntax::print::pp`
* Moved algorithm explanation to module docs
* Added ``` before and after the examples
* Explanation of the `rbox`, `ibox` and `cbox` names
* Added docs about the breaking types to `Breaks`
The original design of `try_wait` was patterned after the `Read` and
`Write` traits, which support both blocking and non-blocking
implementations in a single API. But since `try_wait` is never blocking,
it makes sense to optimize for the non-blocking case.
Corey Farwell [Wed, 8 Feb 2017 03:54:25 +0000 (22:54 -0500)]
Rollup merge of #39431 - alexcrichton:no-more-makefiles, r=brson
Delete the makefile build system
This PR deletes the makefile build system in favor of the rustbuild build system. The beta has now been branched so 1.16 will continue to be buildable from the makefiles, but going forward 1.17 will only be buildable with rustbuild.
Rustbuild has been the default build system [since 1.15.0](https://github.com/rust-lang/rust/pull/37817) and the makefiles were [proposed for deletion](https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368) at this time back in November of last year.
And now with the deletion of these makefiles we can start getting those sweet sweet improvements of using crates.io crates in the compiler!
Corey Farwell [Wed, 8 Feb 2017 03:54:23 +0000 (22:54 -0500)]
Rollup merge of #39400 - alexcrichton:arm-cross-test, r=brson
Add support for test suites emulated in QEMU
This commit adds support to the build system to execute test suites that cannot
run natively but can instead run inside of a QEMU emulator. A proof-of-concept
builder was added for the `arm-unknown-linux-gnueabihf` target to show off how
this might work.
In general the architecture is to have a server running inside of the emulator
which a local client connects to. The protocol between the server/client
supports compiling tests on the host and running them on the target inside the
emulator.
Corey Farwell [Wed, 8 Feb 2017 03:54:21 +0000 (22:54 -0500)]
Rollup merge of #39372 - seanmonstar:more-addr-froms, r=alexcrichton
A few ergonomic From impls for SocketAddr/IpAddr
My main motivation is removing things like this: `"127.0.0.1:3000".parse().unwrap()`. Instead, this now works: `SocketAddr::from(([127, 0, 0, 1], 3000))` or even `([127, 0, 0, 1], 3000).into())` when passing to a function.
Corey Farwell [Wed, 8 Feb 2017 03:54:20 +0000 (22:54 -0500)]
Rollup merge of #39361 - cengizIO:master, r=arielb1
Improve error message for uninferrable types #38812
Hello,
I tried to improve the error message for uninferrable types. The error code is `E0282`.
```rust
error[E0282]: type annotations needed
--> /home/cengizIO/issue38812.rs:2:11
|
2 | let x = vec![];
| - ^^^^^^ cannot infer type for `T`
| |
| consider giving `x` a type
|
= note: this error originates in a macro outside of the current crate
```
and
```rust
error[E0282]: type annotations needed
--> /home/cengizIO/issue38812.rs:2:15
|
2 | let (x,) = (vec![],);
| ---- ^^^^^^ cannot infer type for `T`
| |
| consider giving a type to pattern
|
= note: this error originates in a macro outside of the current crate
```
Rust compiler now tries to find uninferred `local`s with type `_` and adds them into the error message.
I'm probably wrong on wording that I used. Please feel free to suggest better alternatives.
bors [Wed, 8 Feb 2017 00:03:42 +0000 (00:03 +0000)]
Auto merge of #39324 - clarcharr:ipv6_u128, r=alexcrichton
Ipv6Addr <-> u128
Because we have `u128` now, it makes sense to add a conversion between `Ipv6Addr` and `u128` in addition to the existing one between `Ipv4Addr` and `u32`.
This shouldn't violate the existing feature gate on `u128` because you can't use the type without the feature gate, but if i have to add something, I can.
The original design of `try_wait` was patterned after the `Read` and
`Write` traits, which support both blocking and non-blocking
implementations in a single API. But since `try_wait` is never blocking,
it makes sense to optimize for the non-blocking case.
Unfortunately 128-bit atomics have broken our nightly builds (#39590) and while we investigate I'm posting a temporary revert of the PR that added them. If we can figure out a solution though before this lands I'd be happy to close!
bjorn3 [Sun, 5 Feb 2017 08:44:49 +0000 (09:44 +0100)]
A few documentation improvements for `syntax::print::pp`
* Moved algorithm explanation to module docs
* Added ``` before and after the examples
* Explanation of the `rbox`, `ibox` and `cbox` names
* Added docs about the breaking types to `Breaks`
* 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.
Alex Crichton [Fri, 27 Jan 2017 22:48:48 +0000 (14:48 -0800)]
rustbuild: Fix a few locations with makefiles gone
* Add version info to channel.rs as main.mk is no longer available
* Update `Makefile.in` used with bootstrap to not try to require `mk/util.mk`
* Update the `dist` target to avoid the makefile pieces