Commit Graph

33501 Commits

Author SHA1 Message Date
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
Niko Matsakis
7876cf9ca9 Check object lifetime bounds in coercions, not just trait bounds. Fixes #18055. 2014-10-16 18:58:42 -04:00
Jakub Wieczorek
64716d529a Add tests for a few fixed issues 2014-10-17 00:27:12 +02:00
Patrick Walton
416e6ecf8c libstd: Inline more methods on bitflags.
Servo really wants this.
2014-10-16 15:25:46 -07: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
Ariel Ben-Yehuda
50db061173 fix test patterns - should rebase the commits properly 2014-10-16 23:36:00 +03: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
Jakub Wieczorek
f3d46bda65 Unignore a few tests
Also, remove one that has an exact duplicate.
2014-10-16 21:40:12 +02: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
Alexis Beingessner
ae8d42937d Fix broken link in libcollections docs
Fixes #18010
2014-10-16 13:26:52 -04: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
Viktor Dahl
0c18da503c Improve documentation of assume intrinsic. 2014-10-16 14:20:54 +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
Viktor Dahl
0525bb7669 Add assume intrinsic
Adds an `assume` intrinsic that gets translated to llvm.assume. It is
used on a boolean expression and allows the optimizer to assume that
the expression is true.

This implements #18051.
2014-10-16 01:44:44 +02: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
Ariel Ben-Yehuda
ca27ccc8e7 fix a failing test 2014-10-15 23:57:01 +03:00
bors
7134fc8de6 auto merge of #17983 : jakub-/rust/memoize-things, r=pcwalton 2014-10-15 19:22:21 +00:00
Ariel Ben-Yehuda
cedfde9769 fix stupid error 2014-10-15 21:12:30 +03:00
Raphael Speyer
7081007678 impl Buffer for ChanReader 2014-10-16 04:39:58 +11:00
Ariel Ben-Yehuda
e74e059bd4 improve the comments on integer overflow safety 2014-10-15 20:39:12 +03:00
Ariel Ben-Yehuda
5bcd0a0b50 prevent the creation of integers too big for the target architecture 2014-10-15 20:26:43 +03:00
Ariel Ben-Yehuda
61ab2ea08a response for review comments 2014-10-15 20:09:09 +03: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
Ariel Ben-Yehuda
1ee345a87b add some tests 2014-10-15 14:17:34 +03:00
Ariel Ben-Yehuda
e053dfad23 Add a compile-time error when oversized types are used
LLVM generates wrong code (which may be an instance of compile-time UB) when
faced with types that take lots of memory - bigger than the address space.
Make using such types a trans error. While trans errors are bad, overbig
types are expected to be very rare.
2014-10-15 14:17:34 +03:00
Ariel Ben-Yehuda
01d693b1cd Use the correct LLVM integer sizes
Use the integer sizes LLVM uses, rather than having random projections
laying around. Sizes are u64, Alignments are u32, C_*int is target-dependent
but 64-bit is fine (the int -> C_int conversion is non-precision-losing,
but it can be preceded by `as int` conversions which are, so it is
somewhat ugly. However, being able to suffix a `u` to properly infer
integer types is nice).
2014-10-15 14:17:34 +03: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