]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoMake sure openssl compiles with only one core
Aidan Hobson Sayers [Wed, 26 Apr 2017 20:21:27 +0000 (21:21 +0100)]
Make sure openssl compiles with only one core

Fixes #40417

7 years agoAuto merge of #41420 - alexcrichton:mingw-6.3.0, r=petrochenkov
bors [Wed, 26 Apr 2017 15:12:30 +0000 (15:12 +0000)]
Auto merge of #41420 - alexcrichton:mingw-6.3.0, r=petrochenkov

appveyor: Upgrade to gcc for mingw 6.3.0

This commit sort of brings back #40777 by upgrading back to 6.3.0. While
investigating #40546 it was discovered that 6.3.0 appears to not spurious
fail in the same way that 6.2.0 does (which we're currently using). The
workaround for #40184 contained in #40777 did not work so this commit also
contains a different workaround for the gdb issue. We will not download the
6.2.0 version of gdb and use that instead of the default version that comes with
6.3.0.

I'm going to optimistically say...

Closes #40546

7 years agoappveyor: Upgrade to gcc for mingw 6.3.0
Alex Crichton [Thu, 20 Apr 2017 15:35:03 +0000 (08:35 -0700)]
appveyor: Upgrade to gcc for mingw 6.3.0

This commit sort of brings back #40777 by upgrading back to 6.3.0. While
investigating #40546 it was discovered that 6.3.0 appears to not spurious
fail in the same way that 6.2.0 does (which we're currently using). The
workaround for #40184 contained in #40777 did not work so this commit also
contains a different workaround for the gdb issue. We will not download the
6.2.0 version of gdb and use that instead of the default version that comes with
6.3.0.

I'm going to optimistically say...

Closes #40546

7 years agoAuto merge of #41352 - kennytm:macos-sanitizers, r=alexcrichton
bors [Wed, 26 Apr 2017 12:34:45 +0000 (12:34 +0000)]
Auto merge of #41352 - kennytm:macos-sanitizers, r=alexcrichton

Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin

[ASan](https://clang.llvm.org/docs/AddressSanitizer.html#supported-platforms) and [TSan](https://clang.llvm.org/docs/ThreadSanitizer.html#supported-platforms) are supported on macOS, and this commit enables their support.

The sanitizers are always built as `*.dylib` on Apple platforms, so they cannot be statically linked into the corresponding `rustc_?san.rlib`. The dylibs are directly copied to `lib/rustlib/x86_64-apple-darwin/lib/` instead.

Note, although Xcode also ships with their own copies of ASan/TSan dylibs, we cannot use them due to version mismatch.

----

~~There is a caveat: the sanitizer libraries are linked as `@rpath/` (due to https://reviews.llvm.org/D6018), so the user needs to additionally pass `-C rpath`:~~

**Edit:** Passing rpath is now automatic.

7 years agoAuto merge of #41504 - eddyb:query-api, r=nikomatsakis
bors [Wed, 26 Apr 2017 09:54:11 +0000 (09:54 +0000)]
Auto merge of #41504 - eddyb:query-api, r=nikomatsakis

Improve the librustc on-demand/query API ergonomics.

Queries are now performed through these two forms:
* `tcx.type_of(def_id)` (the most common usage)
* `tcx.at(span).type_of(def_id)` (to provide a more specific location in the cycle stack)

Several queries were renamed to work better as method names, i.e. by suffixing with `_of`.

r? @nikomatsakis

7 years agoAuto merge of #41258 - clarcharr:str_box_extras, r=Kimundi
bors [Wed, 26 Apr 2017 06:18:17 +0000 (06:18 +0000)]
Auto merge of #41258 - clarcharr:str_box_extras, r=Kimundi

More methods for str boxes. (reduce Box<[u8]> ↔ Box<str> transmutes)

This is a follow-up to #41096 that adds safer methods for converting between `Box<str>` and `Box<[u8]>`. They're gated under a different feature from the `&mut str` methods because they may be too niche to include in public APIs, although having them internally helps reduce the number of transmutes the standard library uses.

What's added:

* `From<Box<str>> for Box<[u8]>`
* `<Box<str>>::into_boxed_bytes` (just calls `Into::into`)
* `alloc::str` (new module)
* `from_boxed_utf8` and `from_boxed_utf8_unchecked`, defined in `alloc:str`, exported in `collections::str`
* exports `from_utf8_mut` in `collections::str` (missed from previous PR)

7 years agoAuto merge of #41551 - frewsxcv:rollup, r=frewsxcv
bors [Wed, 26 Apr 2017 03:26:12 +0000 (03:26 +0000)]
Auto merge of #41551 - frewsxcv:rollup, r=frewsxcv

Rollup of 9 pull requests

- Successful merges: #39983, #41442, #41463, #41500, #41518, #41527, #41528, #41530, #41535
- Failed merges:

7 years agoRollup merge of #41535 - steveklabnik:gh37746, r=alexcrichton
Corey Farwell [Wed, 26 Apr 2017 03:06:01 +0000 (23:06 -0400)]
Rollup merge of #41535 - steveklabnik:gh37746, r=alexcrichton

Fix up vec guarnatee around capacity

Fixes #37746

r? @rust-lang/libs

7 years agoRollup merge of #41530 - GuillaumeGomez:vec-from, r=aturon
Corey Farwell [Wed, 26 Apr 2017 03:06:00 +0000 (23:06 -0400)]
Rollup merge of #41530 - GuillaumeGomez:vec-from, r=aturon

Implement From<&mut [T]> for Vec

Fixes #41386.

7 years agoRollup merge of #41528 - steveklabnik:gh33269, r=frewsxcv
Corey Farwell [Wed, 26 Apr 2017 03:05:59 +0000 (23:05 -0400)]
Rollup merge of #41528 - steveklabnik:gh33269, r=frewsxcv

Clarify "side effect" in peek's docs

Fixes #33269

/cc @tshepang

7 years agoRollup merge of #41527 - steveklabnik:gh41285, r=frewsxcv
Corey Farwell [Wed, 26 Apr 2017 03:05:58 +0000 (23:05 -0400)]
Rollup merge of #41527 - steveklabnik:gh41285, r=frewsxcv

Clarify the doc index

With regards to the unstable book, the reference, and the
processes involved.

Also, fix up a link by pointing to the new tracking issue rather than
the older one.

Fixes #41285

r? @frewsxcv

7 years agoRollup merge of #41518 - tbu-:pr_fix_cp_error, r=sfackler
Corey Farwell [Wed, 26 Apr 2017 03:05:58 +0000 (23:05 -0400)]
Rollup merge of #41518 - tbu-:pr_fix_cp_error, r=sfackler

Fix a copy-paste error in `Instant::sub_duration`

Fixes #41514.

7 years agoRollup merge of #41500 - steveklabnik:gh37866, r=frewsxcv
Corey Farwell [Wed, 26 Apr 2017 03:05:57 +0000 (23:05 -0400)]
Rollup merge of #41500 - steveklabnik:gh37866, r=frewsxcv

use the word 'length' in Vec::len's docs

Fixes #37866

7 years agoRollup merge of #41463 - SergioBenitez:master, r=alexcrichton
Corey Farwell [Wed, 26 Apr 2017 03:05:56 +0000 (23:05 -0400)]
Rollup merge of #41463 - SergioBenitez:master, r=alexcrichton

Add internal accessor methods to io::{Chain, Take}.

Resolves #29067.

7 years agoRollup merge of #41442 - tbu-:pr_writeall_interrupted, r=aturon
Corey Farwell [Wed, 26 Apr 2017 03:05:55 +0000 (23:05 -0400)]
Rollup merge of #41442 - tbu-:pr_writeall_interrupted, r=aturon

Specify behavior of `write_all` for `ErrorKind::Interrupted` errors

Also spell out that read and write operations should be retried on
`ErrorKind::Interrupted` errors.

Fixes #38494.

7 years agoRollup merge of #39983 - AndrewGaspar:rust-windbg, r=brson
Corey Farwell [Wed, 26 Apr 2017 03:05:54 +0000 (23:05 -0400)]
Rollup merge of #39983 - AndrewGaspar:rust-windbg, r=brson

Adds rust-windbg.cmd script

Adds rust-gdb/rust-lldb equivalent for windbg that loads the Rust .natvis files on start.

This change modifies the bootstrap code to add rust-windbg to bin and the .natvis files to lib/rustlib/etc.

Example usage from cmd or PowerShell:
```
rust-windbg -c "bu rs_f442289d74765418!rs::main;g" target\debug\rs.exe
```

7 years agoAuto merge of #41332 - petrochenkov:privti, r=eddyb
bors [Tue, 25 Apr 2017 23:46:37 +0000 (23:46 +0000)]
Auto merge of #41332 - petrochenkov:privti, r=eddyb

Check privacy of trait items in all contexts

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

This is a sufficiently rare scenario and it's currently guarded by `private_in_public` lint, so it shouldn't be a [breaking-change] in practice.

7 years agoFix object safety violations in the test
Vadim Petrochenkov [Tue, 25 Apr 2017 19:38:21 +0000 (22:38 +0300)]
Fix object safety violations in the test

7 years agoprivacy: Rename and cleanup PrivacyVisitor
Vadim Petrochenkov [Sun, 16 Apr 2017 18:19:24 +0000 (21:19 +0300)]
privacy: Rename and cleanup PrivacyVisitor

7 years agoCheck privacy of trait items in all contexts
Vadim Petrochenkov [Sun, 16 Apr 2017 16:06:26 +0000 (19:06 +0300)]
Check privacy of trait items in all contexts

7 years agoAuto merge of #41362 - alexcrichton:run-cargot-ests, r=aturon
bors [Tue, 25 Apr 2017 15:51:40 +0000 (15:51 +0000)]
Auto merge of #41362 - alexcrichton:run-cargot-ests, r=aturon

Run tests for the cargo submodule in tree

Previously the `cargotest` suite would run some arbitrary revision of Cargo's
test suite, but now that we're bundling it in tree we should be running the
Cargo submodule's test suite instead.

7 years agoFix up vec guarnatee around capacity
steveklabnik [Tue, 25 Apr 2017 14:41:17 +0000 (10:41 -0400)]
Fix up vec guarnatee around capacity

Fixes #37746

7 years agoImplement From<&mut [T]> for Vec
Guillaume Gomez [Tue, 25 Apr 2017 10:34:45 +0000 (12:34 +0200)]
Implement From<&mut [T]> for Vec

7 years agoDo not check if libclang_rt.?san_*_dynamic.dylib is an unstable crate.
kennytm [Tue, 25 Apr 2017 10:34:21 +0000 (18:34 +0800)]
Do not check if libclang_rt.?san_*_dynamic.dylib is an unstable crate.

These are not even crates...

7 years agoAuto merge of #40434 - mattico:splice-update, r=alexcrichton
bors [Tue, 25 Apr 2017 10:34:07 +0000 (10:34 +0000)]
Auto merge of #40434 - mattico:splice-update, r=alexcrichton

Implement Vec::splice and String::splice (RFC 1432)

RFC: rust-lang/rfcs#1432, tracking issue: #32310
A rebase of https://github.com/rust-lang/rust/pull/32355 with a few more tests.

Let me know if you have any ideas for more tests.

cc @SimonSapin

7 years agoClarify "side effect" in peek's docs
steveklabnik [Tue, 25 Apr 2017 09:38:26 +0000 (05:38 -0400)]
Clarify "side effect" in peek's docs

Fixes #33269

7 years agoClarify the doc index
steveklabnik [Tue, 25 Apr 2017 09:35:51 +0000 (05:35 -0400)]
Clarify the doc index

With regards to the unstable book, the reference, and the
processes involved.

Also, fix up a link by pointing to the new tracking issue rather than
the older one.

Fixes #41285

7 years agoForce link with an absolute rpath when using sanitizer on macOS.
kennytm [Thu, 20 Apr 2017 00:31:43 +0000 (08:31 +0800)]
Force link with an absolute rpath when using sanitizer on macOS.

7 years agoSupport AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.
kennytm [Mon, 17 Apr 2017 20:22:16 +0000 (04:22 +0800)]
Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.

ASan and TSan are supported on macOS, and this commit enables their
support.

The sanitizers are always built as *.dylib on Apple platforms, so they
cannot be statically linked into the corresponding `rustc_?san.rlib`. The
dylibs are directly copied to `lib/rustlib/x86_64-apple-darwin/lib/`
instead.

Note, although Xcode also ships with their own copies of ASan/TSan dylibs,
we cannot use them due to version mismatch.

There is a caveat: the sanitizer libraries are linked as @rpath, so the
user needs to additionally pass `-C rpath`:

    rustc -Z sanitizer=address -C rpath file.rs
                               ^~~~~~~~

Otherwise there will be a runtime error:

    dyld: Library not loaded: @rpath/libclang_rt.asan_osx_dynamic.dylib
      Referenced from: /path/to/executable
      Reason: image not found
    Abort trap: 6

The next commit includes a temporary change in compiler to force the linker
to emit a usable @rpath.

7 years agoPass `--format-version 1` to `cargo metadata`.
kennytm [Mon, 17 Apr 2017 16:07:36 +0000 (00:07 +0800)]
Pass `--format-version 1` to `cargo metadata`.

Suppress warning introduced by rust-lang/cargo#3841.

7 years agoAdd cautions to io::get_mut method documentation.
Sergio Benitez [Mon, 24 Apr 2017 23:46:21 +0000 (16:46 -0700)]
Add cautions to io::get_mut method documentation.

7 years agoReference tracking issue for more_io_inner_methods.
Sergio Benitez [Mon, 24 Apr 2017 23:46:05 +0000 (16:46 -0700)]
Reference tracking issue for more_io_inner_methods.

7 years agoAdd more_io_inner_methods feature to unstable book.
Sergio Benitez [Sat, 22 Apr 2017 10:35:53 +0000 (03:35 -0700)]
Add more_io_inner_methods feature to unstable book.

7 years agoAdd internal accessor methods to io::{Chain, Take}.
Sergio Benitez [Sat, 22 Apr 2017 08:14:18 +0000 (01:14 -0700)]
Add internal accessor methods to io::{Chain, Take}.

Resolves #29067.

7 years agoAdds rust-windbg.cmd script
Andrew Gaspar [Mon, 20 Feb 2017 19:10:32 +0000 (11:10 -0800)]
Adds rust-windbg.cmd script

7 years agoFix a copy-paste error in `Instant::sub_duration`
Tobias Bucher [Mon, 24 Apr 2017 23:02:59 +0000 (01:02 +0200)]
Fix a copy-paste error in `Instant::sub_duration`

Fixes #41514.

7 years agoAuto merge of #40123 - TimNN:llvm40, r=alexcrichton
bors [Mon, 24 Apr 2017 22:18:16 +0000 (22:18 +0000)]
Auto merge of #40123 - TimNN:llvm40, r=alexcrichton

LLVM 4.0 Upgrade

Since nobody has done this yet, I decided to get things started:

**Todo:**

* [x] push the relevant commits to `rust-lang/llvm` and `rust-lang/compiler-rt`
* [x] cleanup `.gitmodules`
* [x] Verify if there are any other commits from `rust-lang/llvm` which need backporting
* [x] Investigate / fix debuginfo ("`<optimized out>`") failures
* [x] Use correct emscripten version in docker image

---

Closes #37609.

---

**Test results:**

Everything is green 🎉

7 years agoMore methods for str boxes.
Clar Charr [Tue, 11 Apr 2017 20:02:43 +0000 (16:02 -0400)]
More methods for str boxes.

7 years agoRun tests for the cargo submodule in tree
Alex Crichton [Tue, 18 Apr 2017 00:24:05 +0000 (17:24 -0700)]
Run tests for the cargo submodule in tree

Previously the `cargotest` suite would run some arbitrary revision of Cargo's
test suite, but now that we're bundling it in tree we should be running the
Cargo submodule's test suite instead.

7 years agorustc: use tcx.at(span) to set the location of a query.
Eduard-Mihai Burtescu [Mon, 24 Apr 2017 15:06:39 +0000 (18:06 +0300)]
rustc: use tcx.at(span) to set the location of a query.

7 years agoAdd Splice forget test
Matt Ickstadt [Mon, 24 Apr 2017 14:49:29 +0000 (09:49 -0500)]
Add Splice forget test

7 years agorustc: expose the common DUMMY_SP query case as tcx methods.
Eduard-Mihai Burtescu [Mon, 24 Apr 2017 14:23:36 +0000 (17:23 +0300)]
rustc: expose the common DUMMY_SP query case as tcx methods.

7 years agoAuto merge of #40634 - GuillaumeGomez:refcell-docs, r=steveklabnik
bors [Mon, 24 Apr 2017 13:09:35 +0000 (13:09 +0000)]
Auto merge of #40634 - GuillaumeGomez:refcell-docs, r=steveklabnik

Add more explanation on RefCell::get_mut

Fixes #40203.

r? @rust-lang/docs

7 years agoAdd more explanation on RefCell::get_mut
Guillaume Gomez [Sat, 18 Mar 2017 14:33:56 +0000 (15:33 +0100)]
Add more explanation on RefCell::get_mut

7 years agorustc: rename some of the queries to match tcx methods.
Eduard-Mihai Burtescu [Mon, 24 Apr 2017 12:20:46 +0000 (15:20 +0300)]
rustc: rename some of the queries to match tcx methods.

7 years agouse the word 'length' in Vec::len's docs
steveklabnik [Mon, 24 Apr 2017 11:47:00 +0000 (07:47 -0400)]
use the word 'length' in Vec::len's docs

Fixes #37866

7 years agoAuto merge of #41494 - withoutboats:associated-consts-are-not-object-safe, r=eddyb
bors [Mon, 24 Apr 2017 10:06:41 +0000 (10:06 +0000)]
Auto merge of #41494 - withoutboats:associated-consts-are-not-object-safe, r=eddyb

Associated consts are not object safe.

fixes #26847

r? @eddyb

7 years agoFeature gate in test.
Without Boats [Mon, 24 Apr 2017 09:42:36 +0000 (02:42 -0700)]
Feature gate in test.

7 years agoStyle.
Without Boats [Mon, 24 Apr 2017 08:40:17 +0000 (01:40 -0700)]
Style.

7 years agoFix type error.
Without Boats [Mon, 24 Apr 2017 08:20:36 +0000 (01:20 -0700)]
Fix type error.

7 years agoAdd compile-fail test.
Without Boats [Mon, 24 Apr 2017 08:19:12 +0000 (01:19 -0700)]
Add compile-fail test.

7 years agoAssociated consts are not object safe.
Without Boats [Mon, 24 Apr 2017 05:00:09 +0000 (22:00 -0700)]
Associated consts are not object safe.

7 years agoAdd splice to the unstable book.
Matt Ickstadt [Sat, 8 Apr 2017 21:58:47 +0000 (16:58 -0500)]
Add splice to the unstable book.

7 years agoUse Vec::splice impl in string::Splice::drop()
Matt Ickstadt [Sat, 8 Apr 2017 21:43:30 +0000 (16:43 -0500)]
Use Vec::splice impl in string::Splice::drop()

7 years agoImprove splice docs and tests
Matt Ickstadt [Sat, 8 Apr 2017 21:04:30 +0000 (16:04 -0500)]
Improve splice docs and tests

7 years agoUpdate splice impl
Matt Ickstadt [Sat, 8 Apr 2017 21:12:58 +0000 (16:12 -0500)]
Update splice impl

7 years agoAdd Vec::splice and String::splice
Simon Sapin [Sat, 8 Apr 2017 20:55:53 +0000 (15:55 -0500)]
Add Vec::splice and String::splice

7 years agoAuto merge of #41486 - arielb1:select-where, r=eddyb
bors [Sun, 23 Apr 2017 23:06:50 +0000 (23:06 +0000)]
Auto merge of #41486 - arielb1:select-where, r=eddyb

traits::select: quickly filter out predicates from other traits

this improves most pre-trans passes's performance by ~1%.

That missed the spring cleaning PR because I wanted to ship it.

r? @eddyb

7 years agoAuto merge of #41485 - arielb1:dtorck-constraint, r=eddyb
bors [Sun, 23 Apr 2017 20:11:50 +0000 (20:11 +0000)]
Auto merge of #41485 - arielb1:dtorck-constraint, r=eddyb

cache dtorck constraints on ADTs

This avoids visiting the fields of all structs multiple times, improving item-bodies checking time by 10% (!).

Not sure whether we want this in 1.18 or 1.19. It's a big-ish patch, but the 10% win is very tempting.

r? @eddyb

7 years agocache ADT dtorck results
Ariel Ben-Yehuda [Sun, 23 Apr 2017 14:43:23 +0000 (17:43 +0300)]
cache ADT dtorck results

This avoids visiting the fields of all structs multiple times, improving
item-bodies checking time by 10% (!).

7 years agotraits::select: quickly filter out predicates from other traits
Ariel Ben-Yehuda [Sun, 23 Apr 2017 20:05:25 +0000 (23:05 +0300)]
traits::select: quickly filter out predicates from other traits

this improves most pre-trans passes's performance by ~1%.

7 years agoFIN: windows-gnu: statically link gcc_s, pthread with llvm
Tim Neumann [Thu, 13 Apr 2017 20:27:53 +0000 (22:27 +0200)]
FIN: windows-gnu: statically link gcc_s, pthread with llvm

7 years agoFIN: Compile LLVM with -fno-omit-frame-pointer on 32bit MinGW builds
Tim Neumann [Mon, 17 Apr 2017 08:24:33 +0000 (10:24 +0200)]
FIN: Compile LLVM with -fno-omit-frame-pointer on 32bit MinGW builds

to work around an apparently bad optimization.

7 years agoFIN: switch appveryor to mingw with posix threads
Tim Neumann [Fri, 14 Apr 2017 09:27:56 +0000 (11:27 +0200)]
FIN: switch appveryor to mingw with posix threads

7 years agoFIN: ignore failing test on emscripten, see #41299
Tim Neumann [Fri, 14 Apr 2017 09:29:05 +0000 (11:29 +0200)]
FIN: ignore failing test on emscripten, see #41299

7 years agoFIN: update appveyor mingw description
Tim Neumann [Fri, 14 Apr 2017 09:27:35 +0000 (11:27 +0200)]
FIN: update appveyor mingw description

7 years agoFIN: build comiler-rt wihout Thumb on arm
Tim Neumann [Sun, 2 Apr 2017 10:36:20 +0000 (12:36 +0200)]
FIN: build comiler-rt wihout Thumb on arm

7 years agoFIN: disable backtrace printing for panic-runtime/abort* on ARM
Tim Neumann [Sun, 2 Apr 2017 09:24:22 +0000 (11:24 +0200)]
FIN: disable backtrace printing for panic-runtime/abort* on ARM

7 years agoFIN: update emscripten builder
Tim Neumann [Mon, 20 Mar 2017 16:42:25 +0000 (17:42 +0100)]
FIN: update emscripten builder

7 years agoFIN/CRT: adopt all applicable rust compiler-rt patches
Tim Neumann [Sun, 23 Apr 2017 19:58:44 +0000 (21:58 +0200)]
FIN/CRT: adopt all applicable rust compiler-rt patches

7 years agoFIN/LLVM: new rust patches required for 4.0
Tim Neumann [Sun, 23 Apr 2017 18:50:28 +0000 (20:50 +0200)]
FIN/LLVM: new rust patches required for 4.0

7 years agoFIN/LLVM: adopt all applicable rust llvm patches
Tim Neumann [Sun, 23 Apr 2017 18:21:02 +0000 (20:21 +0200)]
FIN/LLVM: adopt all applicable rust llvm patches

7 years agoFIN: update to upstream (llvm 4.0.1 + fastcomp 1.37.10) & compiler-rt 4.0
Tim Neumann [Mon, 20 Mar 2017 16:35:57 +0000 (17:35 +0100)]
FIN: update to upstream (llvm 4.0.1 + fastcomp 1.37.10) & compiler-rt 4.0

7 years agoclean-up adt_sized_constraint now that it uses on-demand
Ariel Ben-Yehuda [Fri, 21 Apr 2017 17:24:32 +0000 (20:24 +0300)]
clean-up adt_sized_constraint now that it uses on-demand

7 years agoAuto merge of #41408 - eddyb:poly-const-eval, r=arielb1
bors [Sun, 23 Apr 2017 08:35:00 +0000 (08:35 +0000)]
Auto merge of #41408 - eddyb:poly-const-eval, r=arielb1

rustc: generalize monomorphic_const_eval to polymorphic constants.

With the addition of `Substs` to the query key, we can now evaluate *and cache* polymorphic constants.

Fixes #23898 by replacing the crippled explicit-discriminant-only local-crate-only `lookup_variant_by_id` with `ConstVal::Variant` which can describe variants irrespective of their discriminant.

Fixes #41394 by fixing #23898 (for the original testcase) and by not looping past the first discriminant.

7 years agorustc_const_eval: support all unit enum variants.
Eduard-Mihai Burtescu [Wed, 19 Apr 2017 12:16:19 +0000 (15:16 +0300)]
rustc_const_eval: support all unit enum variants.

7 years agorustc_const_eval: CallOn isn't needed, typeck/const-qualif handle those cases.
Eduard-Mihai Burtescu [Wed, 19 Apr 2017 12:15:12 +0000 (15:15 +0300)]
rustc_const_eval: CallOn isn't needed, typeck/const-qualif handle those cases.

7 years agorustc: make the const-eval cache polymorphic.
Eduard-Mihai Burtescu [Tue, 18 Apr 2017 20:38:15 +0000 (23:38 +0300)]
rustc: make the const-eval cache polymorphic.

7 years agoAuto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichton
bors [Sun, 23 Apr 2017 02:13:55 +0000 (02:13 +0000)]
Auto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichton

Remove items that are unstable and deprecated

This removes unstable items that have been deprecated for more than one cycle.

- Since 1.16.0, `#![feature(enumset)]`
    - All of `mod collections::enum_set`
- Since 1.15.0, `#![feature(borrow_state)]`
    - `cell::BorrowState`
    - `RefCell::borrow_state()`
- Since 1.15.0, `#![feature(is_unique)]`
    - `Rc::is_unique()` (made private like `Arc::is_unique()`)
- Since 1.15.0, `#![feature(rc_would_unwrap)]`
    - `Rc::would_wrap()`
- Since 1.13.0, `#![feature(binary_heap_extras)]`
    - `BinaryHeap::push_pop()`
    - `BinaryHeap::replace()`
- Since 1.12.0, `#![feature(as_unsafe_cell)]`
    - `Cell::as_unsafe_cell()`
    - `RefCell::as_unsafe_cell()`
- Since 1.12.0, `#![feature(map_entry_recover_keys)]`
    - `btree_map::OccupiedEntry::remove_pair()`
    - `hash_map::OccupiedEntry::remove_pair()`
- Since 1.11.0, `#![feature(float_extras)]`
    - `Float::nan()`
    - `Float::infinity()`
    - `Float::neg_infinity()`
    - `Float::neg_zero()`
    - `Float::zero()`
    - `Float::one()`
    - `Float::integer_decode()`
    - `f32::integer_decode()`
    - `f32::ldexp()`
    - `f32::frexp()`
    - `f32::next_after()`
    - `f64::integer_decode()`
    - `f64::ldexp()`
    - `f64::frexp()`
    - `f64::next_after()`
- Since 1.11.0, `#![feature(zero_one)]`
    - `num::Zero`
    - `num::One`

7 years agoRemove unused import.
Corey Farwell [Sun, 23 Apr 2017 02:13:22 +0000 (22:13 -0400)]
Remove unused import.

7 years agoAuto merge of #41469 - arielb1:rustc-spring-cleaning, r=eddyb
bors [Sat, 22 Apr 2017 20:07:01 +0000 (20:07 +0000)]
Auto merge of #41469 - arielb1:rustc-spring-cleaning, r=eddyb

Performance audit, Spring 2017

Fix up some quite important performance "surprises" I've found running callgrind on rustc.

7 years agobail out of selection when there are multiple surviving candidates
Ariel Ben-Yehuda [Sat, 22 Apr 2017 12:05:18 +0000 (15:05 +0300)]
bail out of selection when there are multiple surviving candidates

In some cases (e.g. <[int-var] as Add<[int-var]>>), selection can turn up
a large number of candidates. Bailing out early avoids O(n^2) performance.

This improves item-type checking time by quite a bit, resulting in ~2% of total
time-to-typeck.

7 years agoadd a cache to impl_polarity
Ariel Ben-Yehuda [Thu, 20 Apr 2017 17:37:02 +0000 (20:37 +0300)]
add a cache to impl_polarity

this is another one of these things that looks *much* worse on valgrind.

7 years agoallocate less strings in `symbol_names`
Ariel Ben-Yehuda [Thu, 20 Apr 2017 15:38:35 +0000 (18:38 +0300)]
allocate less strings in `symbol_names`

this improves trans performance by *another* 10%.

7 years agoweak_lang_items: check for `lang` attribute before calling `value_str`
Ariel Ben-Yehuda [Thu, 20 Apr 2017 14:17:13 +0000 (17:17 +0300)]
weak_lang_items: check for `lang` attribute before calling `value_str`

improves trans performance by *another* 10%.

7 years agocache attributes of items from foreign crates
Ariel Ben-Yehuda [Thu, 20 Apr 2017 12:08:41 +0000 (15:08 +0300)]
cache attributes of items from foreign crates

this avoids parsing item attributes on each call to `item_attrs`, which takes
off 33% (!) of translation time and 50% (!) of trans-item collection time.

7 years agoshort-cut SharedCrateContext::layout_of
Ariel Ben-Yehuda [Thu, 20 Apr 2017 00:14:39 +0000 (03:14 +0300)]
short-cut SharedCrateContext::layout_of

That method is *incredibly* hot, so this ends up saving 10% of trans
time.

BTW, we really should be doing dependency tracking there - and possibly be
taking the respective perf hit (got to find a way to make DTMs fast), but
`layout_cache` is a non-dep-tracking map.

7 years agoavoid calling `mk_region` unnecessarily
Ariel Ben-Yehuda [Wed, 19 Apr 2017 22:58:12 +0000 (01:58 +0300)]
avoid calling `mk_region` unnecessarily

this improves typeck & trans performance by 1%. This looked hotter on
callgrind than it is on a CPU.

7 years agoremove cleanup branches to the resume block
Ariel Ben-Yehuda [Wed, 19 Apr 2017 22:20:50 +0000 (01:20 +0300)]
remove cleanup branches to the resume block

This improves LLVM performance by 10% lost during the shimmir transition.

7 years agoAuto merge of #41431 - GuillaumeGomez:hoedown-default, r=aturon
bors [Sat, 22 Apr 2017 17:37:04 +0000 (17:37 +0000)]
Auto merge of #41431 - GuillaumeGomez:hoedown-default, r=aturon

Re-enable hoedown by default

r? @rust-lang/docs

cc @aturon

7 years agoAuto merge of #41464 - frewsxcv:rollup, r=frewsxcv
bors [Sat, 22 Apr 2017 14:17:36 +0000 (14:17 +0000)]
Auto merge of #41464 - frewsxcv:rollup, r=frewsxcv

Rollup of 3 pull requests

- Successful merges: #41077, #41355, #41450
- Failed merges:

7 years agoRollup merge of #41450 - rillian:rustc-wrapper, r=alexcrichton
Corey Farwell [Sat, 22 Apr 2017 13:02:58 +0000 (09:02 -0400)]
Rollup merge of #41450 - rillian:rustc-wrapper, r=alexcrichton

Update cargo for 1.18.0.

Bump our associated cargo to pick up the RUSTC_WRAPPER feature
for use with build caches.

7 years agoRollup merge of #41355 - nikomatsakis:incr-comp-refactor-trans-2, r=eddyb
Corey Farwell [Sat, 22 Apr 2017 13:02:57 +0000 (09:02 -0400)]
Rollup merge of #41355 - nikomatsakis:incr-comp-refactor-trans-2, r=eddyb

Refactor trans some more to pave way for incremental compilation

Various refactorings paving the way for the newer approach to incremental compilation (And, in particular, to "query-ifying" trans). My partial goal is to remove `SharedCrateContext`; this PR gets about as far as I can easily get before starting to really want the red/green algorithm.

r? @eddyb
cc @michaelwoerister

7 years agoRollup merge of #41077 - petrochenkov:boundparen, r=nikomatsakis
Corey Farwell [Sat, 22 Apr 2017 13:02:56 +0000 (09:02 -0400)]
Rollup merge of #41077 - petrochenkov:boundparen, r=nikomatsakis

syntax: Support parentheses around trait bounds

An implementation for https://github.com/rust-lang/rust/issues/39318#issuecomment-290956826

r? @nikomatsakis

7 years agoFix line display
Guillaume Gomez [Sat, 22 Apr 2017 12:56:36 +0000 (14:56 +0200)]
Fix line display

7 years agoAuto merge of #39999 - bitshifter:struct_align, r=eddyb
bors [Sat, 22 Apr 2017 11:50:40 +0000 (11:50 +0000)]
Auto merge of #39999 - bitshifter:struct_align, r=eddyb

Implementation of repr struct alignment RFC 1358.

The main changes around rustc::ty::Layout::struct:
* Added abi_align field which stores abi alignment before repr align is applied
* align field contains transitive repr alignment
* Added padding vec which stores padding required after fields

The main user of this information is rustc_trans::adt::struct_llfields
which determines the LLVM fields to be used by LLVM, including padding
fields.

A possible future optimisation would be to put the padding Vec in an Option, since it will be unused unless you are using repr align.

7 years agoFix tests
Guillaume Gomez [Fri, 21 Apr 2017 16:41:47 +0000 (18:41 +0200)]
Fix tests

7 years agoFix invalid linkage
Guillaume Gomez [Fri, 21 Apr 2017 14:09:28 +0000 (16:09 +0200)]
Fix invalid linkage

7 years agoSet hoedown to generate error index
Guillaume Gomez [Fri, 21 Apr 2017 10:27:48 +0000 (12:27 +0200)]
Set hoedown to generate error index

7 years agoRe-enable hoedown by default
Guillaume Gomez [Thu, 20 Apr 2017 22:32:23 +0000 (00:32 +0200)]
Re-enable hoedown by default