Commit graph

33524 commits

Author SHA1 Message Date
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
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
Aaron Turon
31b7d64fdc rustc: Add deprecation/renaming support for lints
Since a large number of lints are being renamed for RFC 344, this commit
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 commit, the
deprecation warning is commented out, but the old name is forwarded to
the new one.

Once the commit 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.
2014-10-14 16:04:06 -07:00
Aaron Turon
3c0d2a7c90 rustc: Improve lint descriptions
Improves the description of `dead_code` and `unreachable_code` to
clarify the difference between them.
2014-10-14 15:23:09 -07:00
Aaron Turon
d6eb719729 rustc: Add missing lint registration
The pluggable lint changes apparently dropped the fat pointer transmute
lint by accident.

This commit registers the lint.
2014-10-14 15:23:09 -07:00
Aaron Turon
aabb6e72c1 rustc: Rename lints per RFC 344
RFC 344 proposes a set of naming conventions for lints. This commit
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
```

Closes #16545
Closes #17932

Due to deprecation, this is a:

[breaking-change]
2014-10-14 15:22:52 -07:00
Patrick Walton
f7fb38729e 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.
2014-10-14 14:44:17 -07:00
bors
232f4b3404 auto merge of #17966 : frewsxcv/rust/master, r=nikomatsakis
The document is mentioned, but doesn't link to it, so it's a little confusing
2014-10-14 21:22:23 +00:00
bors
5e1e2456ed auto merge of #18029 : Ms2ger/rust/patch-1, r=huonw 2014-10-14 19:22:22 +00:00
bors
181538a135 auto merge of #18023 : chris-morgan/rust/vim-misc-2014-10-14, r=kballard
- Stop highlighting foo in `use foo;` specially.
- Highlight `extern crate "foo" as bar;` properly.
- Highlight 1..2 according to the current grammar.
2014-10-14 17:22:25 +00:00
Jorge Aparicio
657b16175b Add tests for issues #11384 and #12909
Closes #11384
Closes #12909
2014-10-14 10:24:25 -05:00
bors
1fd8e4cae0 auto merge of #18014 : hirschenberger/rust/issue-17999, r=alexcrichton
Fix issue #17999 (Unused variables inside `for` are not detected)
2014-10-14 15:22:28 +00:00
Felix Raimundo
1ef5e388b9 Switches from uint to u32 in BitV and BitVSet
Closes #16736
linked to #18009
2014-10-14 13:50:50 +02:00
Huon Wilson
32513b0019 test: make the sort failure-safety test unsafeless and more obvious.
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-14 22:20:59 +11:00
Ms2ger
0e1e9cbb13 Fix the formatting of the documentation for OrdIterator.min_max. 2014-10-14 12:11:07 +02:00
Guillaume Pinot
b8786a5cba improve shootout-reverse-complement.rs using unsafe code 2014-10-14 09:41:57 +02:00
bors
a1e2eb0395 auto merge of #18017 : alexcrichton/rust/rollup, r=alexcrichton 2014-10-14 04:02:48 +00:00
Son
d9da3471e8 Change from and to to _from and _to
This to avoid warning: unused variable: `from`,
#[warn(unused_variable)] on by default.
2014-10-14 09:21:39 +08:00
Son
62b48bd815 Remove unnecessary ::core::ops::
It shows error: failed to resolve. Maybe a missing `extern crate core`
anyway.
2014-10-14 09:20:11 +08:00