Commit Graph

53941 Commits

Author SHA1 Message Date
Ariel Ben-Yehuda
f0174fcbee use the slice_pat hack in libstd too 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
9b1abf5c65 remove residual slice pattern junk from mem_categorization 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
fcabfa9735 add an help message when using an old-style slice pattern 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
5cf4139d21 fix tests 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
a673cedf7b fix stdtest 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
b2100cc7b5 fix damage in librustc 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
8ac3b46cac address review comments 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
5af5f26753 handle string literals correctly in match checking
The root of the problem is that a string literal pattern is essentially of
the form `&LITERAL`, in a single block, while match checking wants to
split that.

To fix that, I added a type field to the patterns in match checking,
which allows us to distinguish between a full and split pattern.

That file is ugly and needs to be cleaned. However, `trans::_match` calls
it, so I think we should delay the cleanup until we kill that.

Fixes #30240
2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
1a614f8568 wrap calls to lvalue_ty 2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
5c717a6fc2 implement RFC495 semantics for slice patterns
non-MIR translation is still not supported for these and will happily ICE.

This is a [breaking-change] for many uses of slice_patterns.
2016-06-09 00:38:38 +03:00
Ariel Ben-Yehuda
088b7e2108 fix translation of unsized types and arrays 2016-06-08 23:58:53 +03:00
Ariel Ben-Yehuda
70c25c848c remove the librustc_trans -> librustc_mir dependency 2016-06-08 23:58:53 +03:00
Eduard Burtescu
0c5930ef25 mir: group span + visibility scope under a new SourceInfo type. 2016-06-07 19:21:56 +03:00
Eduard Burtescu
719a591630 mir: distinguish between variable visibility scopes and SEME scopes. 2016-06-07 18:50:58 +03:00
bors
f35255038b Auto merge of #34012 - eddyb:tick-erased, r=nikomatsakis
rustc: add ReErased to be used by trait selection, MIR and trans.

`ReErased` replaces `ReStatic` (i.e. `'static`) for erasing regions.
Using a distinct lifetime helps prevent accidental mix-ups between the two.
It also allows cleaner type printing (see test changes), including in symbol names:
```rust
str..pattern..CharSearcher$LT$$u27$static$GT$::drop.30560::h840c2f2afc03bbea // before
str..pattern..CharSearcher::drop.30561::h6bd31d2af614377a // after
```
Not that we should be producing symbols this way, but it's still better.
2016-06-07 00:04:53 -07:00
bors
763f9234b0 Auto merge of #34006 - eddyb:mir-const-fixes, r=nikomatsakis
[MIR] Fix double-rounding of float constants and ignore NaN sign in tests.

Fixes #32805 by handling f32 and f64 separately in rustc_const_eval.

Also removes `#[rustc_no_mir]` from a couple libstd tests by ignoring NaN sign.
Turns out that runtime evaluation of `0.0 / 0.0` produces a NaN with the sign bit set,
whereas LLVM constant folds it to a NaN with the sign bit unset, which we were testing for.
2016-06-06 05:08:50 -07:00
bors
4a4a13a5bc Auto merge of #33920 - cristianoliveira:error-E0174-explanation, r=GuillaumeGomez
Add error description for E0174

Reference for issue: #32777

r? @GuillaumeGomez

Hey Guillaume, sorry for taking too long to do it. I got some unexpected work during the week.

Waiting for your review :)
2016-06-06 01:02:22 -07:00
Eduard-Mihai Burtescu
8519139ab4 Merge pull request #34102 from eddyb/rollup
Rollup of 12 pull requests
2016-06-06 11:02:19 +03:00
Cristian Oliveira
45e647dfe2 Add error description for E0174 2016-06-06 01:02:26 -03:00
Eduard-Mihai Burtescu
c77076074c Rollup merge of #34090 - srinivasreddy:rustfmt_unicode, r=nagisa
run rustfmt on librustc_unicode
2016-06-06 06:48:33 +03:00
Eduard-Mihai Burtescu
f7a82e04e3 Rollup merge of #34085 - srinivasreddy:rustfmt_libtest, r=eddyb
run rustfmt on libtest folder
2016-06-06 06:48:33 +03:00
Eduard-Mihai Burtescu
61eeffa372 Rollup merge of #34082 - ollie27:rustdoc_css, r=alexcrichton
rustdoc: Fix a few missing colors in the CSS

This adds color to some of the search results and sidebar items which were missing.
2016-06-06 06:48:33 +03:00
Eduard-Mihai Burtescu
324a356d78 Rollup merge of #34081 - RustOS-Fork-Holding-Ground:no-core-build-script, r=alexcrichton
No build.rs for libcore

I did a grep and there are no longer any mention of "rustbuild" in core, in `cfg`s or otherwise.
2016-06-06 06:48:33 +03:00
Eduard-Mihai Burtescu
594990dbde Rollup merge of #34062 - sanxiyn:no-wget, r=nagisa
Unsupport wget

wget support was removed in #32942 (search for wget in diff), but configure wasn't updated. wget support was introduced in #7498 for Windows, but we now use PowerShell on Windows.
2016-06-06 06:48:33 +03:00
Eduard-Mihai Burtescu
f646d93e42 Rollup merge of #34059 - reeze:patch-2, r=GuillaumeGomez
Update comment

The path has changed
2016-06-06 06:48:33 +03:00
Eduard-Mihai Burtescu
9f5be6c2a4 Rollup merge of #34052 - jonas-schievink:issue-32829, r=brson
Add regression test for issue #32829

Closes #32829
2016-06-06 06:48:32 +03:00
Eduard-Mihai Burtescu
d2b8fb4803 Rollup merge of #34048 - shepmaster:corrected-issue-number, r=steveklabnik
Correct issue number in test
2016-06-06 06:48:32 +03:00
Eduard-Mihai Burtescu
0e98d1dc8f Rollup merge of #33955 - zackmdavis:explain_E0429, r=GuillaumeGomez
add explanation for E0429 (`self` use declaration must use brace syntax)

This is an item under #32777.

r? @GuillaumeGomez
2016-06-06 06:48:32 +03:00
Eduard-Mihai Burtescu
a8ab762ea3 Rollup merge of #33786 - birkenfeld:make-fix, r=jseyfried
Makefile.in: dont use unnecessary escapes in echo

I don't know if `echo` allows escapes without `-e` on other systems, but on a GNU userland this outputs literal `\n` on the terminal. In this case there's an easy way to write this without escapes anyway.

r? @GuillaumeGomez
2016-06-06 06:48:32 +03:00
bors
5b1e914b91 Auto merge of #33786 - birkenfeld:make-fix, r=jseyfried
Makefile.in: dont use unnecessary escapes in echo

I don't know if `echo` allows escapes without `-e` on other systems, but on a GNU userland this outputs literal `\n` on the terminal. In this case there's an easy way to write this without escapes anyway.

r? @GuillaumeGomez
2016-06-05 18:24:22 -07:00
Eduard Burtescu
f158a2f69d mir: remove unused float support from zero_literal. 2016-06-05 22:32:11 +03:00
Srinivas Reddy Thatiparthy
f5c071ccfa run rustfmt on librustc_unicode 2016-06-05 23:30:11 +05:30
Eduard Burtescu
c77166c685 rustc_const_eval: work around double rounding. 2016-06-05 19:18:28 +03:00
Eduard Burtescu
27673610a6 test: don't assume anything about the sign of NAN. 2016-06-05 19:17:42 +03:00
bors
1c975eafa9 Auto merge of #34039 - ollie27:linkchecker_dirs, r=alexcrichton
linkchecker: Treat directory links as errors

Directory links don't work well offline so they should be treated as errors.

All examples of this I know of are fixed in #34021.
2016-06-05 09:07:38 -07:00
bors
8cbffc5bcf Auto merge of #33905 - eddyb:mir-overflow, r=nikomatsakis
[MIR] Implement overflow checking

The initial set of changes is from @Aatch's #33255 PR, rebased on master, plus:

Added an `Assert` terminator to MIR, to simplify working with overflow and bounds checks.
With this terminator, error cases can be accounted for directly, instead of looking for lang item calls.
It also keeps the MIR slimmer, with no extra explicit blocks for the actual panic calls.

Warnings can be produced when the `Assert` is known to always panic at runtime, e.g.:
```rust
warning: index out of bounds: the len is 1 but the index is 3
 --> <anon>:1:14
1 |> fn main() { &[std::io::stdout()][3]; }
  |>              ^^^^^^^^^^^^^^^^^^^^^^
```

Generalized the `OperandValue::FatPtr` optimization to any aggregate pair of immediates.
This allows us to generate the same IR for overflow checks as old trans, not something worse.
For example, addition on `i16` calls `llvm.sadd.with.overflow.i16`, which returns `{i16, i1}`.
However, the Rust type `(i16, bool)`, has to be `{i16, i8}`, only an immediate `bool` is `i1`.
But if we split the pair into an `i16` and an `i1`, we can pass them around as such for free.

The latest addition is a rebase of #34054, updated to work for pairs too. Closes #34054, fixes #33873.

Last but not least, the `#[rustc_inherit_overflow_checks]` attribute was introduced to control the
overflow checking behavior of generic or `#[inline]` functions, when translated in another crate.

It is **not** intended to be used by crates other than `libcore`, which is in the unusual position of
being distributed as only an optimized build with no checks, even when used from debug mode.
Before MIR-based translation, this worked out fine, as the decision for overflow was made at
translation time, in the crate being compiled, but MIR stored in `rlib` has to contain the checks.

To avoid always generating the checks and slowing everything down, a decision was made to
use an attribute in the few spots of `libcore` that need it (see #33255 for previous discussion):
* `core::ops::{Add, Sub, Mul, Neg, Shl, Shr}` implementations for integers, which have `#[inline]` methods and can be used in generic abstractions from other crates
* `core::ops::{Add, Sub, Mul, Neg, Shl, Shr}Assign` same as above, for augmented assignment
* `pow` and `abs` methods on integers, which intentionally piggy-back on built-in multiplication and negation, respectively, to get overflow checks
* `core::iter::{Iterator, Chain, Peek}::count` and `core::iter::Enumerate::{next, nth}`, also documented as panicking on overflow, from addition, counting elements of an iterator in an `usize`
2016-06-05 06:08:37 -07:00
Eduard Burtescu
cee244d4f0 trans: update Luqmana's patch for generalized pair handling. 2016-06-05 15:34:13 +03:00
Luqman Aden
da081e1eac [MIR] Handle call return values that need to be casted properly. 2016-06-05 14:46:33 +03:00
Eduard Burtescu
e71f6d8ac9 trans: report as many errors as possible for constants. 2016-06-05 14:41:04 +03:00
Eduard Burtescu
d735f6bf33 trans: implement CheckedBinaryOp in mir::constant. 2016-06-05 14:41:04 +03:00
Eduard Burtescu
b8c5053a02 trans: use the same messages for both MIR and old arithmetic checks. 2016-06-05 14:41:04 +03:00
Eduard Burtescu
1447fbf183 rustc_const_eval: track the length and index in IndexOutOfBounds. 2016-06-05 14:41:04 +03:00
Eduard Burtescu
afc598e075 rustc_const_eval: strings are not indexable in Rust 1.x. 2016-06-05 14:41:04 +03:00
Eduard Burtescu
b6ce2aa4ea rustc_const_eval: remove unused arithmetic ErrKind variants. 2016-06-05 14:41:04 +03:00
Eduard Burtescu
d8dddbf201 Respect #[rustc_inherit_overflow_checks] in mir::build and trans. 2016-06-05 14:41:03 +03:00
Eduard Burtescu
702c47baae core: mark relevant functions with #[rustc_inherit_overflow_checks]. 2016-06-05 14:41:03 +03:00
Eduard Burtescu
4adc967ed1 mir: report when overflow checks would be missing cross-crate. 2016-06-05 14:41:03 +03:00
Eduard Burtescu
cab35ff4b8 trans: support uses of projections of immediate pairs. 2016-06-05 14:41:02 +03:00
Eduard Burtescu
f1f453cf3b trans: generalize OperandValue::FatPtr to all pairs of immediates. 2016-06-05 14:41:02 +03:00
Eduard Burtescu
156b1fb9e1 Add a new Assert terminator to MIR for bounds & arithmetic checks. 2016-06-05 14:41:02 +03:00