Commit Graph

43024 Commits

Author SHA1 Message Date
Ariel Ben-Yehuda
3afd760bb3 Fix translation of semi-constant if-statements
Thanks @dotdash
2015-05-19 17:42:15 +03:00
Ariel Ben-Yehuda
27d2bd13c3 Make float -> int casts actually work 2015-05-19 17:42:15 +03:00
Ariel Ben-Yehuda
32fe2e3ad4 Address review commets
I think I didn't run tests properly - my second call to
select_all_obligations_or_error has made 3 tests fail. However, this is
just an error message change - integer fallback never worked with casts.
2015-05-19 17:42:14 +03:00
Ariel Ben-Yehuda
de4b0e9961 remove todo 2015-05-19 17:42:14 +03:00
Ariel Ben-Yehuda
d9b9f4ee7d fix conflicts 2015-05-19 17:42:14 +03:00
Ariel Ben-Yehuda
9ee2335bfc Fix test fallout, and add some rather comprehensive tests. 2015-05-19 17:42:14 +03:00
Ariel Ben-Yehuda
83acebc462 Overhaul cast semantics and make them follow RFC401
This should hopefully fix all cast-related ICEs once and for all.

I managed to make diagnostics hate me and give me spurious "decoder error"
 - removing $build/tmp/extended-errors seems to fix it.
2015-05-19 17:42:14 +03:00
Ariel Ben-Yehuda
a172f4022d Expose enum discriminant signedness 2015-05-19 17:42:14 +03:00
Manish Goregaokar
3bb54a3362 Rollup merge of #25591 - rick68:patch-2, r=alexcrichton
fixed a mistake.
2015-05-19 18:47:16 +05:30
Manish Goregaokar
9d5e621c6d Rollup merge of #25590 - michaelsproul:enum-struct-diagnostics, r=Manishearth
Part of #24407.

This covers various errors to do with struct and enum patterns.
2015-05-19 18:47:15 +05:30
Manish Goregaokar
f3896621b9 Rollup merge of #25587 - bluss:rustdoc-type-margin, r=alexcrichton
rustdoc: Fix left margin for type aliases

Fixes #24655

Margin for associated types was applied to type aliases (in return
value) by mistake.
2015-05-19 18:47:15 +05:30
Manish Goregaokar
b613ef552d Rollup merge of #25580 - killercup:trpl/unify-code-blocks, r=steveklabnik
This adds strictly more information to the source files and reduces the need for customized tooling to render the book. (While this should not change the output of _rustbook_, it is very useful when rendering the sources with external tools like Pandoc.)

This only adds the language marker to "first level" code blocks (and not to code blocks in comments inside of code examples).

r? @steveklabnik
2015-05-19 18:47:15 +05:30
Manish Goregaokar
cc50fd6f31 Rollup merge of #25576 - mbrubeck:pathext-doc, r=steveklabnik
This has been a frequently-asked question on IRC, and it isn't obvious where to
look for the fix.  r? @steveklabnik
2015-05-19 18:47:15 +05:30
Manish Goregaokar
02b79c4763 Rollup merge of #25575 - clatour:patch-2, r=steveklabnik
Looks like this was an issue in the source material. I've let the editor know and he has told me he is correcting it there as well.

r? @steveklabnik
2015-05-19 18:47:14 +05:30
Manish Goregaokar
f83fe6ec1e Rollup merge of #25562 - svetlyak40wt:patch-1, r=alexcrichton
That way old versions won't be a subsections of the 1.0.0 release.
2015-05-19 18:47:14 +05:30
Manish Goregaokar
5dc886b8ad Rollup merge of #25556 - mdinger:patch-1, r=alexcrichton 2015-05-19 18:47:14 +05:30
Manish Goregaokar
1e53218902 Rollup merge of #25551 - cllns:add-active-class-to-rustbook-toc, r=alexcrichton
Currently the table of contents for `rustbook` doesn't signify which page you are on.

This PR adds an 'active' class to the link for the current page, and defines the CSS rule for that class to make the link underlined and bold.

Not sure about two things:
1) Is `current_page` is a good name for the function parameter? At first I thought `current_item` would be good, but then in the `walk_item` function, you'd have `item` and `current_item`.

2) For the CSS, is both bold and underline too much? At first I had it just be underlined, but that's also how the links look when they're hovered over.
2015-05-19 18:47:14 +05:30
Manish Goregaokar
392576b6d8 Rollup merge of #25512 - peferron:doc-traits-error-fix, r=alexcrichton
The source code snippet uses `"whatever".as_bytes()` but the compilation error message uses `b"whatever"`. Both should be consistent with each other.

r? @steveklabnik
2015-05-19 18:47:13 +05:30
Manish Goregaokar
fddd89319d Rollup merge of #25452 - jimblandy:master, r=steveklabnik
Minor tweak: the text explaining the Borrow trait talks about slices, but the example immediately following just uses a simple reference; there are no slices involved.

r? @steveklabnik
2015-05-19 18:47:13 +05:30
Mohammed Attia
aa570bce3e Fix lifetimes trpl typo 2015-05-19 14:38:54 +02:00
Björn Steinbrink
b802b18730 Don't call drop when taking the address of unsized fields
When taking the address of an unsized field we generate a rvalue datum
for the field and then convert it to an lvalue datum. At that point,
cleanup is scheduled for the field, leading to multiple drop calls.

The problem is that we generate an rvalue datum for the field, since the
pointer does not own the data and there's already cleanup scheduled
elsewhere by the true owner. Instead, an lvalue datum must be created.

Thanks to @eddyb for identifying the underlying cause and suggesting the
correct fix.

Fixes #25549
Fixes #25515
2015-05-19 14:25:35 +02:00
Parker Moore
733e7eea5c fmt.rs: add note about lack of padding support for some types 2015-05-19 19:21:52 +07:00
Eric Ye
4bc8853cea fix footnote link 2015-05-19 07:46:52 -04:00
bors
9c47ebb00a Auto merge of #25550 - sfackler:derive-debug-unsized, r=alexcrichton
Closes #25394
2015-05-19 07:38:24 +00:00
bors
b301e02f37 Auto merge of #25548 - sfackler:debug-builders-by-ref, r=alexcrichton
Based on feedback from https://internals.rust-lang.org/t/final-comment-period-for-debug-builders-stabilization/2007/2
2015-05-19 05:39:29 +00:00
Nick Hamann
35d979d8f8 Fix the error explanation for E0053. 2015-05-19 00:33:39 -05:00
Nick Hamann
d50fa7eff5 Add error explanation for E0326. 2015-05-19 00:32:27 -05:00
Wei-Ming Yang
b460e4516d Update iter.rs
fixed a mistake.
2015-05-19 12:40:01 +08:00
Michael Sproul
eccb72e85b Explain E0023, E0024, E0025, E0026, E0027, E0033. 2015-05-19 14:16:18 +10:00
Steven Fackler
e87b353d65 Fix debug builder examples examples 2015-05-18 20:57:11 -07:00
bors
eeaf2ba489 Auto merge of #25496 - alexcrichton:stabilize-cloned, r=aturon
The method was stabilized but the structure was forgotten to be stabilized.

Closes #25480
2015-05-19 03:41:23 +00:00
Ulrik Sverdrup
93701b399b collections: Clean up feature flags doc examples 2015-05-19 03:33:17 +02:00
Ulrik Sverdrup
4a53456628 collections: Avoid unstable code in examples for Vec 2015-05-19 03:33:17 +02:00
Ulrik Sverdrup
4e4374b7de collections: Avoid unstable code in examples for String
Prefer String::from over from_str; String::from_str is unstable while
String::from is stable. Promote the latter by using it in examples.

Simply migrating unstable function to the closest alternative.
2015-05-19 03:33:17 +02:00
bors
8dbc369921 Auto merge of #25441 - alexcrichton:debug-panic-neg, r=aturon
Debug overflow checks for arithmetic negation landed in #24500, at which time
the `abs` method on signed integers was changed to using `wrapping_neg` to
ensure that the function never panicked. This implied that `abs` of `INT_MIN`
would return `INT_MIN`, another negative value. When this change was back-ported
to beta, however, in #24708, the `wrapping_neg` function had not yet been
backported, so the implementation was changed in #24785 to `!self + 1`. This
change had the unintended side effect of enabling debug overflow checks for the
`abs` function. Consequently, the current state of affairs is that the beta
branch checks for overflow in debug mode for `abs` and the nightly branch does
not.

This commit alters the behavior of nightly to have `abs` always check for
overflow in debug mode. This change is more consistent with the way the standard
library treats overflow as well, and it is also not a breaking change as it's
what the beta branch currently does (albeit if by accident).

cc #25378
2015-05-19 01:08:54 +00:00
Alex Crichton
5f39ceb729 std: Make abs() panic on overflow in debug mode
Debug overflow checks for arithmetic negation landed in #24500, at which time
the `abs` method on signed integers was changed to using `wrapping_neg` to
ensure that the function never panicked. This implied that `abs` of `INT_MIN`
would return `INT_MIN`, another negative value. When this change was back-ported
to beta, however, in #24708, the `wrapping_neg` function had not yet been
backported, so the implementation was changed in #24785 to `!self + 1`. This
change had the unintended side effect of enabling debug overflow checks for the
`abs` function. Consequently, the current state of affairs is that the beta
branch checks for overflow in debug mode for `abs` and the nightly branch does
not.

This commit alters the behavior of nightly to have `abs` always check for
overflow in debug mode. This change is more consistent with the way the standard
library treats overflow as well, and it is also not a breaking change as it's
what the beta branch currently does (albeit if by accident).

cc #25378
2015-05-18 17:51:23 -07:00
Ulrik Sverdrup
24b1d2150d rustdoc: Fix left margin for type aliases
Fixes #24655

Margin for associated types was applied to type aliases (in return
value) by mistake.
2015-05-19 01:44:04 +02:00
bors
2e7d7bc05d Auto merge of #25337 - bleibig:update-grammar, r=nikomatsakis
* Correctly lex CRLF in string literals
* Update `extern CRATE as NAME` syntax
* Allow leading `::` in view paths
* Allow TySums in type ascriptions and impls
* Allow macros to have visibility and attributes
* Update syntax for qualified path types and expressions
* Allow block expressions to be called () and indexed []
2015-05-18 23:29:26 +00:00
Steve Klabnik
1254c34032 Add example for from_str_radix
Fixes #25517
2015-05-18 17:13:59 -04:00
bors
4daa62a55f Auto merge of #25230 - rayglover:patch-bitset, r=Gankro
Some modest running-time improvements to `std::collections::BitSet` on bit-sets of varying set-membership densities. This is work originally from [here](https://github.com/rayglover/alt_collections). (Benchmarks copied below)
```
std::collections::BitSet / alt_collections::BitSet

copy_dense         ... 3.08x
copy_sparse        ... 4.22x
count_dense        ... 11.01x
count_sparse       ... 8.11x
from_bytes         ... 1.47x
intersect_dense    ... 6.54x
intersect_sparse   ... 4.37x
union_dense        ... 5.53x
union_sparse       ... 5.60x
```

The exception is `from_bytes`, which I've left unaltered since the optimization is rather obscure.

Compiling with the cpu feature `popcnt` gave a further ~10% improvement on my machine, but this wasn't factored in to the benchmarks above.

Similar improvements could be made to `BitVec`, although that would probably require more substantial changes.

criticism welcome!
2015-05-18 19:54:24 +00:00
Pascal Hertleif
f3adea5ce9 TRPL: Normalize rust Code Block Markers
`{rust,ignore}` -> `rust,ignore
2015-05-18 21:10:00 +02:00
Pascal Hertleif
6f69cd6387 TRPL: Add rust Marker to Some Code Block
This adds strictly more information to the source files and reduces the
need for customized tooling to render the book.

(While this should not change the output of _rustbook_, it is very
useful when rendering the sources with external tools like Pandoc.)
2015-05-18 20:56:00 +02:00
Michael Macias
5a1e6df07c trpl: Proofread "Rust Inside Other Languages" 2015-05-18 13:09:21 -05:00
Matt Brubeck
b0e3fe9247 [doc] Add a reference from PathExt to fs::metadata 2015-05-18 10:48:22 -07:00
clatour
83df71d6c5 trpl: Dining philosophers backstory typo
Minor typo/grammar error.
2015-05-18 11:41:59 -06:00
bors
2dd5ad0be8 Auto merge of #25501 - nham:E0072_E0073, r=alexcrichton
cc #24407
2015-05-18 15:39:07 +00:00
Falco Hirschenberger
70db73a330 Show the span of feature that is unstable when using a feature-list. 2015-05-18 16:37:05 +02:00
Alexander Artemenko
a591546294 Move all version headers to the same level.
That way old versions won't be a subsections of the 1.0.0 release.
2015-05-18 10:57:58 +03:00
bors
84b1e08486 Auto merge of #25560 - Manishearth:rollup, r=Manishearth
- Successful merges: #25526, #25530, #25537
- Failed merges:
2015-05-18 04:41:43 +00:00
peferron
a10d243dd4 Use byte string literal syntax
The byte string literal syntax `b"whatever"` is more idiomatic than
`"whatever".as_bytes()`.
2015-05-17 21:19:12 -07:00