Commit Graph

45731 Commits

Author SHA1 Message Date
Tobias Bucher
47041fe289 Make slice::transmute* private 2015-08-09 22:05:22 +02:00
Tobias Bucher
22ec5f4af7 Replace many uses of mem::transmute with more specific functions
The replacements are functions that usually use a single `mem::transmute` in
their body and restrict input and output via more concrete types than `T` and
`U`. Worth noting are the `transmute` functions for slices and the `from_utf8*`
family for mutable slices. Additionally, `mem::transmute` was often used for
casting raw pointers, when you can already cast raw pointers just fine with
`as`.
2015-08-09 22:05:22 +02:00
Garming Sam
22baa46f78 Avoid adding extra paren with two casts 2015-08-10 04:52:43 +12:00
Alisdair Owens
d07a094fb0 add diagnostics for E0193 2015-08-09 16:45:56 +01:00
Ariel Ben-Yehuda
febdc3b201 Mark round_up_to_next as inline
This speeds up rustc on #25916 from 1.36Â0.022s to 1.326Â0.025s
2015-08-09 17:20:12 +03:00
Robin Kruppe
82dbc2ea61 Add optional, external tests for floating point parsing.
Running these tests takes hours, so they are not run by @bors.
2015-08-09 14:17:39 +02:00
Garming Sam
6a51de0a0a Casts are a type of binop
This just adds paren following the same cases as before
2015-08-09 21:16:49 +12:00
Garming Sam
c0c6af7f07 Add operator precedence for pretty printer
Previously it just added parentheses in excess.
e.g. ((1 + 2) + 3) + 4
2015-08-09 21:16:21 +12:00
Garming Sam
c67a34b9e5 Binary ops should add parenthesis to each side
Otherwise, we get (1 + 2) * 3 looking like 1 + 2 * 3
2015-08-09 21:15:47 +12:00
Garming Sam
fdba872944 Add a proper comment for create_resolver 2015-08-09 21:09:55 +12:00
Garming Sam
ed9f8f83c9 Expose more of the save analysis module 2015-08-09 20:54:12 +12:00
Garming Sam
8b98256f64 Remove some duplicated code with new create_resolver 2015-08-09 20:54:12 +12:00
Garming Sam
251696ed0d Remove unused language items 2015-08-09 20:54:11 +12:00
Garming Sam
ff6dd5c24b Avoid change to current module on escape from callback 2015-08-09 20:54:11 +12:00
Garming Sam
f4ea3928ac Introduce callback to resolver
Sets a flag to pass through the rest of the walker.
2015-08-09 20:53:57 +12:00
Vincent Bernat
721dc47a69 doc/core: fix description of nth function
The "nth" element can be confusing. In an array context, we know indexes
start from 0 but one may believe this is not the case with "nth". For
example, would `.nth(1)` return the first (1th/1st) or the second
element?  Rephrase a bit to be less confusing.
2015-08-09 01:04:59 +02:00
Vincent Bernat
b67adbed5a TRPL: minor correction on how chars().nth() work
The previous wording was confusing. While would we need to go through
the whole list just to find the first code point? `chars()` being an
iterator, we only need to walk from the beginning of the list.
2015-08-09 00:56:38 +02:00
bors
a5d33d8911 Auto merge of #27182 - AlisdairO:diagnostics382, r=Manishearth
As title :-)
Part of #24407.

r? @Manishearth
2015-08-08 20:32:27 +00:00
Alisdair Owens
dadc717041 add long diagnostics for E0382 2015-08-08 20:17:03 +01:00
Sean McArthur
cfcd449c4c rustc: rename multiple imports in a list 2015-08-08 11:54:15 -07:00
Alisdair Owens
d83a0fdf7d add diagnostics for E0387 2015-08-08 17:38:50 +01:00
bors
cbf4c342cf Auto merge of #27595 - mike-marcacci:patch-1, r=steveklabnik
Keeping integer values and integer references in the "value" columns made the examples quite difficult for me to follow. I've added unicode arrows to references to make them more obvious, without using any characters with actual meaning in the rust language (like `&` or previously `~`).

r? @steveklabnik
2015-08-08 16:27:12 +00:00
Robin Kruppe
ba792a4baa Accurate decimal-to-float parsing routines.
This commit primarily adds implementations of the algorithms from William
Clinger's paper "How to Read Floating Point Numbers Accurately". It also
includes a lot of infrastructure necessary for those algorithms, and some
unit tests.

Since these algorithms reject a few (extreme) inputs that were previously
accepted, this could be seen as a [breaking-change]
2015-08-08 17:15:31 +02:00
Robin Kruppe
b7e39a1c2d Script for generating the powers-of-ten tables necessary for correct and
fast decimal-to-float conversions.
2015-08-08 17:15:25 +02:00
Robin Kruppe
7ebd7f3b9a Add various methods to Bignum:
- Exposing digits and individual bits
- Counting the number of bits
- Add small (digit-sized) values
- Multiplication by power of 5
- Division with remainder

All are necessary for decimal to floating point conversions.
All but the most trivial ones come with tests.
2015-08-08 17:15:19 +02:00
Robin Kruppe
7ff10209aa Enlarge Bignum type from 1152 to 1280 bits.
This is necessary for decimal-to-float code (in a later commit) to handle
inputs such as 4.9406564584124654e-324 (the smallest subnormal f64).
According to the benchmarks for flt2dec::dragon, this does not
affect performance measurably. It probably uses slightly more stack
space though.
2015-08-08 17:15:14 +02:00
Robin Kruppe
b55806ca8f Make core::num::dec2flt::strategy::grisu::Fp methods public.
The intent is to allow decimal-to-float parsing to use Fp in its fast path.
That code is added in a later commit.
2015-08-08 17:12:29 +02:00
Björn Steinbrink
f804872502 Fix the function return type used in get_res_dtor()
Instead of the actual return type, we're currently passing the function
type to get_extern_fn(). The only reason this doesn't explode is because
get_extern_fn() actually doesn't care about the actual return type, just
about it being converging or not.
2015-08-08 15:32:35 +02:00
bors
920cf4b4b2 Auto merge of #27596 - tsion:fix-27450, r=arielb1
Fixes #27450.

r? @steveklabnik
2015-08-08 09:55:42 +00:00
Mike Marcacci
bcf3921a2a Added arrows to references in tables
Keeping integer values and integer references in the "value" columns made the examples quite difficult for me to follow. I've added unicode arrows to make references more obvious, without using a character with actual meaning in the rust language (like `&` or previously `~`).
2015-08-07 23:13:08 -07:00
Scott Olson
f351e762f0 Fix the diagnostic for fat pointer to usize casts.
Fixes #27450.
2015-08-07 22:08:28 -04:00
bors
e5d90d9840 Auto merge of #27378 - GuillaumeGomez:patch-2, r=brson
Part of #24407.
r? @Manishearth
2015-08-07 17:58:17 +00:00
Björn Steinbrink
1eeaf2065b Fix ICE when trying to drop an unsized type from a different crate
The code to get the LLVM type signature for the drop function doesn't
handle unsized types correctly.
2015-08-07 18:29:44 +02:00
bors
1b5d52122e Auto merge of #27582 - pnkfelix:disable-nonzeroing-move-hint-by-default, r=nikomatsakis
Turn nonzeroing move hints back off by default.

Works around bugs injected by PR #26173.

 * (@pnkfelix is unavailable in the short-term (i.e. for the next week) to fix them.)

 * When the bugs are fixed, we will turn nonzeroing move hints back on by default.

Fix #27401
2015-08-07 16:24:22 +00:00
Felix S. Klock II
1a68b18763 placate the pretty tests by ignoring my test. 2015-08-07 18:23:37 +02:00
Tim Neumann
c115c51363 improve span of erroneous empty macro invocation
The ideas is to use the span of the complete macro invocation if the span of a
macro error is `DUMMY_SP`.

fixes #7970
2015-08-07 16:53:13 +02:00
Felix S. Klock II
6170435055 Regression test for dropflag reinit issue.
Fix #27401.
2015-08-07 16:21:22 +02:00
Felix S. Klock II
e9b28d22fb Turn nonzeroing move hints back off by default.
This is a temporary workaround for the bugs that have been found in
the implementation of PR #26173.

 * pnkfelix is unavailable in the short-term (i.e. for the next week) to fix them.

 * When the bugs are fixed, we will turn this back on by default.

(If you want to play with the known-to-be-buggy optimization in the
meantime, you can opt-back in via the debugging option that this
commit is toggling.)
2015-08-07 15:51:25 +02:00
Guillaume Gomez
c3d147eea6 Add a guard example for E0416 2015-08-07 15:23:00 +02:00
Guillaume Gomez
5aa6c155a3 Improve examples of E0102 2015-08-07 15:07:20 +02:00
bors
ab77c1d8d0 Auto merge of #27551 - arielb1:adt-def, r=nikomatsakis
This ended up being a bigger refactoring than I thought, as I also cleaned a few ugly points in rustc. There are still a few areas that need improvements.

Performance numbers:
```
Before:
572.70user 5.52system 7:33.21elapsed 127%CPU (0avgtext+0avgdata 1173368maxresident)k
llvm-time: 385.858

After:
545.27user 5.49system 7:10.22elapsed 128%CPU (0avgtext+0avgdata 1145348maxresident)k
llvm-time: 387.119
```

A good 5% perf improvement. Note that after this patch >70% of the time is spent in LLVM - Amdahl's law is in full effect.

Passes make check locally.

r? @nikomatsakis
2015-08-07 12:23:06 +00:00
Victor Berger
5847ea7619 Customize error messages for self glob imports. 2015-08-07 14:18:20 +02:00
Ariel Ben-Yehuda
eedb1cc576 rename ADTDef to AdtDef etc. 2015-08-07 15:03:09 +03:00
Ulrik Sverdrup
2b82c072c7 StrSearcher: Improve inner loop in TwoWaySearcher::next, next_back
The innermost loop of TwoWaySearcher checks the boundary of the haystack
vs position + needle.len(), and it checks the last byte of the needle
against the byteset.

If these two steps are combined by using the indexing of the last
needle byte's position as bounds check, the algorithm improves its
throughput. We improve the innermost loop by reducing the number of
instructions used, and elminating the panic case for the checked
indexing that was previously used.

Selected benchmarks from the external/workspace testsuite. Benchmarks
improve across the board.

```
before:

test bb_in_aa::twoway_find                  ... bench:       4,229 ns/iter (+/- 1,305) = 23646 MB/s
test bb_in_aa::twoway_rfind                 ... bench:       3,873 ns/iter (+/- 101) = 25819 MB/s
test short_1let_long::twoway_find           ... bench:       7,075 ns/iter (+/- 29) = 360 MB/s
test short_1let_long::twoway_rfind          ... bench:       6,640 ns/iter (+/- 79) = 384 MB/s
test short_2let_long::twoway_find           ... bench:       3,823 ns/iter (+/- 16) = 667 MB/s
test short_2let_long::twoway_rfind          ... bench:       3,774 ns/iter (+/- 44) = 675 MB/s
test short_3let_long::twoway_find           ... bench:       3,582 ns/iter (+/- 47) = 712 MB/s
test short_3let_long::twoway_rfind          ... bench:       3,616 ns/iter (+/- 34) = 705 MB/s

with this commit:

test bb_in_aa::twoway_find                  ... bench:       2,952 ns/iter (+/- 20) = 33875 MB/s
test bb_in_aa::twoway_rfind                 ... bench:       2,939 ns/iter (+/- 99) = 34025 MB/s
test short_1let_long::twoway_find           ... bench:       4,593 ns/iter (+/- 4) = 555 MB/s
test short_1let_long::twoway_rfind          ... bench:       4,592 ns/iter (+/- 76) = 555 MB/s
test short_2let_long::twoway_find           ... bench:       2,804 ns/iter (+/- 3) = 909 MB/s
test short_2let_long::twoway_rfind          ... bench:       2,807 ns/iter (+/- 40) = 908 MB/s
test short_3let_long::twoway_find           ... bench:       3,105 ns/iter (+/- 120) = 821 MB/s
test short_3let_long::twoway_rfind          ... bench:       3,019 ns/iter (+/- 50) = 844 MB/s
```

- `bb_in_aa`: fast skip due to byteset filter loop improves.
- 1/2/3let: Searches for 1, 2, or 3 ascii bytes improves.
2015-08-07 13:41:17 +02:00
Ariel Ben-Yehuda
62cd3cc46b stop using skip_binder 2015-08-07 13:57:39 +03:00
Ariel Ben-Yehuda
7d32533eab add documentation 2015-08-07 13:48:29 +03:00
bors
9bba711063 Auto merge of #27576 - rust-lang:steveklabnik-patch-1, r=Gankro
1. this isn't actually true about diabetes
2. people with diabetes will get *real sad* when reading this
3. it isn't actually necessary.

r? @Gankro
2015-08-07 05:57:24 +00:00
bors
b77d2f5ac7 Auto merge of #27558 - mlalic:patch-1, r=brson
r? @steveklabnik
2015-08-07 04:21:47 +00:00
bors
871fd5eb73 Auto merge of #27552 - tshepang:misc, r=brson 2015-08-07 02:46:43 +00:00
diaphore
2daa1b7530 Trim trailing newline from FormatMessageW 2015-08-07 03:49:31 +02:00