about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2013-10-07syntax: Display spans for open delimiters when a file ends prematurelyTim Chevalier-1/+11
It's more helpful to list the span of each open delimiter seen so far than to print out an error with the span of the last position in the file. Closes #2354
2013-10-05Implement feature-gating for the compilerAlex Crichton-0/+2
A few features are now hidden behind various #[feature(...)] directives. These include struct-like enum variants, glob imports, and macro_rules! invocations. Closes #9304 Closes #9305 Closes #9306 Closes #9331
2013-10-05auto merge of #9250 : erickt/rust/num, r=ericktbors-2/+166
This PR solves one of the pain points with c-style enums. Simplifies writing a fn to convert from an int/uint to an enum. It does this through a `#[deriving(FromPrimitive)]` syntax extension. Before this is committed though, we need to discuss if `ToPrimitive`/`FromPrimitive` has the right design (cc #4819). I've changed all the `.to_int()` and `from_int()` style functions to return `Option<int>` so we can handle partial functions. For this PR though only enums and `extra::num::bigint::*` take advantage of returning None for unrepresentable values. In the long run it'd be better if `i64.to_i8()` returned `None` if the value was too large, but I'll save this for a future PR. Closes #3868.
2013-10-04Remove specific errors for very old obsolete syntaxBenjamin Herr-455/+59
Replaces existing tests for removed obsolete-syntax errors with tests for the resulting regular errors, adds a test for each of the removed parser errors to make sure that obsolete forms don't start working again, removes some obsolete/superfluous tests that were now failing. Deletes some amount of dead code in the parser, also includes some small changes to parser error messages to accomodate new tests.
2013-10-03Rewrite lint passes with less visitor cruftAlex Crichton-23/+17
This purges about 500 lines of visitor cruft from lint passes. All lints are handled in a much more sane way at this point. The other huge bonus of this commit is that there are no more @-boxes in the lint passes, fixing the 500MB memory regression seen when the lint passes were refactored. Closes #8589
2013-10-02std: Swap {To,From}Primitive to use the 64bit as the unimplemented versionErick Tryzelaar-6/+6
One downside with this current implementation is that since BigInt's default is now 64 bit, we can convert larger BigInt's to a primitive, however the current implementation on 32 bit architectures does not take advantage of this fact.
2013-10-02syntax: swap from .span_fatal to .span_err in #[deriving(FromPrimitive)]Erick Tryzelaar-9/+21
2013-10-02syntax: Add #[deriving(FromPrimitive)] syntax extensionErick Tryzelaar-0/+152
Right now this only works for c-style enums.
2013-10-02auto merge of #9673 : huonw/rust/macros, r=catamorphismbors-78/+30
That is, only a single expression or item gets parsed, so if there are any extra tokens (e.g. the start of another item/expression) the user should be told, rather than silently dropping them. An example: macro_rules! foo { () => { println("hi"); println("bye); } } would expand to just `println("hi")`, which is almost certainly not what the programmer wanted. Fixes #8012.
2013-10-02auto merge of #9665 : alexcrichton/rust/snapshot, r=brsonbors-9/+16
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
2013-10-02syntax: indicate an error when a macro ignores trailing tokens.Huon Wilson-5/+30
That is, only a single expression or item gets parsed, so if there are any extra tokens (e.g. the start of another item/expression) the user should be told, rather than silently dropping them. An example: macro_rules! foo { () => { println("hi"); println("bye); } } would expand to just `println("hi")`, which is almost certainly not what the programmer wanted. Fixes #8012.
2013-10-02syntax: remove some dead code.Huon Wilson-73/+0
2013-10-01Migrate users of 'loop' to 'continue'Alex Crichton-9/+9
Closes #9467
2013-10-01Obsolete parsing 'loop' as 'continue'Alex Crichton-0/+7
2013-10-01auto merge of #9560 : pcwalton/rust/xc-tuple-structs, r=pcwaltonbors-2/+13
r? @thestinger
2013-10-01librustc: Inline cross-crate tuple struct constructorsPatrick Walton-2/+13
2013-10-01auto merge of #9519 : thestinger/rust/float, r=catamorphismbors-9/+2
It is simply defined as `f64` across every platform right now. A use case hasn't been presented for a `float` type defined as the highest precision floating point type implemented in hardware on the platform. Performance-wise, using the smallest precision correct for the use case greatly saves on cache space and allows for fitting more numbers into SSE/AVX registers. If there was a use case, this could be implemented as simply a type alias or a struct thanks to `#[cfg(...)]`. Closes #6592 The mailing list thread, for reference: https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01remove the `float` typeDaniel Micay-9/+2
It is simply defined as `f64` across every platform right now. A use case hasn't been presented for a `float` type defined as the highest precision floating point type implemented in hardware on the platform. Performance-wise, using the smallest precision correct for the use case greatly saves on cache space and allows for fitting more numbers into SSE/AVX registers. If there was a use case, this could be implemented as simply a type alias or a struct thanks to `#[cfg(...)]`. Closes #6592 The mailing list thread, for reference: https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01auto merge of #9633 : alexcrichton/rust/issue-9631, r=huonwbors-12/+16
Closes #9631
2013-10-01Fix usage of the old debug! macrosAlex Crichton-1/+1
2013-10-01Change the format! statics to be all-capsAlex Crichton-12/+16
This lets them get past the non_uppercase_statics lint mode (if it's turned on) Closes #9631
2013-10-01Fix typo with format migration: s/oldformat/oldfmt/.Huon Wilson-4/+4
2013-09-30syntax: Remove usage of fmt!Alex Crichton-340/+340
2013-09-30Prevent leakage of fmt! into the compilerAlex Crichton-49/+62
We're not outright removing fmt! just yet, but this prevents it from leaking into the compiler further (it's still turned on by default for all other code).
2013-09-30Expand tidy to prevent binaries from being checkedAlex Crichton-0/+0
Closes #9621
2013-09-29Remove all usage of @ast::CrateAlex Crichton-20/+20
2013-09-27auto merge of #9552 : brson/rust/0.9-pre, r=alexcrichtonbors-1/+1
2013-09-27auto merge of #9535 : alexcrichton/rust/no-format-default, r=thestingerbors-11/+8
As mentioned in #9456, the format! syntax extension would previously consider an empty format as a 'Unknown' format which could then also get coerced into a different style of format on another argument. This is unusual behavior because `{}` is a very common format and if you have `{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly` formatter. This commit removes this coercion, but still retains the requirement that each argument has exactly one format specified for it (an empty format now counts as well). Perhaps at a later date we can add support for multiple formats of one argument, but this puts us in at least a backwards-compatible situation if we decide to do that.
2013-09-27Remove the notion of an "unknown format"Alex Crichton-11/+8
As mentioned in #9456, the format! syntax extension would previously consider an empty format as a 'Unknown' format which could then also get coerced into a different style of format on another argument. This is unusual behavior because `{}` is a very common format and if you have `{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly` formatter. This commit removes this coercion, but still retains the requirement that each argument has exactly one format specified for it (an empty format now counts as well). Perhaps at a later date we can add support for multiple formats of one argument, but this puts us in at least a backwards-compatible situation if we decide to do that.
2013-09-27auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestingerbors-22/+2
The 0.8 release was cut, down with printf!
2013-09-27auto merge of #9540 : alexcrichton/rust/more-rustdoc-improvements, r=brsonbors-4/+4
Commit messages have the details, mostly just knocking out more low-hanging-fruit type issues.
2013-09-26auto merge of #9525 : klutzy/rust/obsolete-span-fix, r=alexcrichtonbors-6/+9
2013-09-26auto merge of #9504 : brson/rust/continue, r=alexcrichtonbors-24/+39
2013-09-26Update version numbers to 0.9-preBrian Anderson-1/+1
2013-09-26auto merge of #9261 : alexcrichton/rust/logging, r=huonwbors-3/+9
This lifts various restrictions on the runtime, for example the character limit when logging a message. Right now the old debug!-style macros still involve allocating (because they use fmt! syntax), but the new debug2! macros don't involve allocating at all (unless the formatter for a type requires allocation.
2013-09-26Update the compiler to not use printf/printflnAlex Crichton-2/+2
2013-09-26Remove the printf{,ln}! macrosAlex Crichton-20/+0
These are deprecated in favor of print{,ln}!
2013-09-26Add 'continue' as a synonym for 'loop'Brian Anderson-24/+39
2013-09-26rustdoc: Render stability attributesAlex Crichton-1/+1
Closes #8965
2013-09-26rustdoc: Generate documentation for foreign itemsAlex Crichton-3/+3
This slurps up everything inside of an 'extern' block into the enclosing module in order to document them. The documentation must be on the items themselves, and they'll show up next to everything else on the module index pages. Closes #5953
2013-09-26syntax: Fix wrong span on trait fn visibilityklutzy-1/+2
Fixes #9348.
2013-09-26syntax: Fix wrong span on ObsoleteModeklutzy-4/+6
2013-09-26syntax: Fix wrong span on ObsoleteEmptyImplklutzy-1/+1
2013-09-25Refactor the logging system for fewer allocationsAlex Crichton-3/+9
This lifts various restrictions on the runtime, for example the character limit when logging a message. Right now the old debug!-style macros still involve allocating (because they use fmt! syntax), but the new debug2! macros don't involve allocating at all (unless the formatter for a type requires allocation.
2013-09-25rustdoc: Improve comment strippingAlex Crichton-15/+40
There is less implicit removal of various comment styles, and it also removes extraneous stars occasionally found in docblock comments. It turns out that the bug for getops was just a differently formatted block. Closes #9425 Closes #9417
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-24/+24
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25auto merge of #9481 : jbclements/rust/minor-cleanup, r=cmrbors-18/+62
Small stuff... might as well get it into the tree. One new test case, some issue # cleanup, remove some unused imports.
2013-09-25auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwaltonbors-49/+9
This fixes private statics and functions from being usable cross-crates, along with some bad privacy error messages. This is a reopening of #8365 with all the privacy checks in privacy.rs instead of resolve.rs (where they should be anyway). These maps of exported items will hopefully get used for generating documentation by rustdoc Closes #8592
2013-09-24auto merge of #9335 : alexcrichton/rust/issue-7945, r=thestingerbors-21/+28
As documented in issue #7945, these literal identifiers are all accepted by rust today, but they should probably be disallowed (especially `'''`). This changes all escapable sequences to being *required* to be escaped. Closes #7945 I wanted to write the tests with more exact spans, but I think #9308 will be fixing that?
2013-09-24Disallow char literals which should be escapedAlex Crichton-21/+28
As documented in issue #7945, these literal identifiers are all accepted by rust today, but they should probably be disallowed (especially `'''`). This changes all escapable sequences to being *required* to be escaped. Closes #7945