Commit Graph

33230 Commits

Author SHA1 Message Date
bors
97bf93e405 auto merge of #18093 : steveklabnik/rust/remove_gc_reference, r=alexcrichton 2014-10-17 14:17:34 +00:00
bors
93e589c872 auto merge of #18089 : gamazeps/rust/small-bitv-cleanup, r=alexcrichton
I was going to write some doc in order to remove the #[allow(missing_doc)] but there was actually none missing.
I also removed a warning i didn't see in my last commit  #18018
Linked to #18009
2014-10-17 09:22:14 +00:00
bors
fa59bb0869 auto merge of #18052 : IvanUkhov/rust/raw-byte-string-literals, r=aturon
Hello,


The pull request fixes a typo in the description of raw string literals in [reference.md](https://github.com/rust-lang/rust/blob/master/src/doc/reference.md#byte-and-byte-string-literals).


Regards,
Ivan
2014-10-17 07:32:17 +00:00
bors
0f8df80804 auto merge of #18056 : TeXitoi/rust/shootout-reverse-complement-improvement, r=alexcrichton
This is some improvement as asked and discused here: http://www.reddit.com/r/rust/comments/2j2ij3/benchmark_improvement_reverse_compliment/

Before:
```
real    0m0.396s
user    0m0.280s
sys     0m0.112s
```
after:
```
real    0m0.293s
user    0m0.216s
sys     0m0.076s
```
best C version:
```
real    0m0.135s
user    0m0.132s
sys     0m0.060s
```

Another possibility will be to add a `DoubleEndedIterator::next_two_side()` with a deffault implementation, and specialising it for slices, and use it here (`MutableSlice::reverse()` can then become safe). This benchmark will then be safe.

What do you think?
2014-10-17 05:42:19 +00:00
bors
3dec727297 auto merge of #17869 : bkoropoff/rust/bound-all-the-upvars, r=nikomatsakis
This PR is based on #17784, which fixes closure soundness problems in borrowck.  Only the last two commits are unique to this PR.

My understanding of regionck is still evolving, so I'm not sure if this is the right approach.  Feedback is appreciated.

- In `link_reborrowed_region`, we account for the ability of upvars to
  change their mutability due to later processing.  A map of recursive
  region links we may want to establish in the future is maintained,
  with the links being established when the mutability of the borrow
  is adjusted.
- When asked to establish a region link for an upvar, we link it to
  the region of the closure body.  This creates the necessary
  constraint to stop unsound reborrows from the closure environment.

This partially (maybe completely) solves issue #17403.  Remaining work:

- This is only known to help with by-ref upvars.  I have not looked at
  by-value upvars yet to see if they can cause problems.
- The error diagnostics that result from failed region inference are
  pretty inscrutible.
2014-10-17 02:07:24 +00:00
Brian Koropoff
fdd69accd0 Add failure tests for moving out of unboxed closure environments 2014-10-16 17:29:44 -07:00
Brian Koropoff
a5e1aeb140 Add regression test for issue #17403 2014-10-16 17:29:44 -07:00
Brian Koropoff
a8f90bcb18 Update test for issue 17780 since diagnostic message have changed
The test was also renamed to be more descriptive.
2014-10-16 17:29:44 -07:00
Brian Koropoff
9094aabb12 Fix soundness bug in treatment of closure upvars by regionck
- Unify the representations of `cat_upvar` and `cat_copied_upvar`
- In `link_reborrowed_region`, account for the ability of upvars to
  change their mutability due to later processing.  A map of recursive
  region links we may want to establish in the future is maintained,
  with the links being established when the kind of the borrow is
  adjusted.
- When categorizing upvars, add an explicit deref that represents the
  closure environment pointer for closures that do not take the
  environment by value.  The region for the implicit pointer is an
  anonymous free region type introduced for this purpose.  This
  creates the necessary constraint to prevent unsound reborrows from
  the environment.
- Add a note to categorizations to make it easier to tell when extra
  dereferences have been inserted by an upvar without having to
  perform deep pattern matching.
- Adjust borrowck to deal with the changes.  Where `cat_upvar` and
  `cat_copied_upvar` were previously treated differently, they are
  now both treated roughly like local variables within the closure
  body, as the explicit derefs now ensure proper behavior.  However,
  error diagnostics had to be changed to explicitly look through the
  extra dereferences to avoid producing confusing messages about
  references not present in the source code.

Closes issue #17403.  Remaining work:

- The error diagnostics that result from failed region inference are
  pretty inscrutible and should be improved.

Code like the following is now rejected:

    let mut x = 0u;
    let f = || &mut x;
    let y = f();
    let z = f(); // multiple mutable references to the same location

This also breaks code that uses a similar construction even if it does
not go on to violate aliasability semantics.  Such code will need to
be reworked in some way, such as by using a capture-by-value closure
type.

[breaking-change]
2014-10-16 17:29:44 -07:00
bors
1600e0b93c auto merge of #17998 : rapha/rust/master, r=alexcrichton 2014-10-17 00:17:25 +00:00
bors
1868a262f3 auto merge of #17989 : alexcrichton/rust/spectralnorm, r=thestinger
This improves the spectralnorm shootout benchmark through a few vectors after
looking at the leading C implementation:

* The simd-based f64x2 is now used to parallelize a few computations
* RWLock usage has been removed. A custom `parallel` function was added as a
  form of stack-based fork-join parallelism. I found that the contention on the
  locks was high as well as hindering other optimizations.

This does, however, introduce one `unsafe` block into the benchmarks, which
previously had none.

In terms of timings, the before and after numbers are:

```
$ time ./shootout-spectralnorm-before
./shootout-spectralnorm-before  2.07s user 0.71s system 324% cpu 0.857 total
$ time ./shootout-spectralnorm-before 5500
./shootout-spectralnorm-before 5500  11.88s user 1.13s system 459% cpu 2.830 total
$ time ./shootout-spectralnorm-after
./shootout-spectralnorm-after  0.58s user 0.01s system 280% cpu 0.210 tota
$ time ./shootout-spectralnorm-after 5500
./shootout-spectralnorm-after 5500  3.55s user 0.01s system 455% cpu 0.783 total
```
2014-10-16 22:17:25 +00:00
bors
9d5fa7ac3b auto merge of #17947 : lukemetz/rust/master, r=aturon
AsciiStr::to_lower is now AsciiStr::to_lowercase and AsciiStr::to_upper is AsciiStr::to_uppercase to match Ascii trait.

Part of issue #17790.

This is my first pull request so let me know if anything is incorrect.

Thanks!

[breaking-changes]
2014-10-16 20:22:26 +00:00
Steve Klabnik
f68d4d39f7 don't refer to the nonexistant gc 2014-10-16 14:10:18 -04:00
bors
8b97973971 auto merge of #18064 : luqmana/rust/remove-reflection, r=nick29581
Out goes reflection! This means your code will break if you used the `:?` format specifier, anything else from libdebug, or the `visit_tydesc` intrinsic directly.

Closes #18046.

[breaking-change]
2014-10-16 17:52:25 +00:00
Luqman Aden
7899248504 librustc: Remove special case for old reflection visitor. 2014-10-16 11:15:36 -04:00
Luqman Aden
6f9b3b574b libsyntax: Don't accept :? as a format specifier. 2014-10-16 11:15:36 -04:00
Luqman Aden
3410c52eec librustc: Remove trans::reflect and the opaque and ty_visitor lang items. 2014-10-16 11:15:36 -04:00
Luqman Aden
7210a5af87 librustc: Stop generating visit glue and remove from TyDesc. 2014-10-16 11:15:36 -04:00
Luqman Aden
7a4122ac67 librustc: Remove visit_tydesc intrinsic. 2014-10-16 11:15:35 -04:00
Luqman Aden
ce6226e6c9 libnative: Remove all uses of {:?}. 2014-10-16 11:15:35 -04:00
Luqman Aden
3ef9aa01af libcollections: Remove all uses of {:?}. 2014-10-16 11:15:35 -04:00
Luqman Aden
322aedd462 librustdoc: Remove all uses of {:?}. 2014-10-16 11:15:35 -04:00
Luqman Aden
c5a8bad1ff liballoc: Remove all uses of {:?}. 2014-10-16 11:15:35 -04:00
Luqman Aden
3bab3dc574 libstd: Remove all uses of {:?}. 2014-10-16 11:15:35 -04:00
Luqman Aden
814586be57 librustc: Remove all uses of {:?}. 2014-10-16 11:15:34 -04:00
Luqman Aden
26e547af5d libsyntax: Remove all uses of {:?}. 2014-10-16 11:15:34 -04:00
Luqman Aden
38aca17c47 Remove libdebug and update tests. 2014-10-16 11:15:34 -04:00
gamazeps
c1f7a19409 Removes useless confs from bitv.rs
Linked to #18009
2014-10-16 14:41:00 +02:00
bors
b6e0d3a5bf auto merge of #18067 : mahkoh/rust/immutableintslice, r=alexcrichton
There is also a second commit that adds them to the prelude.
2014-10-16 09:12:17 +00:00
bors
126f224d9a auto merge of #18015 : jakub-/rust/issue-4201, r=pcwalton
Closes #4201.
2014-10-16 01:22:19 +00:00
Guillaume Pinot
1a6f1ebad5 shootout-reverse-complement: reimplement TwoSideIter using pointers 2014-10-16 00:11:06 +02:00
bors
8096fee18c auto merge of #17934 : pcwalton/rust/better-autoderef-fixup, r=pnkfelix
librustc: Improve method autoderef/deref/index behavior more, and enable IndexMut on mutable vectors.

This fixes a bug whereby the mutability fixups for method behavior were
not kicking in after autoderef failed to happen at any level. It also
adds support for `Index` to the fixer-upper.

Closes #12825.

r? @pnkfelix
2014-10-15 21:17:22 +00:00
bors
7134fc8de6 auto merge of #17983 : jakub-/rust/memoize-things, r=pcwalton 2014-10-15 19:22:21 +00:00
Raphael Speyer
7081007678 impl Buffer for ChanReader 2014-10-16 04:39:58 +11:00
=
0ad6f0aa55 Renamed AsciiStr::to_lower and AsciiStr::to_upper
Now AsciiStr::to_lowercase and AsciiStr::to_uppercase to match Ascii trait.
[breaking-change]
2014-10-15 12:31:35 -04:00
Julian Orth
5c05f900bf export *IntSlice in libcollections 2014-10-15 18:24:32 +02:00
bors
e4761c85b5 auto merge of #17962 : jkleint/rust/guide-vectors, r=steveklabnik
The array is the fundamental concept; vectors are growable arrays, and
slices are views into either.  Show common array ops up front: length
and iteration.  Mention arrays are immutable by default.  Highlight
definite initialization and bounds-checking as safety features.  Show
that you only need a type suffix on one element of initializers.
Explain that vectors are a value-add library type over arrays, not a
fundamental type; show they have the same "interface." Motivate slices
as efficient views into arrays; explain you can slice vectors, Strings,
&str because they're backed by arrays.  Show off new, easy-to-read
[a..b] slice syntax.
2014-10-15 09:57:18 +00:00
Jakub Wieczorek
dbc4a4b53b Make memoize!() a function instead 2014-10-15 11:02:50 +02:00
Jakub Wieczorek
c2e8f3b481 Add a memoize! macro and use it throughout rustc 2014-10-15 10:47:09 +02:00
bors
71dfa5befe auto merge of #18053 : nick29581/rust/ufcs1, r=pcwalton
With the 'receiver' as an argument and static dispatch. Part of UFCS implementation (#16293).

r?
2014-10-15 08:02:21 +00:00
bors
5201bf17e6 auto merge of #18031 : huonw/rust/adjust-vec-sort-test, r=alexcrichton
Previously it had some uninituitive conditionals due to the interaction
with the Rand construction and Clone reinitialisation to create
sequential identifying numbers. This replaces all that with just
constructing the DropCounters with the appropriate identifiers.
2014-10-15 06:07:22 +00:00
Nick Cameron
fe8e591147 Tests 2014-10-15 17:50:41 +13:00
Nick Cameron
eb598e5344 Allow self as an arg in extension methods 2014-10-15 17:50:41 +13:00
Nick Cameron
db640d53b8 tests 2014-10-15 17:38:32 +13:00
Nick Cameron
d3f51dcab8 Allow passing self as an argument to methods
Part of UFCS (#16293)
2014-10-15 17:38:31 +13:00
Ivan Ukhov
a923b4ff6d Fix the description of raw byte string literals 2014-10-15 06:36:13 +02:00
bors
ea8a5df431 auto merge of #18044 : aturon/rust/lint-conventions, r=pcwalton
[RFC 344](https://github.com/rust-lang/rfcs/pull/344) proposes a set of naming conventions for lints. This PR
renames existing lints to follow the conventions.

Use the following sed script to bring your code up to date:

```
s/unnecessary_typecast/unused_typecasts/g
s/unsigned_negate/unsigned_negation/g
s/type_limits/unused_comparisons/g
s/type_overflow/overflowing_literals/g
s/ctypes/improper_ctypes/g
s/owned_heap_memory/box_pointers/g
s/unused_attribute/unused_attributes/g
s/path_statement/path_statements/g
s/unused_must_use/unused_must_use/g
s/unused_result/unused_results/g
s/non_uppercase_statics/non_upper_case_globals/g
s/unnecessary_parens/unused_parens/g
s/unnecessary_import_braces/unused_import_braces/g
s/unused_unsafe/unused_unsafe/g
s/unsafe_block/unsafe_blocks/g
s/unused_mut/unused_mut/g
s/unnecessary_allocation/unused_allocation/g
s/missing_doc/missing_docs/g
s/unused_imports/unused_imports/g
s/unused_extern_crate/unused_extern_crates/g
s/unnecessary_qualification/unused_qualifications/g
s/unrecognized_lint/unknown_lints/g
s/unused_variable/unused_variables/g
s/dead_assignment/unused_assignments/g
s/unknown_crate_type/unknown_crate_types/g
s/variant_size_difference/variant_size_differences/g
s/transmute_fat_ptr/fat_ptr_transmutes/g
```

Since a large number of lints are being renamed for RFC 344, this PR
adds some basic deprecation/renaming functionality to the pluggable lint
system. It allows a simple mapping of old to new names, and can warn
when old names are being used.

This change needs to be rolled out in stages. In this PR, the
deprecation warning is commented out, but the old name is forwarded to
the new one.

Once the PR lands and we have generated a new snapshot of the
compiler, we can add the deprecation warning and rename all uses of the
lints in the rust codebase. I will file a PR to do so.

Closes #16545
Closes #17932

r? @pcwalton
2014-10-15 04:12:16 +00:00
John Kleint
1ce5a5626e Guide: develop the exposition of arrays, vectors, and slices.
The array is the fundamental concept; vectors are growable arrays, and
slices are views into either.  Show common array ops up front: length
and iteration.  Mention arrays are immutable by default.  Highlight
definite initialization and bounds-checking as safety features.  Show
that you only need a type suffix on one element of initializers.
Explain that vectors are a value-add library type over arrays, not a
fundamental type; show they have the same "interface." Motivate slices
as efficient views into arrays; explain you can slice vectors, Strings,
&str because they're backed by arrays.
2014-10-14 23:23:57 -04:00
bors
af99157489 auto merge of #18036 : japaric/rust/add-tests, r=nikomatsakis
Closes #11384
Closes #12909

r? @nikomatsakis
2014-10-15 02:17:19 +00:00
bors
40b2449736 auto merge of #18018 : gamazeps/rust/isuue16736, r=cmr
Closes #16736
linked to #18009
2014-10-14 23:22:20 +00:00