Commit graph

30497 commits

Author SHA1 Message Date
kwantam
85e2bee4a2 fix test failures
- unicode tests live in coretest crate
- libcollections str tests need UnicodeChar trait.
- libregex perlw tests were checking a char in the Alphabetic category,
  \x2161. Confirmed perl 5.18 considers this a \w character. Changed to
  \x2961, which is not \w as the test expects.
2014-07-09 10:14:46 -04:00
bors
3f3291e0c7 auto merge of #15483 : AlisdairO/rust/master, r=alexcrichton
Noticed there wasn't an awful lot of info out there on using Any types, so added an example to the rustdocs.
2014-07-09 14:06:29 +00:00
bors
8ddd286ea4 auto merge of #15540 : Gankro/rust/master, r=huonw
Removing recursion from TreeMap implementation, because we don't have TCO. No need to add ```O(logn)``` extra stack frames to search in a tree.

I find it curious that ```find_mut``` and ```find``` basically duplicated the same logic, but in different ways (iterative vs recursive), possibly to maneuvre around mutability rules, but that's a more fundamental issue to deal with elsewhere.

Thanks to acrichto for the magic trick to appease borrowck (another issue to deal with elsewhere).
2014-07-09 12:21:29 +00:00
bors
b53f3e7ddb auto merge of #15530 : adrientetar/rust/proper-fonts, r=alexcrichton
- Treat WOFF as binary files so that git does not perform newline normalization.
- Replace corrupt Heuristica files with Source Serif Pro — italics are [almost in production](https://github.com/adobe/source-serif-pro/issues/2) so I left Heuristica Italic which makes a good pair with SSP. Overall, Source Serif Pro is I think a better fit for rustdoc (cc @TheHydroImpulse). This ought to fix #15527.
- Store Source Code Pro locally in order to make offline docs freestanding. Fixes #14778.

Preview: http://adrientetar.legtux.org/cached/rust-docs/core.html

r? @alexcrichton
2014-07-09 10:36:31 +00:00
bors
ad3eda123a auto merge of #15339 : cmr/rust/rewrite-lexer2, r=huonw
Mostly minor things that rebasing is becoming painful.
2014-07-09 08:46:35 +00:00
Corey Richardson
69a0cdf491 Fix all the test fallout 2014-07-09 00:49:54 -07:00
Corey Richardson
092c5078be ast: make Name its own type 2014-07-09 00:49:54 -07:00
Corey Richardson
f512779554 lexer: lex WS/COMMENT/SHEBANG rather than skipping
Now, the lexer will categorize every byte in its input according to the
grammar. The parser skips over these while parsing, thus avoiding their
presence in the input to syntax extensions.
2014-07-09 00:06:29 -07:00
Corey Richardson
cc4213418e syntax: don't parse numeric literals in the lexer
This removes a bunch of token types. Tokens now store the original, unaltered
numeric literal (that is still checked for correctness), which is parsed into
an actual number later, as needed, when creating the AST.

This can change how syntax extensions work, but otherwise poses no visible
changes.

[breaking-change]
2014-07-09 00:06:29 -07:00
Corey Richardson
9f5e21da4e syntax: don't process string/char/byte/binary lits
This shuffles things around a bit so that LIT_CHAR and co store an Ident
which is the original, unaltered literal in the source. When creating the AST,
unescape and postprocess them.

This changes how syntax extensions can work, slightly, but otherwise poses no
visible changes. To get a useful value out of one of these tokens, call
`parse::{char_lit, byte_lit, bin_lit, str_lit}`

[breaking-change]
2014-07-09 00:06:29 -07:00
Corey Richardson
bf04a7ccb1 ast: add an as_str method to Ident
This is technically unsafe but interned strings are considered immortal.
2014-07-09 00:06:29 -07:00
Corey Richardson
c8a02527ae lexer: add ident_from and ident_from_to methods 2014-07-09 00:06:29 -07:00
Corey Richardson
47fe8aa6bf lexer: shuffle around some functions 2014-07-09 00:06:29 -07:00
Corey Richardson
5f970e690f codemap: be less annoying in debug logging 2014-07-09 00:06:29 -07:00
Corey Richardson
ae9a92bd4e syntax: use a better Show impl for Ident
Rather than just dumping the id in the interner, which is useless, actually
print the interned string. Adjust the lexer logging to use Show instead of
Poly.
2014-07-09 00:06:29 -07:00
Corey Richardson
b0303b3c22 test: simplify numeric literal cfail tests 2014-07-09 00:06:28 -07:00
Corey Richardson
3c7f619b76 str: use more helpful assertion failure messages 2014-07-09 00:06:28 -07:00
Corey Richardson
c2dd553bed testsuite: merge some lexer testcases
Now that the lexer is more robust, these tests don't need to be in separate
files. Yay!
2014-07-09 00:06:28 -07:00
Corey Richardson
91357a9c4e token: replace ast::Ident with just Ident 2014-07-09 00:06:28 -07:00
Corey Richardson
4989a56448 syntax: doc comments all the things 2014-07-09 00:06:27 -07:00
Alisdair Owens
3576b35933 Add example to Any documentation 2014-07-09 07:46:12 +01:00
bors
5716abe3f0 auto merge of #15537 : jbclements/rust/hygiene-for-methods, r=pcwalton
This patch adds hygiene for methods. This one was more difficult than the others, due principally to issues surrounding `self`. Specifically, there were a whole bunch of places in the code that assumed that a `self` identifier could be discarded and then made up again later, causing the discard of contexts and hygiene breakage.
2014-07-09 05:11:38 +00:00
bors
ec3efa8055 auto merge of #15422 : steveklabnik/rust/guide_compound_data_types, r=brson
I'm not happy about the hand-waving around `cmp`, but I'm not sure how to get around it.
2014-07-09 02:21:37 +00:00
Alexis Beingessner
03981b54f6 Removing recursion from find_mut in treemap 2014-07-08 21:24:40 -04:00
bors
1c711db551 auto merge of #15374 : steveklabnik/rust/comments, r=brson
I'm leaving off `rustdoc` usage because it won't work unless this is a `pub fn`, and I want to talk about public/private in the context of modules. I'm also not mentioning `//!` because it is exclusively used to provide the overview of a module.
2014-07-09 00:36:40 +00:00
John Clements
4c312b6d0d fix hygiene for test case 2014-07-08 16:28:23 -07:00
John Clements
19e718b34d carry self ident forward through re-parsing
formerly, the self identifier was being discarded during parsing, which
stymies hygiene. The best fix here seems to be to attach a self identifier
to ExplicitSelf_, a change that rippled through the rest of the compiler,
but without any obvious damage.
2014-07-08 16:28:21 -07:00
John Clements
69c27546ee macro literals should be compared by name only 2014-07-08 16:27:38 -07:00
John Clements
af794a5aae make macros non-capturing 2014-07-08 16:27:38 -07:00
John Clements
48c3e5f740 comments 2014-07-08 16:27:38 -07:00
John Clements
7f575186f9 remove outdated comment
I believe this comment is now irrelevant, as a result of
commit 6757053cff
2014-07-08 16:27:37 -07:00
John Clements
e59dd484c2 implement hygiene for method args 2014-07-08 16:27:37 -07:00
John Clements
8f34b21375 test case for expansion of method macro 2014-07-08 16:27:34 -07:00
John Clements
9ee9c49cb4 introducing let-syntax
The let-syntax expander is different in that it doesn't apply
a mark to its token trees before expansion. This is used
for macro_rules, and it's because macro_rules is essentially
MTWT's let-syntax. You don't want to mark before expand sees
let-syntax, because there's no "after" syntax to mark again.

In some sense, the cleaner approach might be to introduce a new
AST node that macro_rules expands into; this would make it clearer
that the expansion of a macro is distinct from the addition of a
new macro binding.

This should work for now, though...
2014-07-08 16:26:43 -07:00
bors
206dd91742 auto merge of #14832 : alexcrichton/rust/no-rpath, r=brson
This commit disables rustc's emission of rpath attributes into dynamic libraries
and executables by default. The functionality is still preserved, but it must
now be manually enabled via a `-C rpath` flag.

This involved a few changes to the local build system:

* --disable-rpath is now the default configure option
* Makefiles now prefer our own LD_LIBRARY_PATH over the user's LD_LIBRARY_PATH
  in order to support building rust with rust already installed.
* The compiletest program was taught to correctly pass through the aux dir as a
  component of LD_LIBRARY_PATH in more situations.

The major impact of this change is that neither rustdoc nor rustc will work
out-of-the-box in all situations because they are dynamically linked. It must be
arranged to ensure that the libraries of a rust installation are part of the
LD_LIBRARY_PATH. The default installation paths for all platforms ensure this,
but if an installation is in a nonstandard location, then configuration may be
necessary.

Additionally, for all developers of rustc, it will no longer be possible to run
$target/stageN/bin/rustc out-of-the-box. The old behavior can be regained
through the `--enable-rpath` option to the configure script.

This change brings linux/mac installations in line with windows installations
where rpath is not possible.

Closes #11747
[breaking-change]
2014-07-08 22:51:39 +00:00
John Clements
92c2ff6d69 self arg macro test case 2014-07-08 15:15:46 -07:00
John Clements
6007797ed6 replace idents with names 2014-07-08 15:15:46 -07:00
John Clements
c1b8b3c35c get rid of keyword idents, replace with names
should prevent future bugs
2014-07-08 15:15:46 -07:00
John Clements
06b64345d6 preserve context in parsing of self varref 2014-07-08 15:14:46 -07:00
John Clements
728b269199 remove unused fn, make SELF_KEYWORD_NAME public 2014-07-08 15:14:46 -07:00
John Clements
29b3f29820 test harness cleanup 2014-07-08 15:14:46 -07:00
John Clements
9f94f823b0 change if/else to match 2014-07-08 15:14:45 -07:00
John Clements
f3fa836939 added test for method arg hygiene 2014-07-08 15:14:45 -07:00
bors
8bb34a3146 auto merge of #15493 : brson/rust/tostr, r=pcwalton
This updates https://github.com/rust-lang/rust/pull/15075.

Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path.

Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage.

Closes #15046.
2014-07-08 20:06:40 +00:00
Richo Healey
12c334a77b std: Rename the ToStr trait to ToString, and to_str to to_string.
[breaking-change]
2014-07-08 13:01:43 -07:00
Adrien Tétar
b7ef0cf742 webfonts: check-in licenses 2014-07-08 21:55:37 +02:00
Adrien Tétar
3b0b7b6b91 webfonts: serve Source Code Pro locally
So that we have freestanding docs.
2014-07-08 20:31:26 +02:00
Adrien Tétar
4d5f4ff5e9 webfonts: proper fix 2014-07-08 20:29:36 +02:00
Steve Klabnik
654a19b091 Guide: comments 2014-07-08 12:07:11 -04:00
bors
35e2134621 auto merge of #15521 : nick29581/rust/type, r=pcwalton
closes #13367

[breaking-change] Use `Sized?` to indicate a dynamically sized type parameter or trait (used to be `type`). E.g.,

```
trait Tr for Sized? {}

fn foo<Sized? X: Share>(x: X) {}
```
2014-07-08 16:01:41 +00:00