Commit Graph

41752 Commits

Author SHA1 Message Date
Felix S. Klock II
ecd3572f49 Fix zero-normalization of the pos of a MultiByteChar.
Fix #24687
2015-04-29 10:21:29 +02:00
bors
857ef6e272 Auto merge of #23606 - quantheory:associated_const, r=nikomatsakis
Closes #17841.

The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough.

There is still some significant functionality missing from this commit:

 - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~
 - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet.
 - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865.
 - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~

Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
2015-04-27 16:45:21 +00:00
bors
32f9f42762 Auto merge of #24869 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #24797, #24804, #24848, #24854, #24855, #24860, #24863, #24866, #24867, #24868
- Failed merges:
2015-04-27 14:45:43 +00:00
Steve Klabnik
03f3b45ff0 Rollup merge of #24868 - tshepang:fix-vec-remove-doc, r=steveklabnik 2015-04-27 10:26:20 -04:00
Steve Klabnik
1b18da4a46 Rollup merge of #24867 - tshepang:patch-3, r=steveklabnik 2015-04-27 10:26:20 -04:00
Steve Klabnik
0c3514253c Rollup merge of #24866 - tshepang:vec-intro, r=steveklabnik 2015-04-27 10:26:20 -04:00
Steve Klabnik
188f3eb8f5 Rollup merge of #24863 - dhardy:patch-1, r=steveklabnik
Remove the name "multi-line string literal" since the rule appears to affect each line-break individually rather than the whole string literal. Re-word, and remove the stray reference to raw strings.
2015-04-27 10:26:19 -04:00
Steve Klabnik
be569bcd35 Rollup merge of #24860 - Manishearth:cargo-doc, r=steveklabnik
A user in IRC was having trouble because they used `main.rs` when they were trying
to migrate a library. The `[[lib]]` key is not easily found, and the `main.rs`/`lib.rs`
distinction doesn't seem to exist in trpl


r? @steveklabnik
2015-04-27 10:26:19 -04:00
Steve Klabnik
30f41b1bd6 Rollup merge of #24855 - richo:thread-doc, r=alexcrichton 2015-04-27 10:26:19 -04:00
Steve Klabnik
5a6d9cc159 Rollup merge of #24854 - frewsxcv:patch-19, r=alexcrichton 2015-04-27 10:26:19 -04:00
Steve Klabnik
72ee472146 Rollup merge of #24848 - bluss:deref-string, r=alexcrichton
Improve example for as_string and add example for as_vec

Provide a better example of `as_string` / `DerefString`'s unique capabilities.
Use an example where (for an unspecified reason) you need a &String, and
show how `as_string` solves the problem without needing an allocation.
2015-04-27 10:26:18 -04:00
Steve Klabnik
130240afc6 Rollup merge of #24804 - liigo:new-trait-color, r=steveklabnik
Fixes #24441 

Preview:
![new-trait-color](https://cloud.githubusercontent.com/assets/346530/7331922/d6cbcf72-eb58-11e4-8a1d-4ca5e3683ed2.png)
2015-04-27 10:26:18 -04:00
Steve Klabnik
08c0299a82 Rollup merge of #24797 - roryokane:patch-1, r=nikomatsakis
The minus sign ‘−’ is the same width as the plus sign ‘+’, so the button’s transition between the two symbols will look slightly smoother.

If you don’t want to use literal Unicode characters, I can change ‘−’ to `\u2212`. I’m not starting with that suggestion because ‘−’ is easier to read and understand, and if I used `\u2212`, it would probably be necessary to also comment the usage on each line to explain what character is being used.
2015-04-27 10:26:18 -04:00
Tshepang Lekhonkhobe
36cf51dc3a doc: it is 'index', not 'i' 2015-04-27 16:11:46 +02:00
Tshepang Lekhonkhobe
14a6a9f5e2 reference: block-comment -> block comment 2015-04-27 15:42:46 +02:00
Manish Goregaokar
38042d1e18 trpl: clarify lib.rs vs main.rs 2015-04-27 18:42:19 +05:30
bors
b772ce6342 Auto merge of #24834 - shepmaster:default-atomic-ptr, r=alexcrichton
Closes #24613
2015-04-27 12:45:38 +00:00
Tshepang Lekhonkhobe
7335c9f48f book: improve Vec intro 2015-04-27 14:11:27 +02:00
Diggory Hardy
cf650a2174 Update reference.md: floating-point section
Clarify type inference of floating-point literals
2015-04-27 12:24:47 +01:00
bors
5c60145323 Auto merge of #24820 - bradking:fix-windows-process-spawn-command-line, r=alexcrichton
Fix `make_command_line` for the case of backslashes at the end of an
argument requiring quotes.  We must encode the command and arguments
such that `CommandLineToArgvW` recovers them in the spawned process.
Simplify the logic by using a running count of backslashes as they
are encountered instead of looking ahead for quotes following them.

Extend `test_make_command_line` to additionally cover:

* a leading quote in an argument that requires quotes,
* a backslash before a quote in an argument that requires quotes,
* a backslash at the end of an argument that requires quotes, and
* a backslash at the end of an argument that does not require quotes.
2015-04-27 10:49:11 +00:00
Diggory Hardy
709f3c5130 Update reference.md: string literals section
Remove the name "multi-line string literal" since the rule appears to affect each line-break individually rather than the whole string literal. Re-word, and remove the stray reference to raw strings.
2015-04-27 11:39:42 +01:00
Rory O’Kane
72e8f7b1ab Change literal minus ‘−’ to HTML entity ‘&minus;’
So that if people accidentally delete the character, they won’t re-type it as a hyphen, which would cause bugs.

I changed ‘&plus;’ too, even though it won’t be re-typed incorrectly, so that it is easier to see when plus is used as a symbol for the button, and when it is used as an operator in code. It also makes it clearer that the use of an entity for minus is on purpose, so people won’t be tempted to replace the entity incorrectly with a hyphen character.
2015-04-27 02:41:45 -04:00
Rory O’Kane
02428dfde5 Change hyphen to minus in HTML template too 2015-04-27 02:26:58 -04:00
bors
f4ab2b3a25 Auto merge of #24849 - gareins:master, r=steveklabnik
Previous borrow() is enough to make borrow_mut() panic, no need to have borrow_mut() twice. [This](http://is.gd/woKKAW)
2015-04-27 04:35:27 +00:00
Richo Healey
5ed3ac99f4 thread: right now you can't actually set those printers 2015-04-26 21:17:14 -07:00
Corey Farwell
57284e6880 Make From::from example more idiomatic / simpler 2015-04-26 23:18:19 -04:00
bors
43a273fed0 Auto merge of #24844 - diwic:patch-1, r=steveklabnik
I figure I'd start easy with fixing a simple documentation bug. This is also a test to see that I got everything right w r t the fork/pull request process.
2015-04-27 02:35:32 +00:00
Ulrik Sverdrup
84ef3b5351 collections: Improve example for as_string and as_vec 2015-04-27 02:10:42 +02:00
bors
5fb0259edf Auto merge of #24850 - frewsxcv:patch-18, r=steveklabnik 2015-04-26 23:25:37 +00:00
Corey Farwell
b2757edff8 Indicate function call is code-like in doc-comment 2015-04-26 17:41:16 -04:00
gareins
de35823d49 IMO better borrow_mut() documentation on RefCell
Previous borrow() is enough to make borrow_mut() panic, no need to have borrow_mut() twice. [This](http://is.gd/woKKAW)
2015-04-26 23:16:49 +02:00
bors
e4b80647c8 Auto merge of #24839 - frewsxcv:patch-17, r=steveklabnik 2015-04-26 21:07:41 +00:00
bors
bba18fec45 Auto merge of #24829 - jooert:fix22673, r=pnkfelix 2015-04-26 19:06:38 +00:00
diwic
d2d8898423 book: Fix broken link to unsafe chapter 2015-04-26 20:32:14 +02:00
bors
b29c2efd42 Auto merge of #24828 - jooert:fix23253, r=pnkfelix
r? @alexcrichton
2015-04-26 17:04:24 +00:00
bors
314b1f16b7 Auto merge of #24679 - tamird:enable-debug, r=pnkfelix
r? @alexcrichton
2015-04-26 15:04:33 +00:00
Corey Farwell
a249910d34 Utilize while let instead of loop with break in doc-comment 2015-04-26 10:10:51 -04:00
bors
d3724342a3 Auto merge of #24807 - luqmana:nullable-enum-opt-dst-raw-pointers, r=jakub-
Fixes #23433.
2015-04-26 13:03:31 +00:00
bors
6365080c5c Auto merge of #23085 - goffrie:interpolating-quote, r=huonw
This changes the `ToTokens` implementations for expressions, statements, etc. with almost-trivial ones that produce `Interpolated(*Nt(...))` pseudo-tokens. In this way, quasiquote now works the same way as macros do: already-parsed AST fragments are used as-is, not reparsed.

The `ToSource` trait is removed. Quasiquote no longer involves pretty-printing at all, which removes the need for the `encode_with_hygiene` hack. All associated machinery is removed.

New `Nonterminal`s are added: NtArm, NtImplItem, and NtTraitItem. These are just for quasiquote, not macros.

`ToTokens` is no longer implemented for `Arg` (although this could be added again) and `Generics` (which I don't think makes sense).

This breaks any compiler extensions that relied on the ability of `ToTokens` to turn AST fragments back into inspectable token trees. For this reason, this closes #16987.

As such, this is a [breaking-change].

Fixes #16472.
Fixes #15962.
Fixes #17397.
Fixes #16617.
2015-04-26 09:52:28 +00:00
bors
b0043db465 Auto merge of #24367 - ebfull:fix_ice_cat_expr, r=pnkfelix
An actual typeck error is the cause of many failed compilations but an
unrelated bug is being reported instead. It is triggered because a typeck
error is presumably not yet identified during compiler execution, which
would normally bypass an invariant in the presence of other errors. In
this particular situation, we delay the reporting of the bug until
abort_if_errors().

Closes #23827, closes #24356, closes #23041, closes #22897, closes #23966,
closes #24013, and closes #23729

**There is at least one situation where this bug may still be genuinely
triggered (#23437).**
2015-04-26 05:32:16 +00:00
Geoffry Song
24ef905273 Remove FakeExtCtxt from qquote tests.
Instead create an ExtCtxt structure.
2015-04-26 01:09:36 -04:00
bors
61a5e46726 Auto merge of #24825 - rkruppe:reference-audit, r=steveklabnik
Transplant the relevant changes (turns out to be all of them) to `grammar.md`, and remove all grammar talk from `reference.md`. Sorry for the chaos.

The second commit, further below, goes over the comments and whitespace sections.

r? @steveklabnik
2015-04-26 03:34:38 +00:00
Jake Goulding
7c548a2653 Provide a Default implementation for AtomicPtr
Closes #24613
2015-04-25 22:55:19 -04:00
Geoffry Song
ea892dc70b Remove remaining tests for hygiene-encoded identifiers.
Such things no longer exist.
2015-04-25 21:42:10 -04:00
Geoffry Song
2d9831dea5 Interpolate AST nodes in quasiquote.
This changes the `ToTokens` implementations for expressions, statements,
etc. with almost-trivial ones that produce `Interpolated(*Nt(...))`
pseudo-tokens. In this way, quasiquote now works the same way as macros
do: already-parsed AST fragments are used as-is, not reparsed.

The `ToSource` trait is removed. Quasiquote no longer involves
pretty-printing at all, which removes the need for the
`encode_with_hygiene` hack. All associated machinery is removed.

A new `Nonterminal` is added, NtArm, which the parser now interpolates.
This is just for quasiquote, not macros (although it could be in the
future).

`ToTokens` is no longer implemented for `Arg` (although this could be
added again) and `Generics` (which I don't think makes sense).

This breaks any compiler extensions that relied on the ability of
`ToTokens` to turn AST fragments back into inspectable token trees. For
this reason, this closes #16987.

As such, this is a [breaking-change].

Fixes #16472.
Fixes #15962.
Fixes #17397.
Fixes #16617.
2015-04-25 21:42:10 -04:00
bors
20adc9533d Auto merge of #24815 - heejongahn:master, r=steveklabnik
At https://doc.rust-lang.org/book/vectors.html, there should be a link to
Generics page but the link address is ommitted and thus link is not functioning
well. So I added a link definition to the vectors.md.

r? @steveklabnik
2015-04-26 01:37:58 +00:00
Robin Kruppe
0ea193def9 Reference audit: comments and whitespace sections 2015-04-26 02:02:13 +02:00
bors
da623844a9 Auto merge of #24718 - tamird:fix-quote-tests, r=alexcrichton
Sniped from @rprichard's work in #24537. r? @alexcrichton
2015-04-25 23:40:10 +00:00
Johannes Oertel
6f7b5b1910 Add regression test for #22673. 2015-04-26 01:31:45 +02:00
Johannes Oertel
d30a3aac04 Add regression test for #23253. 2015-04-26 00:52:19 +02:00