Commit Graph

47860 Commits

Author SHA1 Message Date
angelsl
6e61c6f119 Update compiler-rt 2015-10-28 15:23:20 +08:00
bors
88fade54e1 Auto merge of #29398 - jonas-schievink:if-let-arms, r=arielb1
Closes #29314

The code from #29314:
```rust
fn main() {
    if let Some(b) = None {
        ()
    } else {
        1
    };
}
```
now prints this:
```
test.rs:2:5: 6:6 error: `if let` arms have incompatible types: expected `()`, found `_` (expected (), found integral variable) [E0308]
test.rs:2     if let Some(b) = None {
test.rs:3         ()
test.rs:4     } else {
test.rs:5         1
test.rs:6     };
test.rs:2:5: 6:6 help: run `rustc --explain E0308` to see a detailed explanation
test.rs:4:12: 6:6 note: `if let` arm with an incompatible type
test.rs:4     } else {
test.rs:5         1
test.rs:6     };
error: aborting due to previous error
```
2015-10-28 06:00:19 +00:00
Eli Friedman
56ba8feed6 Update libsyntax tests. 2015-10-27 20:09:10 -07:00
Eli Friedman
e5024924ad Make fatal errors more consistent. 2015-10-27 20:09:10 -07:00
Eli Friedman
329e487e58 Start pushing panics outward in lexer. 2015-10-27 20:09:10 -07:00
Eli Friedman
de95857129 Don't panic for fatal errors in attribute parsing. 2015-10-27 20:09:10 -07:00
Eli Friedman
c141f47c24 Delete unnecessary ParserAttr trait. 2015-10-27 20:09:10 -07:00
Eli Friedman
1dd87dcfea Don't use panicking helpers in Parser. 2015-10-27 20:09:10 -07:00
bors
8974297b4a Auto merge of #29313 - arielb1:projection-overflow, r=eddyb
This turns the crashes into overflow errors.

r? @eddyb
2015-10-28 03:07:28 +00:00
bors
f7172490f8 Auto merge of #29311 - steveklabnik:doc_iterator_trait, r=alexcrichton
This cleans up descriptions, adds more examples, and increases
consistency between similar methods.
2015-10-28 01:17:12 +00:00
Brian Anderson
002b3b32fe Bump version to 1.6 2015-10-27 17:47:43 -07:00
Vadim Petrochenkov
243a524d06 Fix for middle::reachable + better comments and tests
In `middle::reachable` mark default impl of a trait method as reachable if this trait method is used from inlinable code
2015-10-28 03:38:22 +03:00
Brian Anderson
ec3dc2d477 1.4 release notes 2015-10-27 17:30:08 -07:00
Marcell Pardavi
ad8dcb64bf Mention in the docs, that assert! has a second version with a custom message
I recently discovered that this is not mentioned in the docs, only in
the examples, and it's not evident for people coming from C++

r? @steveklabnik
2015-10-28 00:56:27 +01:00
bors
e0e2627374 Auto merge of #29072 - nagisa:place-arrow, r=pnkfelix
This commit generalises parsing of associative operators from left-associative
only (with some ugly hacks to support right-associative assignment) to properly
left/right-associative operators.

Parsing is still is not general enough to handle non-associative,
non-highest-precedence prefix or non-highest-precedence
postfix operators (e.g. `..` range syntax) and should be made to be.

Lastly, this commit adds support for parsing right-associative `<-` (left arrow)
operator with precedence higher than assignment as the operator for placement-in
feature.

---

This PR still needs various non-parser changes (e.g. src/grammar and tests) and I’m still working on these; the meat of the PR can already be reviewed, though, I think.

Please review carefully. I made sure that quirks I have discovered so far are preserved (see e.g. https://github.com/rust-lang/rust/issues/29071) and am looking for more corner cases as I continue to work on tests et al, but there may be something I haven’t noticed or accounted for.

EDIT: I’m also not sure I managed to preserve all the semantics with the range operator inside non-trivial expressions since these are a mess at the moment. Crater runs would be nice.
2015-10-27 22:56:39 +00:00
Niko Matsakis
d0a84e0500 Add some debug printouts to librustc_privacy 2015-10-27 18:30:46 -04:00
Simonas Kazlauskas
99f9bb16ab Adjust src/grammar for the introduced <- op 2015-10-27 23:06:37 +02:00
bors
8a72584f97 Auto merge of #28833 - jryans:borrowck-linear-errors, r=pnkfelix
Change error reporting of conflicting loans to stop earlier after printing
an error for a given borrow, instead of proceeding to error on possibly every
issued loan.  This keeps us down to O(n) errors (for n problem lines), instead
of O(n^2) errors in some cases.

Fixes #27485.
2015-10-27 21:04:59 +00:00
Ariel Ben-Yehuda
7f772bb84e type_of: use sizing_type_of to check the size of arrays
when evaluating a recursive type, the type_of of the interior could be
still in progress, so we can't use that.

Fixes #19001
2015-10-27 23:02:23 +02:00
Simonas Kazlauskas
c1a238c4f5 Add tests for newly introduced syntax
Also add some (regression) tests for discovered parser oddities
2015-10-27 21:55:10 +02:00
Simonas Kazlauskas
662082cb7e Update unused_parens lint for placement-in arrow 2015-10-27 21:55:10 +02:00
Simonas Kazlauskas
972c1c6a5f Fix restrictions when parsing rhs of equalities 2015-10-27 21:55:10 +02:00
Simonas Kazlauskas
58c299f81d Fix prefix range expressions being not parsed 2015-10-27 21:55:04 +02:00
Simonas Kazlauskas
884b58913a Add a test for #29071
Fixes #29071
2015-10-27 21:55:04 +02:00
Simonas Kazlauskas
471f5a1f9a Generalise associative operator parsing
This commit generalises parsing of associative operators from left-associative
only (with some ugly hacks to support right-associative assignment) to properly
left/right-associative operators.

Parsing still is not general enough to handle non-associative,
non-highest-precedence prefix or non-highest-precedence postfix operators (e.g.
`..` range syntax), though. That should be fixed in the future.

Lastly, this commit adds support for parsing right-associative `<-` (left arrow)
operator with precedence higher than assignment as the operator for placement-in
feature.
2015-10-27 21:55:04 +02:00
bors
a1e2a5538a Auto merge of #26421 - nham:fix_21546, r=pnkfelix
Fixes #21546.
2015-10-27 19:15:29 +00:00
Vadim Petrochenkov
8cef018d52 Comments and formatting 2015-10-27 21:56:48 +03:00
Marcell Pardavi
b6f5e7238a Small fix in the book
Fixes #29401.

r? @steveklabnik
2015-10-27 19:02:47 +01:00
bors
540fd3aa71 Auto merge of #26848 - oli-obk:const_fn_const_eval, r=pnkfelix
this has the funky side-effect of also allowing constant evaluation of function calls to functions that are not `const fn` as long as `check_const` didn't mark that function `NOT_CONST`

It's still not possible to call a normal function from a `const fn`, but let statements' initialization value can get const evaluated (this caused the fallout in the overflowing tests)

we can now do this:

```rust
const fn add(x: usize, y: usize) -> usize { x + y }
const ARR: [i32; add(1, 2)] = [5, 6, 7];
```

also added a test for destructuring in const fn args
```rust
const fn i((a, b): (u32, u32)) -> u32 { a + b } //~ ERROR: E0022
```

This is a **[breaking change]**, since it turns some runtime panics into compile-time errors. This statement is true for ANY improvement to the const evaluator.
2015-10-27 17:11:13 +00:00
Jonas Schievink
6c094b9df9 Don't print the same impl twice on ext. overlap 2015-10-27 17:59:32 +01:00
Alex Crichton
98dcde183d mk: Re-add libgcc_s_seh-1.dll to windows dist
Although the compiler itself does not depend on this DLL the `libstdc++-6.dll`
that we're shipping does, so we still need to include it.
2015-10-27 09:40:11 -07:00
Seo Sanghyeon
fb7e325900 Use if let 2015-10-28 01:08:46 +09:00
Steve Klabnik
d91785ab09 Adds tons of documentation for Iterator
This adds lots of examples, clarifies text, and just generally improves
the documentation for Iterator.
2015-10-27 12:00:10 -04:00
bors
679b5a9faa Auto merge of #29327 - sanxiyn:argument, r=nrc
Fix #24114.
2015-10-27 14:25:57 +00:00
Ariel Ben-Yehuda
1220e016bd add a recursion limit for type representation
I could have added a check for explicit recursion, as irregular types
tend to cause selection errors, but I am not sufficiently sure that
cannot be bypassed.

Fixes #22919
Fixes #25639
Fixes #26548
2015-10-27 16:04:43 +02:00
Ariel Ben-Yehuda
867fd0a362 project: add a recursion limit to "tail-recursive" projections
Fixes #21946
Fixes #23992
Fixes #25945
2015-10-27 16:04:06 +02:00
Gleb Kozyrev
2a53edefd7 Implement Default for PhantomData 2015-10-27 15:42:38 +02:00
Jonas Schievink
2560646d91 Diagnostic: "if let arm with incompatible type" 2015-10-27 13:10:41 +01:00
bors
eab5ad529b Auto merge of #29326 - Charlotteis:patch-1, r=steveklabnik
The beginning of the work that needs to be done as part of #28835.

☀️
2015-10-27 10:15:00 +00:00
Oliver Schneider
2b000feba5 the const evaluator might run before check_const
So we cannot assume that the function call was marked NOT_CONST by check_const.
2015-10-27 09:39:07 +01:00
bors
0152a93bb4 Auto merge of #29317 - matklad:clarify-reference, r=steveklabnik
Rust reference is a bit confusing here, because it does not explicitly mention trait objects.

See an example of confusion here https://users.rust-lang.org/t/confusion-about-impls-without-for/3379/2 :)

r? @steveklabnik
2015-10-27 08:27:53 +00:00
bors
996ba1d306 Auto merge of #29309 - rjbs:doc-comment-sections, r=alexcrichton
As displayed before this commit, I found the book confusing in its
explanation of `#`-led comments in `rust` blocks.  Possibly the
biggest confusion was because the many-dashes construct does not
become an HR element in the Markdown translator used, so things were
not being properly set off.

This change should more clearly show the as-rendered content as
rendered, and the as-coded content as code.
2015-10-27 06:40:12 +00:00
bors
cb591e517a Auto merge of #29298 - tbu-:pr_doc_env_panic, r=alexcrichton 2015-10-27 04:45:39 +00:00
bors
5c823615e6 Auto merge of #29386 - jonas-schievink:codegen-worker-id, r=alexcrichton
This makes it easier to tell which thread does how much work. Output now looks like this:
```
time: 0.000; rss: 55MB	llvm function passes [0]
time: 0.000; rss: 55MB	llvm function passes [2]
time: 0.000; rss: 55MB	llvm function passes [1]
time: 0.000; rss: 55MB	llvm module passes [0]
time: 0.000; rss: 55MB	llvm module passes [1]
time: 0.000; rss: 55MB	llvm module passes [2]
time: 0.000; rss: 55MB	llvm function passes [3]
time: 0.000; rss: 55MB	llvm module passes [3]
time: 0.000; rss: 55MB	codegen passes [1]
time: 0.000; rss: 55MB	codegen passes [2]
time: 0.000; rss: 55MB	codegen passes [0]
time: 0.000; rss: 56MB	codegen passes [1]
time: 0.001; rss: 56MB	codegen passes [3]
```
2015-10-27 02:56:57 +00:00
bors
95fb8d1c87 Auto merge of #29325 - alexcrichton:revert-trait-accessibility, r=nrc
These commits revert https://github.com/rust-lang/rust/pull/28504 and add a regression test pointed out by @petrochenkov, it's not immediately clear with the regression that the accessibility check should be removed, so for now preserve the behavior on stable by default.

r? @nrc
2015-10-27 01:04:14 +00:00
bors
05eb81ae11 Auto merge of #29295 - little-dude:rustfmt_librustc_unicode, r=nrc
I didn't see anything particularly weird here. The last commit has the only changes I'm not 100% sure about. 

I ignored tables.rs since it's genrated, but I updated the python script that generates it.

?r @nrc
2015-10-26 23:14:50 +00:00
bors
04475b92f9 Auto merge of #29274 - thepowersgang:issues-29107-const-unsafe-fn-order, r=nikomatsakis
This PR switches the implemented ordering from `unsafe const fn` (as was in the original RFC) to `const unsafe fn` (which is what the lang team decided on)
2015-10-26 21:23:32 +00:00
Jonas Schievink
153c533b27 Print the codegen worker # when using time-passes 2015-10-26 21:03:03 +01:00
bors
2c42c98815 Auto merge of #29384 - nikomatsakis:mir-not-stable-beta, r=alexcrichton 2015-10-26 19:34:14 +00:00
Niko Matsakis
2d5b8b0f2d Disable MIR on beta/stable until we've resolved #29227 is resolved. 2015-10-26 15:05:35 -04:00