Commit Graph

46160 Commits

Author SHA1 Message Date
Peter Reid
1927a869d4 Fix for issue #28012: pow overflow inconsistency
Overflows in integer pow() computations would be missed if they
preceded a 0 bit of the exponent being processed. This made
calls such as 2i32.pow(1024) not trigger an overflow.
2015-09-04 22:15:57 -04:00
bors
1110f1e873 Auto merge of #28197 - petrochenkov:borrow, r=alexcrichton 2015-09-04 20:23:51 +00:00
bors
668dac477e Auto merge of #28035 - Diggsey:msvc-escaping, r=alexcrichton
This fixes #28018 with the exception of the point about cmake, but that's really a limitation of `./configure` builds.
2015-09-04 17:58:35 +00:00
bors
62c45f4f25 Auto merge of #28227 - birkenfeld:use_filter_map, r=alexcrichton 2015-09-04 16:16:09 +00:00
bors
2f77a59d16 Auto merge of #28201 - apasel422:issue-26205, r=nikomatsakis
Closes #26205.

r? @eddyb
2015-09-04 14:16:54 +00:00
bors
94ddfc7707 Auto merge of #28119 - nagisa:bytesderef, r=alexcrichton 2015-09-04 12:34:03 +00:00
bors
6f1014f351 Auto merge of #28069 - alexcrichton:rt-atexit, r=brson
This adds a call to `rt::cleanup` on `process::exit` to make sure we clean up
after ourselves on the way out from Rust.

Closes #28065
2015-09-04 10:33:42 +00:00
Diggory Blake
f86c853fee Fix escaping in msvc builds 2015-09-04 10:03:56 +01:00
bors
b4de424e41 Auto merge of #28034 - alexcrichton:new-lines, r=aturon
This commit is an implementation of [RFC 1212][rfc] which tweaks the behavior of
the `str::lines` and `BufRead::lines` iterators. Both iterators now account for
`\r\n` sequences in addition to `\n`, allowing for less surprising behavior
across platforms (especially in the `BufRead` case). Splitting *only* on the
`\n` character can still be achieved with `split('\n')` in both cases.

The `str::lines_any` function is also now deprecated as `str::lines` is a
drop-in replacement for it.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1212-line-endings.md

Closes #28032
2015-09-04 08:50:56 +00:00
bors
9d1f8200e7 Auto merge of #28004 - Diggsey:win-backtrace, r=alexcrichton
Technically this could also be used for `windows-msvc` targets, as I believe they have *both* dwarf and pdb debug information, but I haven't enabled it there as it should really use the native windows APIs for that, instead of libbacktrace.

I wasn't exactly sure where I should put "gnu" specific stuff, so tell me if I should structure things differently.

This is still a WIP, and I haven't tested properly to make sure I haven't broken msvc/linux builds yet.
2015-09-04 07:08:17 +00:00
Alex Crichton
48615a68fb std: Account for CRLF in {str, BufRead}::lines
This commit is an implementation of [RFC 1212][rfc] which tweaks the behavior of
the `str::lines` and `BufRead::lines` iterators. Both iterators now account for
`\r\n` sequences in addition to `\n`, allowing for less surprising behavior
across platforms (especially in the `BufRead` case). Splitting *only* on the
`\n` character can still be achieved with `split('\n')` in both cases.

The `str::lines_any` function is also now deprecated as `str::lines` is a
drop-in replacement for it.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1212-line-endings.md

Closes #28032
2015-09-03 23:01:41 -07:00
bors
791e7bcb41 Auto merge of #28170 - nagisa:loopctl-label-spans, r=alexcrichton
r? @alexcrichton
2015-09-04 05:15:22 +00:00
bors
35b14544e1 Auto merge of #28220 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28167, #28202, #28203, #28204, #28205, #28207, #28208, #28209, #28210, #28212, #28213, #28214, #28215, #28216
- Failed merges:
2015-09-04 02:33:44 +00:00
Diggory Blake
d4fc3ec208 Add line numbers to windows-gnu backtraces
Fix formatting
Remove unused imports
Refactor
Fix msvc build
Fix line lengths
Formatting
Enable backtrace tests
Fix using directive on mac
pwd info
Work-around buildbot PWD bug, and fix libbacktrace configuration
Use alternative to `env -u` which is not supported on bitrig
Disable tests on 32-bit windows gnu
2015-09-04 01:25:15 +01:00
Tim Cuthbertson
ac12c7f1ed Reapply rust-specific changes to libbacktrace
This includes the changes from commits:

 - cd8f31759f
 - fcb30a0b67
2015-09-04 01:25:12 +01:00
Diggory Blake
34277600ac Update libbacktrace to r227145 2015-09-04 01:25:09 +01:00
Steve Klabnik
6c9549dd20 Rollup merge of #28216 - christopherdumas:fix_28196, r=steveklabnik
This is a docs change suggested in #28196.
r? @steveklabnik
2015-09-03 20:10:10 -04:00
Steve Klabnik
79ea0eed5b Rollup merge of #28215 - matklad:grammar-extern-block-item, r=steveklabnik
extern_block should be extern_block_item.

extern_block_item is `extern { bunch of fns }`, extern_block is just `bunch of fns`

r? @steveklabnik
2015-09-03 20:10:09 -04:00
Steve Klabnik
fd10ded4ea Rollup merge of #28214 - tshepang:word-not-name, r=steveklabnik
Also, add missing comma
2015-09-03 20:10:09 -04:00
Steve Klabnik
ce20719717 Rollup merge of #28213 - tshepang:replace-comma, r=steveklabnik 2015-09-03 20:10:09 -04:00
Steve Klabnik
5b8241cea9 Rollup merge of #28212 - tshepang:rust-is-a-language, r=steveklabnik 2015-09-03 20:10:09 -04:00
Steve Klabnik
e903d9c9b9 Rollup merge of #28210 - tshepang:typo, r=steveklabnik 2015-09-03 20:10:08 -04:00
Steve Klabnik
1401b46daa Rollup merge of #28209 - tshepang:must-be-four-spaces, r=steveklabnik
Also, add trailing commas
2015-09-03 20:10:08 -04:00
Steve Klabnik
ff7f5cd0c6 Rollup merge of #28208 - matklad:grammar-whitespace-cleanup, r=steveklabnik 2015-09-03 20:10:08 -04:00
Steve Klabnik
a10e87648f Rollup merge of #28207 - tshepang:flow, r=steveklabnik 2015-09-03 20:10:08 -04:00
Steve Klabnik
54279e0ced Rollup merge of #28205 - matklad:grammar-remove-proc, r=alexcrichton
As I understand, there are no proc closures in Rust any more. So this pr removes `procedure_type` production. It isn't used anywhere. The `proc` is still a keyword.

r? @steveklabnik
@bors: r+ rollup
2015-09-03 20:10:07 -04:00
Steve Klabnik
35019737cc Rollup merge of #28204 - matklad:grammar-duplicate-else-tail, r=steveklabnik
The rule `else_tail` was duplicated in `if` and `if_let` sections. I guess that this is a mistake.

r? @steveklabnik
2015-09-03 20:10:07 -04:00
Steve Klabnik
723ebc2471 Rollup merge of #28203 - benschulz:book-deref-coercion, r=brson
I have two issues with the section "Deref and method calls" of the book's chapter "Deref coercions".

 - (Minor) It says "In other words, these are the same two things in Rust:", followed by a code block in which no two things seem similar, much less the same. Presumably this sentence made more sense in a previous revision.

 - The next paragraph conflates two concepts which, imho, should kept separate. They are
    - deref coercion, i.e. inserting as many `*` as necessary and
    - implicitly referencing the receiver, i.e. inserting a single `&` to satisfy the method's `self` parameter type.

I appreciate that with the proposed changes the example becomes very contrived, even for a foo-bar-baz one. However, the current exmplanation is just wrong.
2015-09-03 20:10:07 -04:00
Steve Klabnik
b96618e18b Rollup merge of #28202 - matklad:grammar-loop-labels, r=steveklabnik
This adds missing `?` marks to productions for loops and break/continue.

It also adds missing option label to while let loop.


Note that '[' foo ']' means grouping in BNF, and '?' is used for possible missing items.

r? @steveklabnik
2015-09-03 20:10:07 -04:00
Steve Klabnik
055c23da7b Rollup merge of #28167 - petrochenkov:bytelit, r=nikomatsakis
Avoid confusion with binary integer literals and binary operator expressions in libsyntax
2015-09-03 20:10:07 -04:00
bors
2727a8e1c0 Auto merge of #27984 - arielb1:misc-assemble-improvements, r=nikomatsakis
this resolves type-variables early in assemble_candidates and
bails out quickly if the self type is an inference variable (which would
fail anyway because of `assemble_candidates_from_projected_tys`).

In both these cases, `assemble_candidates_from_impls` would try to go
over all impls and match them, leading to O(`n*m`) performance. Fixing this
improves rustc type-checking performance by 10%. As type-checking is only
is 5% of compilation, this doesn't impact bootstrap times, but *does*
improve type-error-detection time which is nice.

Crates that have many dependencies and contain significant amounts of
generic functions could see a bigger perf boost. As a microbenchmark,
the crate generated by

```
echo '#![feature(rustc_private)]'
echo 'extern crate rustc_driver;'
for i in {1..1000}; do cat << _EOF_
    pub fn foo$i<T>() {
        let mut v = Vec::new();
        let _w = v.clone();
        v.push("");
    }
_EOF_
done
```

sees performance improve from 7.2 to 1.4 seconds. I imagine many crates
would fall somewhere in-between.

r? @nikomatsakis
2015-09-04 00:00:09 +00:00
christopherdumas
17fde3a34d Removed incorrect reference from #28196 2015-09-03 14:39:34 -07:00
Aleksey Kladov
73a6199248 reference grammar: fix item definition
extern_block should extern_block_item
2015-09-04 00:29:47 +03:00
Aleksey Kladov
f7d5c25b3d reference grammar: whitespace cleanup 2015-09-03 23:42:33 +03:00
Tshepang Lekhonkhobe
6cdba4f766 book: it is RwLock, not RWLock 2015-09-03 22:14:28 +02:00
bors
1b908be9a0 Auto merge of #28200 - Manishearth:rollup, r=Manishearth
- Successful merges: #28164, #28170, #28184, #28186, #28187, #28188, #28191, #28193, #28194, #28195
- Failed merges:
2015-09-03 20:10:42 +00:00
Manish Goregaokar
e6e175b828 Add ptr import (fixup #28187) 2015-09-04 01:40:05 +05:30
Manish Goregaokar
94807b2f9c Rollup merge of #28195 - AlisdairO:diagnostics214, r=Manishearth
As title :-)
Part of #24407.

r? @Manishearth
2015-09-04 01:40:04 +05:30
Manish Goregaokar
956c5977ac Rollup merge of #28194 - steveklabnik:add_fixme, r=alexcrichton 2015-09-04 01:40:04 +05:30
Manish Goregaokar
75ca401f2d Rollup merge of #28193 - dhuseby:fixing_bitrig_alloc_crate_tests, r=alexcrichton
@alexcrichton this will get the bitrig buildbot back to green.
2015-09-04 01:40:03 +05:30
Manish Goregaokar
3c4d6d626f Rollup merge of #28191 - llogiq:iter, r=Manishearth
Nothing too big, a few needless returns and a few closures eliminated (the latter may improve performance in some cases, at least compilation should be a bit faster).
2015-09-04 01:40:03 +05:30
Manish Goregaokar
cac4a1c5c8 Rollup merge of #28188 - Manishearth:elide-core, r=alexcrichton
Makes things more greppable.

This change was made automatically by clippy + bash scripts, though I will run test passes, please review carefully.
2015-09-04 01:40:02 +05:30
Manish Goregaokar
9ea8f3e2dd Rollup merge of #28187 - petrochenkov:null, r=aturon
And replace more `0 as *const T`/`0 as *mut T`s with `null()`/`null_mut()`s

I'm not sure what is the general policy about making simple functions `const`, but `null()` and `null_mut()` seem to be good candidates.
2015-09-04 01:40:02 +05:30
Manish Goregaokar
67616f7191 Rollup merge of #28186 - thomas07vt:thomas07vt-patch-trpl-rust-inside-other-languages.md, r=steveklabnik
The embed rust file that we compile prints out 'Thread finished..' messages along with a 'done!' r? @steveklabnik
2015-09-04 01:40:02 +05:30
Manish Goregaokar
0c2924386d Rollup merge of #28184 - xiaochuanyu:patch-1, r=alexcrichton
Originally in an example it reads as follows:
```rust
fn inverse<T>() -> T
        // this is using ConvertTo as if it were "ConvertFrom<i32>"
         where i32: ConvertTo<T> {
     42.convert()
 }
```
There was no mention of `ConvertFrom` elsewhere in the page other than in this comment. Is this supposed to be `ConvertTo<i64>` ?
I'm confused by this example.
2015-09-04 01:40:01 +05:30
Tshepang Lekhonkhobe
355847f5c1 doc: reduce indentation of examples to 4 spaces
Also, add trailing commas
2015-09-03 22:08:47 +02:00
Tshepang Lekhonkhobe
23956ae1f4 book: improve flow 2015-09-03 21:54:00 +02:00
Tshepang Lekhonkhobe
197cec6ed9 book: Rust is a language, so no need to mention that fact here 2015-09-03 21:40:19 +02:00
Aleksey Kladov
59f2343bdb reference grammar: remove procedure_type 2015-09-03 22:25:47 +03:00
Aleksey Kladov
000fe00726 reference grammar: remove duplicate else_tail rule 2015-09-03 22:19:56 +03:00