Commit Graph

66317 Commits

Author SHA1 Message Date
Ralf Jung
718a8d1c38 run AddCallGuards for *all* call edges before running AddValidation 2017-08-09 12:16:59 -07:00
bors
0188ec6ef8 Auto merge of #43558 - GuillaumeGomez:union-const-colors, r=QuietMisdreavus
Union const colors

Fixes #43523

What do you think of these colors:

<img width="1440" alt="screen shot 2017-07-30 at 15 10 57" src="https://user-images.githubusercontent.com/3050060/28753752-6b175a22-7539-11e7-978e-949f3a947d18.png">

?
2017-08-07 18:19:07 +00:00
bors
2bb6d3dd89 Auto merge of #43713 - arielb1:legacy-dataflow, r=eddyb
rustc::middle::dataflow - visit the CFG in RPO

We used to propagate bits in node-id order, which sometimes caused an
excessive number of iterations, especially when macros were present. As
everyone knows, visiting the CFG in RPO bounds the number of iterators
by 1 plus the depth of the most deeply nested loop (times the height of
the lattice, which is 1).

I have no idea how this affects borrowck perf in the non-worst-case, so it's probably a good idea to not roll this up so we can see the effects.

Fixes #43704.

r? @eddyb
2017-08-07 15:42:35 +00:00
bors
e8f558543b Auto merge of #43706 - nrc:update-rls, r=sfackler
update rls
2017-08-07 13:02:57 +00:00
Ariel Ben-Yehuda
4e3a0b636f rustc::middle::dataflow - visit the CFG in RPO
We used to propagate bits in node-id order, which sometimes caused an
excessive number of iterations, especially when macros were present. As
everyone knows, visiting the CFG in RPO bounds the number of iterators
by 1 plus the depth of the most deeply nested loop (times the height of
the lattice, which is 1).

Fixes #43704.
2017-08-07 16:00:31 +03:00
bors
95936375a0 Auto merge of #43709 - zackmdavis:de-orphan_extended_information, r=GuillaumeGomez
de-orphan extended information

Bizarrely, librustc_passes, librustc_plugin, librustc_mir, and libsyntax [weren't getting their error explanations registered](https://github.com/rust-lang/rust/issues/35284) (leaving _several_ error codes absent from [the index](https://doc.rust-lang.org/nightly/error-index.html) and `--explain`). This surfaced a few latent doctest failures that were fixed where readily possible and ignored (with a recorded excuse) if not.

Also, we don't issue E0563 anymore.

r? @GuillaumeGomez
2017-08-07 10:01:06 +00:00
bors
3de807a00b Auto merge of #43699 - GuillaumeGomez:e0623, r=eddyb
Add missing error code for private method
2017-08-07 07:34:04 +00:00
Zack M. Davis
75b7a6f1a6 comment out record of now-unused error code E0563
The sole appearance of this code was deleted in 6383de15; the existing practice
in these cases seems to be to comment out its mention in
`register_diagnostics!`.
2017-08-06 21:50:41 -07:00
Zack M. Davis
86b7546204 fixing doctest failures in resurfaced extended information
After repatriating error explanations to the global registry, some lurking
doctest failures surfaced and needed to be chased down. Sadly, a few doctests
needed to be ignored due to a not-yet-understood regression in the doctest
`compile_fail` functionality (filed #43707).
2017-08-06 21:36:57 -07:00
Zack M. Davis
7efeade268 de-orphan extended information
Bizarrely, librustc_passes, librustc_plugin, librustc_mir, and libsyntax
weren't getting their error explanations registered.

Resolves #35284.
2017-08-06 21:29:05 -07:00
Nick Cameron
17d5f6a086 update rls 2017-08-07 12:16:04 +12:00
Guillaume Gomez
08188c3c92 Add missing error code for private method 2017-08-06 22:37:31 +02:00
bors
ba1d065ffa Auto merge of #43397 - GuillaumeGomez:unused-union-field, r=petrochenkov
Don't warn on unused field on union

Fixes #43393.
2017-08-06 18:57:57 +00:00
Guillaume Gomez
f94157eb61 Handle type aliases as well 2017-08-06 20:46:32 +02:00
Guillaume Gomez
09420fc206 Fix union unused fields check 2017-08-06 18:49:33 +02:00
Guillaume Gomez
90f54d00d3 Improve union unused field detection 2017-08-06 17:19:15 +02:00
bors
be69520b9a Auto merge of #43655 - bjorn3:more_doc_comments, r=arielb1
Make some comments doc comments in librustc/middle/cstore.rs
2017-08-06 12:46:20 +00:00
Guillaume Gomez
00b362e332 Fix invalid background highlights and add missing colors 2017-08-06 13:34:24 +02:00
bors
a9c24fd579 Auto merge of #43488 - Florob:repeat-opt, r=arielb1
Optimize initialization of arrays using repeat expressions

This PR was inspired by [this thread](https://www.reddit.com/r/rust/comments/6o8ok9/understanding_rust_performances_a_newbie_question/) on Reddit.
It tries to bring array initialization in the same ballpark as `Vec::from_elem()` for unoptimized builds.
For optimized builds this should relieve LLVM of having to figure out the construct we generate is in fact a `memset()`.

To that end this emits `llvm.memset()` when:
* the array is of integer type and all elements are zero (`Vec::from_elem()` also explicitly optimizes for this case)
* the array elements are byte sized

If the array is zero-sized initialization is omitted entirely.
2017-08-06 08:09:59 +00:00
bors
dd1df35f87 Auto merge of #43688 - frewsxcv:frewsxcv-bump-book, r=carols10cents
Bump 'src/doc/book' git submodule.

Primarily to pick up this change:

https://github.com/rust-lang/book/pull/866

...to move this PR forward:

https://github.com/rust-lang/rust/pull/43641
2017-08-05 22:10:14 +00:00
Corey Farwell
abc76ae7e9 Bump 'src/doc/book' git submodule.
Primarily to pick up this change:

https://github.com/rust-lang/book/pull/866

...to move this PR forward:

https://github.com/rust-lang/rust/pull/43641
2017-08-05 16:29:10 -04:00
Guillaume Gomez
59fcac6fa9 Improve dead code detection for unions 2017-08-05 22:02:45 +02:00
Guillaume Gomez
46fe8e9966 Don't warn on unused field on union 2017-08-05 22:02:45 +02:00
bors
ed16b0a1de Auto merge of #43689 - edaniels:patch-1, r=GuillaumeGomez
Fix typo in coerce_forced_unit docstring
2017-08-05 19:51:19 +00:00
Eric Daniels
3bf1ba7987 Fix typo in coerce_forced_unit docstring 2017-08-05 13:15:53 -04:00
bors
5a5a32a4a8 Auto merge of #43652 - frewsxcv:frewsxcv-str-examples, r=QuietMisdreavus
String slice doc improvements.

None
2017-08-05 15:58:11 +00:00
bors
2b82b7e50a Auto merge of #43554 - eddyb:apfloat, r=nikomatsakis
APFloat: Rewrite It In Rust and use it for deterministic floating-point CTFE.

As part of the CTFE initiative, we're forced to find a solution for floating-point operations.
By design, IEEE-754 does not explicitly define everything in a deterministic manner, and there is some variability between platforms, at the very least (e.g. NaN payloads).

If types are to evaluate constant expressions involving type (or in the future, const) generics, that evaluation needs to be *fully deterministic*, even across `rustc` host platforms.
That is, if `[T; T::X]` was used in a cross-compiled library, and the evaluation of `T::X` executed a floating-point operation, that operation has to be reproducible on *any other host*, only knowing `T` and the definition of the `X` associated const (as either AST or HIR).

Failure to uphold those rules allows an associated type (e.g. `<Foo as Iterator>::Item`) to be seen as two (or more) different types, depending on the current host, and such type safety violations typically allow writing of a `transmute` in safe code, given enough generics.

The options considered by @rust-lang/compiler were:
1. Ban floating-point operations in generic const-evaluation contexts
2. Emulate floating-point operations in an uniformly deterministic fashion

The former option may seem appealing at first, but floating-point operations *are allowed today*, so they can't be banned wholesale, a distinction has to be made between the code that already works, and future generic contexts. *Moreover*, every computation that succeeded *has to be cached*, otherwise the generic case can be reproduced without any generics. IMO there are too many ways it can go wrong, and a single violation can be enough for an unsoundness hole.
Not to mention we may end up really wanting floating-point operations *anyway*, in CTFE.

I went with the latter option, and seeing how LLVM *already* has a library for this exact purpose (as it needs to perform optimizations independently of host floating-point capabilities), i.e. `APFloat`, that was what I ended up basing this PR on.
But having been burned by the low reusability of bindings that link to LLVM, and because I would *rather* the floating-point operations to be wrong than not deterministic or not memory-safe (`APFloat` does far more pointer juggling than I'm comfortable with), I decided to RIIR.

This way, we have a guarantee of *no* `unsafe` code, a bit more control over the where native floating-point might accidentally be involved, and non-LLVM backends can share it.
I've also ported all the testcases over, *before* any functionality, to catch any mistakes.

Currently the PR replaces all CTFE operations to go through `apfloat::ieee::{Single,Double}`, keeping only the bits of the `f32` / `f64` memory representation in between operations.
Converting from a string also double-checks that `core::num` and `apfloat` agree on the interpretation of a floating-point number literal, in case either of them has any bugs left around.

r? @nikomatsakis
f? @nagisa @est31

<hr/>

Huge thanks to @edef1c for first demoing usable `APFloat` bindings and to @chandlerc for fielding my questions on IRC about `APFloat` peculiarities (also upstreaming some bugfixes).
2017-08-05 13:12:56 +00:00
Corey Farwell
6722185abd Indicate how to turn byte slices back into a string slice. 2017-08-05 08:27:25 -04:00
Corey Farwell
de4f1a170f Update str::split_at_mut example to demonstrate mutability. 2017-08-05 08:27:24 -04:00
bjorn3
068710f28a Make some comments doc comments in librustc/middle/cstore.rs 2017-08-05 10:42:53 +02:00
bors
5c7add7551 Auto merge of #43640 - oli-obk:patch-5, r=nikomatsakis
Uplift some comments to Doc comments
2017-08-05 07:31:00 +00:00
bors
e8909d257b Auto merge of #43642 - mmatyas:unskip_aarch64_tests, r=sanxiyn
Unskip some tests on AArch64

I've been running the test suite remotely on an Acer Chromebook R13 and natively on an ARM Juno developer board, both AArch64 devices. Most of the tests that are skipped on AArch64 are due to testing stdcall/fastcall/x86-specific code or the debugger, but I've found a few tests that could be enabled there.

These have been skipped previously due to failing on the `aarch64-linux-android` and `mac-android` buildbots, more than 2 years ago (#23471, #23695). It seems we don't test those platforms any more, but as they do work on AArch64 Linux, I'd like to propose re-enabling them. All of them pass on my devices.
2017-08-05 05:08:12 +00:00
Florian Zeitz
11d6312abd codegen tests: Check type of len argument to llvm.memset.* based on the exact intrinsic used 2017-08-05 04:15:51 +02:00
bors
49ded7ece3 Auto merge of #43639 - TobiasSchaffner:master, r=alexcrichton
Add L4Re Support in librustc_back

Add experimental support for x86_64-unknown-l4re-uclibc target, which covers the L4 Runtime Environment.

This pull request contains the changes that have to be made to librustc_back. It follows the changes humenda made in pull request https://github.com/rust-lang/libc/pull/591 to libc.

Next steps will be the modifications to the needed libraries. (libstd,  liballoc_system, libpanic_abort, libunwind)

Thanks to humenda for reviewing.
2017-08-05 01:58:24 +00:00
bors
9b6c2382a7 Auto merge of #43615 - dhduvall:lto-unaligned-read, r=nagisa
Fix some unaligned reads on SPARC in LTO

This fixes #43593 by eliminating some undefined behavior.
2017-08-04 22:35:22 +00:00
bors
d692a91fa6 Auto merge of #43590 - michaelwoerister:no-reopening-1, r=nikomatsakis
incr.comp.: Assert that no DepNode is re-opened (see issue #42298).

This PR removes the last occurrence of DepNode re-opening and adds an assertion that prevents our doing so in the future too. The DepGraph should no be guaranteed to be cycle free.

r? @nikomatsakis

EDIT: Closes https://github.com/rust-lang/rust/issues/42298
2017-08-04 20:06:09 +00:00
bors
ff1135b224 Auto merge of #43577 - cuviper:link-llvm-dylib, r=sanxiyn
Link LLVM tools dynamically

Set `LLVM_LINK_LLVM_DYLIB=ON` -- "If enabled, tools will be linked with
the libLLVM shared library."  Rust doesn't ship any of the LLVM tools,
and only needs a few at all for some test cases, so statically linking
the tools is just a waste of space.  I've also had memory issues on
slower machines with LLVM debuginfo enabled, when several tools start
linking in parallel consuming several GBs each.

With the default configuration, `build/x86_64-unknown-linux-gnu/llvm`
was 1.5GB before, now down to 731MB.  The difference is more drastic
with `--enable-llvm-release-debuginfo`, from 28GB to "only" 13GB.

This does not change the linking behavior of `rustc_llvm`.
2017-08-04 17:36:10 +00:00
bors
dae8864dbe Auto merge of #43600 - scalexm:issue-35976, r=nikomatsakis
Add a more precise error message for issue #35976

When trying to perform static dispatch on something which derefs to a trait object, and the target trait is not in scope, we had confusing error messages if the target method had a `Self: Sized` bound. We add a more precise error message in this case: "consider using trait ...".

Fixes #35976.

r? @nikomatsakis
2017-08-04 15:03:00 +00:00
Corey Farwell
ea6a657175 Indicate why str::{get,get_mut} examples return None. 2017-08-04 08:21:28 -04:00
Mátyás Mustoha
28c423d692 Unskip some tests on AArch64 2017-08-04 13:45:08 +02:00
Oliver Schneider
a508a2e56b Uplift some comments to Doc comments 2017-08-04 12:33:48 +02:00
bors
f2a5af7a4c Auto merge of #43442 - zackmdavis:note_available_field_names_if_levenshtein_fails, r=nikomatsakis
field does not exist error: note fields if Levenshtein suggestion fails

When trying to access or initialize a nonexistent field, if we can't infer what
field was meant (by virtue of the purported field in the source being a small
Levenshtein distance away from an actual field, suggestive of a typo), issue a
note listing all the available fields. To reduce terminal clutter, we don't
issue the note when we have a `find_best_match_for_name` Levenshtein
suggestion: the suggestion is probably right.

The third argument of the call to `find_best_match_for_name` is changed to
`None`, accepting the default maximum Levenshtein distance of one-third of the
identifier supplied for correction. The previous value of `Some(name.len())`
was overzealous, inappropriately very Levenshtein-distant suggestions when the
attempted field access could not plausibly be a mere typo. For example, if a
struct has fields `mule` and `phone`, but I type `.donkey`, I'd rather the
error have a note listing that the available fields are, in fact, `mule` and
`phone` (which is the behavior induced by this patch) rather than the error
asking "did you mean `phone`?" (which is the behavior on master). The "only
find fits with at least one matching letter" comment was accurate when it was
first introduced in 09d992471 (January 2015), but is a vicious lie in its
present context before a call to `find_best_match_for_name` and must be
destroyed (replacing every letter is within a Levenshtein distance of name.len()).

The present author claims that this suffices to resolve #42599.
2017-08-04 10:13:55 +00:00
scalexm
e7e620d0cc Rename ConfirmResult fields 2017-08-04 12:04:34 +02:00
bors
c523b3f954 Auto merge of #43403 - RalfJung:mir-validate, r=nikomatsakis
Add MIR Validate statement

This adds statements to MIR that express when types are to be validated (following [Types as Contracts](https://internals.rust-lang.org/t/types-as-contracts/5562)). Obviously nothing is stabilized, and in fact a `-Z` flag has to be passed for behavior to even change at all.

This is meant to make experimentation with Types as Contracts in miri possible. The design is definitely not final.

Cc @nikomatsakis @aturon
2017-08-04 07:48:07 +00:00
Josh Stone
6c46f4f11c Use LLVM_LINK_LLVM_DYLIB only on linux-gnu and apple-darwin 2017-08-04 00:13:11 -07:00
Tobias Schaffner
c151220a84 Add L4Re Support in librustc_back
Add support for x86_64-unknown-l4re-uclibc target, which covers
the L4 Runtime Environment.
2017-08-04 08:59:01 +02:00
bors
5431f423aa Auto merge of #43634 - dhduvall:solaris-test-fixes, r=sanxiyn
Fix a number of failing tests on Solaris and SPARC
2017-08-04 05:30:12 +00:00
bors
eae446c4dc Auto merge of #43459 - ids1024:asrawfd, r=alexcrichton
Implement AsRawFd for Stdin, Stdout, and Stderr

https://github.com/rust-lang/rfcs/issues/2074
2017-08-04 02:15:04 +00:00
Florian Zeitz
67044501bc trans: Reuse immediate value in call to call_memset() 2017-08-04 02:27:30 +02:00
Danek Duvall
9144755a91 Recognize SPARC in more tests where architecture matters. 2017-08-03 17:19:19 -07:00